[Rt-commit] rt branch, 4.4/validator-create-missing-ticket-role-groups, created. rt-4.4.2-239-gf224bddad
? sunnavy
sunnavy at bestpractical.com
Tue May 29 16:12:01 EDT 2018
The branch, 4.4/validator-create-missing-ticket-role-groups has been created
at f224bddad494f093c90d6f646466f4b6cf9e0db6 (commit)
- Log -----------------------------------------------------------------
commit f224bddad494f093c90d6f646466f4b6cf9e0db6
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed May 30 04:00:21 2018 +0800
Create related role groups if rt-validator finds tickets that don't have any
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 30ab1d2c5..6a0d18d03 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -165,6 +165,7 @@ $redo_on{'Create'} = {
Groups => ['User <-> ACL equivalence group', 'GMs -> Groups, Members', 'CGM vs. GM' ],
GroupMembers => [ 'CGM vs. GM' ],
CachedGroupMembers => [ 'CGM vs. GM' ],
+ Tickets => [ 'Tickets <-> Role Groups' ],
};
$redo_on{'Update'} = {
Groups => ['User Defined Group Name uniqueness'],
@@ -322,6 +323,21 @@ push @CHECKS, 'Tickets <-> Role Groups' => sub {
'Tickets', 'id' => 'Groups', 'Instance',
join_condition => 't.Domain = ?',
bind_values => [ 'RT::Ticket-Role' ],
+ action => sub {
+ my $id = shift;
+ return unless prompt(
+ 'Create', "Found a ticket that has no role groups."
+ );
+
+ my $ticket = RT::Ticket->new( RT->SystemUser );
+ $ticket->Load( $id );
+ die "Couldn't load ticket #$id" unless $ticket->id;
+
+ print "Creating role groups for ticket #$id\n" if $opt{ 'verbose' };
+ $redo_check{ $_ } = 1 foreach @{ $redo_on{ 'Create' }{ 'Tickets' } };
+ my $ret = $ticket->_CreateRoleGroups();
+ die "Couldn't create role groups for ticket $id" unless $ret;
+ },
);
# from group to ticket
$res *= check_integrity(
-----------------------------------------------------------------------
More information about the rt-commit
mailing list