[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, support-coreroles-and-customroles, repushed

Craig Kaiser craig at bestpractical.com
Fri Jan 11 11:37:43 EST 2019


The branch support-coreroles-and-customroles was deleted and repushed:
       was c1563d58ecc29aacef42c00849a4858f828fe35b
       now 3d65676e4ada86fb3cbc8df0e74b67126acedd9d

1:  c951d4c ! 1:  fa95e1a Support customroles for mandatoryontransition conditions
    @@ -1,10 +1,9 @@
     Author: Craig Kaiser <craig at bestpractical.com>
     
    -    Support customrole mandatoryontransition conditions
    +    Support customroles for mandatoryontransition conditions
         
         Use the syntax 'CustomRole.MyRole' to set mandatory conditions for
    -    customrole values. Pass a group key to specify if one of the current
    -    users for the customrole must be a member of a specific group.
    +    customrole values.
     
     diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
     --- a/lib/RT/Extension/MandatoryOnTransition.pm
    @@ -36,7 +35,7 @@
          my @cfs  =  map { /^CF\.(.+)$/i; $1; }
                     grep { /^CF\./i } @$required;
     +    my @roles = map { /^(:?[CustomRole\.]?.+)$/i; $1; }
    -+               grep { /^CustomRole\.|^AdminCc|^Cc|^Requestor|^Owner/i } @$required;
    ++               grep { /^CustomRole\./i } @$required;
      
          # Pull out any must_be or must_not_be rules
          my %cf_must_values = ();
    @@ -112,31 +111,24 @@
     +            my $role_arg = $role;
     +            my $role_full = $role;
     +
    -+            if ( $role =~ 'CustomRole.' ) {
    -+                if ( not $CRs ){
    -+                    $RT::Logger->error("Custom Roles object required to process mandatory custom roles");
    -+                    return \@errors;
    -+                }
    -+                $role =~ qr/^CustomRole\.(.+)$/i;
    -+                $role = $1;
    ++            if ( not $CRs ){
    ++                $RT::Logger->error("Custom Roles object required to process mandatory custom roles");
    ++                return \@errors;
    ++            }
    ++            $role =~ qr/^CustomRole\.(.+)$/i;
    ++            $role = $1;
     +
    -+                my $role_object = RT::CustomRole->new($args{Ticket}->CurrentUser);
    ++            my $role_object = RT::CustomRole->new($args{Ticket}->CurrentUser);
     +
    -+                my ($ret, $msg) = $role_object->Load($role);
    -+                push @errors, $CurrentUser->loc("Failed to load customrole $role:  $msg") unless $ret;
    -+                return \@errors unless $ret;
    ++            my ($ret, $msg) = $role_object->Load($role);
    ++            push @errors, $CurrentUser->loc("Failed to load customrole $role:  $msg") unless $ret;
    ++            return \@errors unless $ret;
     +
    -+                $role_arg = 'RT::CustomRole-' . $role_object->Id;
    ++            $role_arg = 'RT::CustomRole-' . $role_object->Id;
     +
    -+                ($ret, $msg) = $role_values = $args{Ticket}->RoleGroup($role_object->GroupType);
    -+                push @errors, $CurrentUser->loc("$msg") unless $ret;
    -+                return \@errors unless $ret;
    -+            } else {
    -+                $role_values = RT::Group->new($args{Ticket}->CurrentUser);
    -+                my ($ret, $msg) = $role_values->LoadRoleGroup(Object => $args{Ticket}, Name => $role);
    -+                push @errors, $CurrentUser->loc("Failed to load role $role for ticket: $msg") unless $ret;
    -+                return \@errors unless $ret;
    -+            }
    ++            ($ret, $msg) = $role_values = $args{Ticket}->RoleGroup($role_object->GroupType);
    ++            push @errors, $CurrentUser->loc("$msg") unless $ret;
    ++            return \@errors unless $ret;
     +
     +            my @role_values;
     +            my @row_input_id = grep $role_arg eq $ARGSRef->{$_}, keys %{$ARGSRef};
-:  ------- > 2:  0f04d86 Support core roles for mandatoryontransation
2:  e6296cc = 3:  5672ec0 Allow group key to be set for roles
3:  e746df7 = 4:  4bd6ee9 Move Owner code into the roles code block
4:  c1563d5 < -:  ------- Update README and inc files
-:  ------- > 5:  3d65676 Update README



More information about the Bps-public-commit mailing list