[rt-users] How to add a group
Albert Shih
Albert.Shih at obspm.fr
Wed Sep 10 10:13:14 EDT 2014
Hi everyone.
I want to add a group (defined inside RT) in a script ?
I find something on the web who use de AddWatcher like something :
my $addGroupObj = RT::Group->new($RT::SystemUser);
$addGroupObj->LoadUserDefinedGroup('My Group');
return undef unless $addGroupObj;
my $addGroupMembersObj = $addGroupObj->UserMembersObj;
my $userObj;
while ($userObj = $addGroupMembersObj->Next) {
if (($ticket->IsRequestor($userObj->PrincipalId)) or ($ticket->IsAdminCc($userObj->PrincipalId))) {
$RT::Logger->debug("Add Group AdminCC: '" . $userObj->Name . "' is already a ticket watcher; not adding AdminCc on ticket \#" . $ticket->id );
} else {
$RT::Logger->debug("On Create Add Group AdminCC: Adding '" . $userObj->Name ."' to ticket \#" .$ticket->id);
my ($success, $msg)= $ticket->AddWatcher(
Type => "AdminCc",
PrincipalId => $userObj->PrincipalId);
if (! $success) {
$RT::Logger->info("On Create Add Group Addmin CC: couldn't add '" . $userObj->Name . "' to " . $ticket->id . "': got '" . $msg ."'");
}
}
}
return 1
but that's no very convenient, I like to add directly a group.
Regards.
JAS
--
Albert SHIH
DIO bâtiment 15
Observatoire de Paris
5 Place Jules Janssen
92195 Meudon Cedex
France
Téléphone : +33 1 45 07 76 26/+33 6 86 69 95 71
xmpp: jas at obspm.fr
Heure local/Local time:
mer 10 sep 2014 16:05:17 CEST
More information about the rt-users
mailing list