[Rt-commit] rt branch 5.0/serialize-custom-role-acl updated. rt-5.0.2-88-gd542b381e6
BPS Git Server
git at git.bestpractical.com
Mon Feb 28 20:25:49 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/serialize-custom-role-acl has been updated
via d542b381e68d2a2cebe46176c22704c50d1c6dc1 (commit)
from acad789dc01d0340e043fc6caba0cffe6d524aed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d542b381e68d2a2cebe46176c22704c50d1c6dc1
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Mar 1 04:03:30 2022 +0800
Test custom role groups in ACL initialdata
diff --git a/t/api/initialdata-roundtrip.t b/t/api/initialdata-roundtrip.t
index e55223acc7..620d054bfb 100644
--- a/t/api/initialdata-roundtrip.t
+++ b/t/api/initialdata-roundtrip.t
@@ -78,6 +78,25 @@ my @tests = (
($ok, $msg) = $inner->PrincipalObj->GrantRight(Object => $inner, Right => 'SeeGroup');
ok($ok, $msg);
+ my $managers = RT::CustomRole->new(RT->SystemUser);
+ ($ok, $msg) = $managers->Create(
+ Name => 'Managers',
+ );
+ ok($ok, $msg);
+
+ ($ok, $msg) = $managers->AddToObject(ObjectId => $general->Id);
+ ok($ok, $msg);
+
+ $general->Load($general->Id); # Reload to update roles cache
+ ( $ok, $msg )
+ = $general->RoleGroup( $managers->GroupType, Create => 1 )
+ ->PrincipalObj->GrantRight( Object => $general, Right => 'ModifyCustomField' );
+ ok( $ok, $msg );
+ ( $ok, $msg )
+ = RT->System->RoleGroup( $managers->GroupType )
+ ->PrincipalObj->GrantRight( Object => RT->System, Right => 'SeeCustomField' );
+ ok( $ok, $msg );
+
},
present => sub {
my $outer = RT::Group->new(RT->SystemUser);
@@ -144,6 +163,22 @@ my @tests = (
ok($inner->PrincipalObj->HasRight(Object => $inner, Right => 'SeeGroup'), 'inner SeeGroup right');
ok($user->PrincipalObj->HasRight(Object => $inner, Right => 'SeeGroup'), 'user SeeGroup right');
ok(!$unrelated->PrincipalObj->HasRight(Object => $inner, Right => 'SeeGroup'), 'unrelated SeeGroup right');
+
+ my $managers = RT::CustomRole->new(RT->SystemUser);
+ $managers->Load('Managers');
+ ok($managers->Id, 'Loaded Managers');
+
+ $general->Load($general->Id); # Reload to update roles cache
+ ok(
+ $general->RoleGroup( $managers->GroupType )
+ ->PrincipalObj->HasRight( Object => $general, Right => 'ModifyCustomField' ),
+ 'custom role ModifyCustomField right'
+ );
+ ok(
+ RT->System->RoleGroup( $managers->GroupType )
+ ->PrincipalObj->HasRight( Object => RT->System, Right => 'SeeCustomField' ),
+ 'custom role SeeCustomField right'
+ );
},
},
-----------------------------------------------------------------------
Summary of changes:
t/api/initialdata-roundtrip.t | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
hooks/post-receive
--
rt
More information about the rt-commit
mailing list