[Rt-commit] rt branch, 4.4/custom-role-check-right, repushed
? sunnavy
sunnavy at bestpractical.com
Tue May 1 18:26:10 EDT 2018
The branch 4.4/custom-role-check-right was deleted and repushed:
was afb2699e4083e1a7b18b9e26327b25e21aaa3ae6
now 595288555ead026b740c1d81bed0ccd83f63d887
1: 9a55859e4 = 1: 9a55859e4 Make sure RT::Queue::CustomRoles returns an empty collection if no rights
2: 94a947f70 ! 2: 261c1c3cb Hide custom roles from Objects' various Role methods if no rights
@@ -22,7 +22,9 @@
my %attr = @_;
+ my %custom_role;
++ my $check_custom_role;
+ if ( blessed( $self ) && $self->can( 'CustomRoles' ) ) {
++ $check_custom_role = 1;
+ %custom_role =
+ map { 'RT::CustomRole-' . $_->id => 1 } @{ $self->CustomRoles->ItemsArrayRef };
+ }
@@ -35,7 +37,7 @@
grep { !$_->[1]{AppliesToObjectPredicate}
or $_->[1]{AppliesToObjectPredicate}->($self) }
- map { [ $_, $self->Role($_) ] }
-+ grep { !$_->[ 1 ]{UserDefined} or !%custom_role or $custom_role{ $_->[ 0 ] } }
++ grep { !$_->[ 1 ]{UserDefined} or !$check_custom_role or $custom_role{ $_->[ 0 ] } }
+ map { [ $_, $self->_ROLES->{$_} ] }
keys %{ $self->_ROLES };
}
3: afb2699e4 ! 3: 595288555 Test custom roles with user with/without rights
@@ -12,8 +12,8 @@
+ my $alice = RT::Test->load_or_create_user( EmailAddress => 'alice at example.com' );
+ for my $q ( $general, $inbox, $specs, $development ) {
+ my $queue = RT::Queue->new( $alice );
-+ $q->Load( $q->id );
-+ ok( $q->id, 'Load queue' );
++ $queue->Load( $q->id );
++ ok( $queue->id, 'Load queue' );
+
+ my $qroles = $queue->CustomRoles;
+ is( $qroles->Count, 0, 'No custom roles for users without rights' );
More information about the rt-commit
mailing list