Skip to content

Commit

Permalink
Merge branch '4.0/clean-lifecycle-rights' into 4.0.1-releng
Browse files Browse the repository at this point in the history
Conflicts:
	etc/upgrade/4.0.1/content
    4.0.1 had grown a "remove personal group and delegation rights" upgrade
    step, which was duplicated in this branch for removing unused lifecycle
    rights, so the conflict is mostly spurious.
  • Loading branch information
sartak committed Jun 13, 2011
2 parents 0c7607b + 933ae96 commit 67f2bf3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
28 changes: 15 additions & 13 deletions etc/RT_Config.pm.in
Original file line number Diff line number Diff line change
Expand Up @@ -2083,19 +2083,19 @@ ticket creation>.

=item on_merge

When tickets are merged status of the ticket that merged is changed by
force to this. It should be one of inactive statuses; 'resolved' or
its equivalent is most probably the best candidate.
When tickets are merged, the status of the ticket that was merged
away is forced to this value. It should be one of inactive statuses;
'resolved' or its equivalent is most probably the best candidate.

=item approved

When an approval accepted status of depending tickets changed
to this value.
When an approval is accepted, the status of depending tickets will
be changed to this value.

=item denied

When an approval denied status of depending tickets changed
to this value.
When an approval is denied, the status of depending tickets will
be changed to this value.

=back

Expand Down Expand Up @@ -2128,20 +2128,24 @@ above.
=head3 Protecting status changes with rights

A transition or group of transitions can be protected by a specific
right.

For example:
right. Additionally, you can name new right names, which will be added
to the system to control that transition. For example, if you wished to
create a lesser right than ModifyTicket for rejecting tickets, you could
write:

default => {
...
rights => {
'* -> deleted' => 'DeleteTicket',
'* -> rejected' => 'RejectTicket',
'* -> *' => 'ModifyTicketStatus',
'* -> *' => 'ModifyTicket',
},
...
},

This would create a new C<RejectTicket> right in the system which you
could assign to whatever groups you choose.

On the left hand side you can have the following variants:

'<from> -> <to>'
Expand Down Expand Up @@ -2176,7 +2180,6 @@ Use the following format to define labels and actions of transitions:

default => {
...
actions => {
actions => [
'new -> open' => { label => 'Open it', update => 'Respond' },
'new -> resolved' => { label => 'Resolve', update => 'Comment' },
Expand Down Expand Up @@ -2254,7 +2257,6 @@ Set(%Lifecycles,
},
rights => {
'* -> deleted' => 'DeleteTicket',
'* -> rejected' => 'ModifyTicket',
'* -> *' => 'ModifyTicket',
},
actions => [
Expand Down
20 changes: 19 additions & 1 deletion etc/upgrade/4.0.1/content
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@
$RT::Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
}
}
}
},
sub {
use strict;
$RT::Logger->debug('Removing unimplemented RejectTicket and ModifyTicketStatus rights');

my $acl = RT::ACL->new(RT->SystemUser);
for my $right (qw/RejectTicket ModifyTicketStatus/) {
$acl->Limit( FIELD => 'RightName', VALUE => $right );
}

while ( my $ace = $acl->Next ) {
my ( $ok, $msg ) = $ace->Delete();
$RT::Logger->debug("Removing ACE ".$ace->id." for right ".$ace->__Value('RightName'));

if ( !$ok ) {
$RT::Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
}
}
},
);

2 changes: 1 addition & 1 deletion lib/RT/Lifecycle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ sub RightsDescription {
}
my $description = 'Change status'
. ( (grep $_ eq '*', @from)? '' : ' from '. join ', ', @from )
. ( (grep $_ eq '*', @to )? '' : ' to '. join ', ', @from );
. ( (grep $_ eq '*', @to )? '' : ' to '. join ', ', @to );

$res{ $right } = $description;
}
Expand Down
4 changes: 0 additions & 4 deletions lib/RT/Queue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ our $RIGHTS = {
CommentOnTicket => 'Comment on tickets', # loc_pair
OwnTicket => 'Own tickets', # loc_pair
ModifyTicket => 'Modify tickets', # loc_pair
ModifyTicketStatus => 'Modify ticket status', # loc_pair
DeleteTicket => 'Delete tickets', # loc_pair
RejectTicket => 'Reject tickets', # loc_pair
TakeTicket => 'Take tickets', # loc_pair
StealTicket => 'Steal tickets', # loc_pair

Expand Down Expand Up @@ -146,9 +144,7 @@ our $RIGHT_CATEGORIES = {
CommentOnTicket => 'General',
OwnTicket => 'Staff',
ModifyTicket => 'Staff',
ModifyTicketStatus => 'Staff',
DeleteTicket => 'Staff',
RejectTicket => 'Staff',
TakeTicket => 'Staff',
StealTicket => 'Staff',
ForwardMessage => 'Staff',
Expand Down

0 comments on commit 67f2bf3

Please sign in to comment.