[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.9-64-g51416d3
Alex Vandiver
alexmv at bestpractical.com
Wed Jan 14 12:10:56 EST 2015
The branch, 4.2-trunk has been updated
via 51416d3e0aa1abb778c6da9d8238b036c2ba3aab (commit)
from a47767178deab89aee8cf51efb94d6ea22cd55f1 (commit)
Summary of changes:
docs/initialdata.pod | 7 ++++---
lib/RT/Handle.pm | 21 ++++++++++++---------
t/data/initialdata/initialdata | 2 +-
3 files changed, 17 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 51416d3e0aa1abb778c6da9d8238b036c2ba3aab
Author: Emmanuel Lacour <elacour at easter-eggs.com>
Date: Wed Jan 14 11:09:47 2015 +0100
Allow more than one right per @ACL in initialdata
One may now use either:
@ACL = (
{
[...],
Right => 'ModifyTicket',
},
);
-- or --
@ACL = (
{
[...],
Right => [ 'ModifyTicket', 'ShowTicket', ],
},
);
Fixes: I#30605
diff --git a/docs/initialdata.pod b/docs/initialdata.pod
index 44a93ed..eab3541 100644
--- a/docs/initialdata.pod
+++ b/docs/initialdata.pod
@@ -252,10 +252,11 @@ C<@ACL> is very useful for granting rights on your newly created records or
setting up a standard system configuration. It is one of the most complex
initialdata structures.
-=head3 Pick a Right
+=head3 Pick one or more C<Right>s
-All ACL definitions expect a key named C<Right> with the internal right name
-you want to grant. The internal right names are visible in RT's admin
+All ACL definitions expect a key named C<Right> with the internal right
+name you want to grant; alternately, it may contain an array reference
+of right names. The internal right names are visible in RT's admin
interface in grey next to the longer descriptions.
=head3 Pick a level: on a queue, on a CF, or globally
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 4dc9994..3b8bff5 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -1112,15 +1112,18 @@ sub InsertData {
}
# Grant it
- my ( $return, $msg ) = $princ->PrincipalObj->GrantRight(
- Right => $item->{'Right'},
- Object => $object
- );
- unless ( $return ) {
- $RT::Logger->error( $msg );
- }
- else {
- $RT::Logger->debug( $return ."." );
+ my @rights = ref($item->{'Right'}) eq 'ARRAY' ? @{$item->{'Right'}} : $item->{'Right'};
+ foreach my $right ( @rights ) {
+ my ( $return, $msg ) = $princ->PrincipalObj->GrantRight(
+ Right => $right,
+ Object => $object
+ );
+ unless ( $return ) {
+ $RT::Logger->error( $msg );
+ }
+ else {
+ $RT::Logger->debug( $return ."." );
+ }
}
}
$RT::Logger->debug("done.");
diff --git a/t/data/initialdata/initialdata b/t/data/initialdata/initialdata
index fb89479..9607648 100644
--- a/t/data/initialdata/initialdata
+++ b/t/data/initialdata/initialdata
@@ -66,7 +66,7 @@
GroupDomain => 'UserDefined',
CF => 'Favorite Color',
Queue => 'Test Queue',
- Right => 'SeeCustomField',
+ Right => ['SeeCustomField', 'ModifyCustomField'],
},
);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list