Getting a list of privileged users

I’m running a script that grabs a list of users from our LDAP directory and synchronizes group memberships and permissions. Currently, I use code similar to this, to get a list of members:

–snip–
my $currentUser = GetCurrentUser();
my $workingUser = new RT::User($currentUser);
my $systemUser = RT::User->new($RT::SystemUser);

# RT Group
$groupObj = new RT::Group($currentUser);
$groupObj->LoadUserDefinedGroup($groupName);

if ( not $groupObj->Id() )
{
    print "Group ".$groupName." not found in RequestTracker\n";
    next;
}

# Get our members into an array for easy work later.
$groupMembersObj = $groupObj->MembersObj();
my @rtMembers;
while ( $groupMember = $groupMembersObj->Next() )
{
    $groupMemberUser = $groupMember->UserObj();
    $workingUser->Load($groupMember->MemberId());
    $workingUser->Name();
    push(@rtMembers, $workingUser->Name());
}

–snip–

Basically, I load a group by name, and then loop through the array and grab each user into an array. Is there a way I can do this for privileged user names? I just want to get them into an array to work with them later.

Thanks,
Johnathan

Johnathan Bell
Internet System Administrator, Baker College

Office Phone: 810-766-4097
Office Hours: 7A-4P, M-F

I’m running a script that grabs a list of users from our LDAP directory and synchronizes group memberships and permissions. Currently, I use code similar to this, to get a list of members:

–snip–
my $currentUser = GetCurrentUser();

my $workingUser = new RT::User($currentUser);
my $systemUser = RT::User->new($RT::SystemUser);

those two lines are useless, $currentUser and $RT::SystemUser are
already objects, $workingUser and $systemUser are just empty users
objects

Basically, I load a group by name, and then loop through the array and
grab each user into an array. Is there a way I can do this for
privileged user names? I just want to get them into an array to work
with them later.

there is different way to do this, it depends on the final purpose, but
the simplest way to get all priviledged users is:

my $PrivilegedUsers = RT::Users->new ( $RT::SystemUser );
$PrivilegedUsers->LimitToPrivileged;

the walk this with:

while ( my $PrivilegedUser = $PrivilegedUsers->Next ) {
…things to do with user object $PrivilegedUser
}

Hi,
i followed the the instructions from wiki to add all attachments from a ticket (during the whole livetime) as links to the outgoing mail. No i need to attache all the attachements to the outgoing mail, but i can’t find anything useful at the wiki for this.

Any suggestions?

Torsten

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne

One thing i forgot:

‘RT-Attach-Message: Yes’ is a special header that RT uses internally. It means that the outgoing mail should be created with all attachments. Instead of adding attachments to an outgoing email you can add links to those using AddAttachmentLinksToMail.

This point from wiki i have tried already and it is not working.

Torsten-----Ursprüngliche Nachricht-----
Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von Brumm,Torsten / Kuehne + Nagel / Ham MI-ID
Gesendet: Donnerstag, 19. November 2009 15:58
An: rt-users@lists.bestpractical.com
Betreff: [rt-users] How to add attachments (not links) with a template to anoutgoing mail?

Hi,
i followed the the instructions from wiki to add all attachments from a ticket (during the whole livetime) as links to the outgoing mail. No i need to attache all the attachements to the outgoing mail, but i can’t find anything useful at the wiki for this.

Any suggestions?

Torsten

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

One more thing:

From Wiki: ‘RT-Attach-Message: Yes’ is a special header that RT uses internally. It means that the outgoing mail should be created with all attachments.

This All Attachments is not correct, correct is: With all Attachments from the actual transaction. In my case i will sent out a mail with attachments after a ticket status change and not after a reply/comment with attachments and i try to sent out ALL attachments of a ticket.

Any hints?

Torsten-----Ursprüngliche Nachricht-----
Von: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Gesendet: Donnerstag, 19. November 2009 16:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID; rt-users@lists.bestpractical.com
Betreff: AW: [rt-users] How to add attachments (not links) with a template to anoutgoing mail?

One thing i forgot:

‘RT-Attach-Message: Yes’ is a special header that RT uses internally. It means that the outgoing mail should be created with all attachments. Instead of adding attachments to an outgoing email you can add links to those using AddAttachmentLinksToMail.

This point from wiki i have tried already and it is not working.

Torsten

-----Ursprüngliche Nachricht-----
Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von Brumm,Torsten / Kuehne + Nagel / Ham MI-ID
Gesendet: Donnerstag, 19. November 2009 15:58
An: rt-users@lists.bestpractical.com
Betreff: [rt-users] How to add attachments (not links) with a template to anoutgoing mail?

Hi,
i followed the the instructions from wiki to add all attachments from a ticket (during the whole livetime) as links to the outgoing mail. No i need to attache all the attachements to the outgoing mail, but i can’t find anything useful at the wiki for this.

Any suggestions?

Torsten

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:

Hi, i followed the the instructions from wiki to add all attachments
from a ticket (during the whole livetime) as links to the outgoing
mail. No i need to attache all the attachements to the outgoing mail,
but i can’t find anything useful at the wiki for this.

Any suggestions?

As far as I know, you’d have to write a custom email template that
fetches the attachment contents through the perl API and builds a
MIME-encapsulated message body. Of course it has to execute fully
before the resulting page will display, which might take awhile.

Since I’ve forgotten most of my perl at this point, and I’d want the
page to display quicker, personally I would probably build myself a
custom REST service and have the perl template call that and supply some
parameters. But that’s just me.

Tom Lahti, SCMDBA, LPIC-1
BIT LLC
(425)251-0833 x 117
http://www.bitstatement.net/

Hi Tom,

thanks for the hint. in the mean time we found a easy way to do this :wink:

Torsten

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne

-----Urspruengliche Nachricht-----Von: Tom Lahti [mailto:toml@bitstatement.net]
Gesendet: Donnerstag, 19. November 2009 22:43
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] How to add attachments (not links) with a template to an outgoing mail?

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:

Hi, i followed the the instructions from wiki to add all attachments
from a ticket (during the whole livetime) as links to the outgoing
mail. No i need to attache all the attachements to the outgoing mail,
but i can’t find anything useful at the wiki for this.

Any suggestions?

As far as I know, you’d have to write a custom email template that fetches the attachment contents through the perl API and builds a MIME-encapsulated message body. Of course it has to execute fully before the resulting page will display, which might take awhile.

Since I’ve forgotten most of my perl at this point, and I’d want the page to display quicker, personally I would probably build myself a custom REST service and have the perl template call that and supply some parameters. But that’s just me.

Tom Lahti, SCMDBA, LPIC-1
BIT LLC
(425)251-0833 x 117
http://www.bitstatement.net/

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:

Hi Tom,

thanks for the hint. in the mean time we found a easy way to do this :wink:

Torsten

Out of curiousity, what is that easy way, in case we ever need that here?

Tom Lahti, SCMDBA, LPIC-1
BIT LLC
(425)251-0833 x 117
http://www.bitstatement.net/

Hi Tom,
the easy way is to sent out 2 mails, one with the needed attachmentes and
the first with the ticket history.

Let me explain why we needed this and why we have done it in this way:

In this queue, we are talking with a customer Ticket System. We move tickets
from our “normal” queue to this queue at a specific point and we need to
sent the whole history and all attachments. So, we trigger OnQueueChange -
here the RT-Attache-Message don’t work, but we can sent all the history at
this step.

Now we get back from the customer system a automatic mail with their ticket
number, we parse this and make sure with some scrips that from now both
tickets talk about the same. after this OnCorrespond Condition, we can use
the RT-Attach-Message function and we are now able to sent all the Ticket
attachments also to the customer into the correct ticket.

Thats it.

Torsten2009/11/20 Tom Lahti toml@bitstatement.net

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:

Hi Tom,

thanks for the hint. in the mean time we found a easy way to do this :wink:

Torsten

Out of curiousity, what is that easy way, in case we ever need that here?

Tom Lahti, SCMDBA, LPIC-1
BIT LLC
(425)251-0833 x 117
http://www.bitstatement.net/


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

MFG

Torsten Brumm

http://www.brumm.me
http://www.elektrofeld.de