[Rt-commit] rt branch, 4.4/lazy-role-groups, repushed
? sunnavy
sunnavy at bestpractical.com
Tue May 18 17:42:09 EDT 2021
The branch 4.4/lazy-role-groups was deleted and repushed:
was de27f385cb1a28a10c6ad9f709e6db592fbeeaae
now de4d823b4fb45d5faada95c9c1d66aaa25d0f159
1: d1c2ebfc17 ! 1: 250eb2cdc0 Support to create ticket/asset role groups lazily
@@ -8,6 +8,8 @@
when needed reduces time to create the object.
Since role groups may not exist, we need to use left join in searches.
+
+ Note that it's not enabled by default, for back compatibility.
diff --git a/lib/RT/Asset.pm b/lib/RT/Asset.pm
--- a/lib/RT/Asset.pm
@@ -18,7 +20,9 @@
+=item LazyRoleGroups
+
-+A boolean to control if to create role groups immediately or just when necessary
++A boolean to control if to create role groups immediately or just when
++necessary. It defaults to C<$RT::Record::Role::Roles::LAZY_ROLE_GROUPS>,
++which is false by default.
+
=back
@@ -27,7 +31,7 @@
Contact => undef,
Status => undef,
-+ LazyRoleGroups => 1,
++ LazyRoleGroups => $RT::Record::Role::Roles::LAZY_ROLE_GROUPS,
@_
);
my @non_fatal_errors;
@@ -54,6 +58,16 @@
diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
+@@
+ use Role::Basic;
+ use Scalar::Util qw(blessed);
+
++# Set this to true to lazily create role groups
++our $LAZY_ROLE_GROUPS;
++
+ =head1 NAME
+
+ RT::Record::Role::Roles - Common methods for records which "watchers" or "roles"
@@
my $changed = 0;
@@ -102,6 +116,9 @@
MIMEObj -- a MIME::Entity object with the content of the initial ticket request.
CustomField-<n> -- a scalar or array of values for the customfield with the id <n>
+ LazyRoleGroups -- a boolean to control if to create role groups immediately or just when necessary
++
++LazyRoleGroups defaults to C<$RT::Record::Role::Roles::LAZY_ROLE_GROUPS>,
++which is false by default.
Ticket links can be set up during create by passing the link type as a hask key and
the ticket id to be linked to as a value (or a URI when linking to other objects).
@@ -109,7 +126,7 @@
SLA => undef,
MIMEObj => undef,
_RecordTransaction => 1,
-+ LazyRoleGroups => 1,
++ LazyRoleGroups => $RT::Record::Role::Roles::LAZY_ROLE_GROUPS,
@_
);
2: 1568c9dd88 = 2: 69b846515c Default PrincipalId to 0 to avoid SQL error for not-existing role groups
3: 529e5dcbc6 ! 3: 8d6539a7a5 Improve RoleGroup method to create the group if asked
@@ -6,6 +6,8 @@
of the group, in which case we don't want to create the group
implicitly, for efficiency and performance. Thus we add "Create"
parameter to make the creation optional.
+
+ This is to simplify role group creation for lazy ones.
diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
--- a/lib/RT/Record/Role/Roles.pm
4: 2f3b4f4ee7 ! 4: b720ec9b3c Optionally validate Requestor/AdminCc/Cc as they could be lazily created
@@ -1,8 +1,8 @@
Author: sunnavy <sunnavy at bestpractical.com>
- Remove ticket Requestor/AdminCc/Cc validations as they are lazily created now
+ Optionally validate Requestor/AdminCc/Cc as they could be lazily created
- See also d1c2ebfc17
+ See also 250eb2cdc0
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
--- a/sbin/rt-validator.in
@@ -12,7 +12,8 @@
# from queue to group
my $res = 1;
- for my $role (qw/Requestor Owner Cc AdminCc/ ) {
-+ for my $role (qw/Owner/ ) {
++ no warnings 'once';
++ for my $role ( 'Owner', $RT::Record::Role::Roles::LAZY_ROLE_GROUPS ? () : (qw/Requestor Owner Cc AdminCc/) ) {
$res *= check_integrity(
'Tickets', 'EffectiveId' => 'Groups', 'Instance',
join_condition => 't.Domain = ? AND t.Name = ?',
5: de27f385cb < -: ------- Update tests for the change of lazy role groups
-: ------- > 5: de4d823b4f Test lazy role groups
More information about the rt-commit
mailing list