Re: [rt-users] Perl help
On Tue, 26 May 2009 19:59:15 -0400, Ken Crocker kfcroc...@lbl.gov wrote: I don't see or understand the mechanisms that make the - work. My problem is that I am completely sight-oriented. It's the old saying, I can hear you talking, but I can't see a word you say. That's me. I've coded in over 20 languages in my 40 years in this business, but no perl. Perl is EXTREMELY harder to understand than COBOL, SQL, even Assembler. I have no framework of reference points to See what the explanations of the code means. Kenn, I found an online book Beginning Perl that would answer many of your questions - http://www.perl.org/books/beginning-perl/ The Object-Oriented Perl chapter in particular explains the - syntax. Might be worth a try - and it's free! Steve ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
[rt-users] Perl help
Greetings, I need to know how to take an email address (directly from an email header) and get the actual UserId/PrincipalId from RT. I have the address split out and now I just need an ID. I'm assuming that the PrincipalId is the same thing as the Name field from the USERS Table. In other words, I do NOT want to add an entire email address as a Ticket watcher, I want the Name field from the USers Table (ie. instead of kfcroc...@lbl.gov I want KFCrocker or whatever name correlates to kfcroc...@lbl.gov). Thank you in advance. Kenn LBNL ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Perl help
I think you miss concepts: * each user is principal * each group is principal * but three above are records in different tables * id of a user is equal to id of its principal record * the same applies to groups * in DB couldn't be a group with id equal to id of a user * every watcher is a user * id, name and email address are unique fields * because of this uniquenes AddWatcher methods can take email address as an argument On Wed, May 27, 2009 at 1:14 AM, Ken Crocker kfcroc...@lbl.gov wrote: Greetings, I need to know how to take an email address (directly from an email header) and get the actual UserId/PrincipalId from RT. I have the address split out and now I just need an ID. I'm assuming that the PrincipalId is the same thing as the Name field from the USERS Table. In other words, I do NOT want to add an entire email address as a Ticket watcher, I want the Name field from the USers Table (ie. instead of kfcroc...@lbl.gov I want KFCrocker or whatever name correlates to kfcroc...@lbl.gov). Thank you in advance. Kenn LBNL ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com -- Best regards, Ruslan. ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Perl help
I need to know how to take an email address (directly from an email header) and get the actual UserId/PrincipalId from RT. I have the address split out and now I just need an ID. I'm assuming that the PrincipalId is the same thing as the Name field from the USERS Table. In other words, I do NOT want to add an entire email address as a Ticket watcher, I want the Name field from the USers Table (ie. instead of kfcroc...@lbl.gov I want KFCrocker or whatever name correlates to kfcroc...@lbl.gov). Thank you in advance. Going into the database schema directly is a bad idea. Future upgrades can (and will) change the schema, breaking your customization. Use the REST interface instead. See http://wiki.bestpractical.com/view/REST Then, an HTTP GET of the URI '/REST/1.0/user/KFCrocker/show' should get you something like: id: user/217 Name: KFCrocker Password: EmailAddress: kfcroc...@lbl.gov RealName: Ken Crocker Lang: en Privileged: 1 Disabled: 0 However, here you are querying by name, not by email address, so hopefully they all match. If they don't you aren't going to be able to do it reliably in a future-proof way without doing something you really don't want to do. Though really, I'm not sure why you'd want to do this in the first place. RT is quite happy to look up based on email address internally, you don't have to supply the ID when creating tickets and such, just an email address. -- -- Tom Lahti BIT Statement LLC (425)251-0833 x 117 http://www.bitstatement.net/ -- ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Perl help
Once again, ALWAYS cc mailing list! Comments below. On Wed, May 27, 2009 at 2:36 AM, Ken Crocker kfcroc...@lbl.gov wrote: Ruslan, What? I don't understand your answer. Perhaps I didn't explain myself very well. Let me try again. I understand the principals, I just don't know what code or command or whatever (ie. LOOKs something like self-TransactionObj-Name(?)-EmailAddress(?) or however it would look) to To call a method you need an object, so you can not do ...-Name-EmailAddress cuz -Name usually returns a string. get the Id or Name of the user when all I have is the email address. I'm If you have an id, name or email then you can get other details about record by constructing an object and loading it, for example: my $user_obj = RT::User-new( $RT::SysteUser ); $user_obj-Load($id); # or $name or use another -Load* method unless ( $user_obj-id ) { ... error handling ... } $user_obj-EmailAddress; $user_obj-Name; $user_obj-id; ... adding ticket watchers. I don't want them to be added by email address, but by ID or name. I don't know how to code that command. I don't even know how to say it correctly, let alone write it, code it, whatever. I've seen code that looks like ($self-TransactionObj-CreatorObj-name; or $self-TransactionObj-CreatorObj-Id;). Does that make any sense? If you're in an user defined scrip action then you can do above things. Kenn LBNL On 5/26/2009 2:27 PM, Ruslan Zakirov wrote: I think you miss concepts: * each user is principal * each group is principal * but three above are records in different tables * id of a user is equal to id of its principal record * the same applies to groups * in DB couldn't be a group with id equal to id of a user * every watcher is a user * id, name and email address are unique fields * because of this uniquenes AddWatcher methods can take email address as an argument On Wed, May 27, 2009 at 1:14 AM, Ken Crocker kfcroc...@lbl.gov wrote: Greetings, I need to know how to take an email address (directly from an email header) and get the actual UserId/PrincipalId from RT. I have the address split out and now I just need an ID. I'm assuming that the PrincipalId is the same thing as the Name field from the USERS Table. In other words, I do NOT want to add an entire email address as a Ticket watcher, I want the Name field from the USers Table (ie. instead of kfcroc...@lbl.gov I want KFCrocker or whatever name correlates to kfcroc...@lbl.gov). Thank you in advance. Kenn LBNL ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com -- Best regards, Ruslan. ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Perl help
Ruslan, My apologies on not CC'ing the list. I was trying to avoid letting the world see how ignorant I am on this stuff. Anyway, what I don't understand is how to get from an email address (which I DO have) to the ID or Name of the person that correlates to said Email address. Since I understand so little of how some of these commands work (for example, I may see the code $self-TransactionObj-OldValue != RT::Nobody()-id(); but I have no idea why it won't work like this $self-TransactionObj-OldValue != RT::Nobody()-name-id();). I don't see or understand the mechanisms that make the - work. My problem is that I am completely sight-oriented. It's the old saying, I can hear you talking, but I can't see a word you say. That's me. I've coded in over 20 languages in my 40 years in this business, but no perl. Perl is EXTREMELY harder to understand than COBOL, SQL, even Assembler. I have no framework of reference points to See what the explanations of the code means. Hence, my mind-boggling frustration (both experienced and caused) with trying to understand your explanations. S, when you say To call a method you need an object, so you can not do...-Name-EmailAddress cuz -Name usually returns a string. I have a difficult time understanding the relationsship between Object and command so that I would know that $self-TransactionObj-EmailAddress-User-Id won't work. Does any of that diatribe make any sense? What I have is an Email address that someone helped me get from the Header of the email.It looks like this: 'kfcroc...@lbl.gov' So, how do I (or what do I code) get a users name of Id from that? Thank you s much for your patience. Kenn LBNL On 5/26/2009 4:12 PM, Ruslan Zakirov wrote: Once again, ALWAYS cc mailing list! Comments below. On Wed, May 27, 2009 at 2:36 AM, Ken Crocker kfcroc...@lbl.gov wrote: Ruslan, What? I don't understand your answer. Perhaps I didn't explain myself very well. Let me try again. I understand the principals, I just don't know what code or command or whatever (ie. LOOKs something like self-TransactionObj-Name(?)-EmailAddress(?) or however it would look) to To call a method you need an object, so you can not do ...-Name-EmailAddress cuz -Name usually returns a string. get the Id or Name of the user when all I have is the email address. I'm If you have an id, name or email then you can get other details about record by constructing an object and loading it, for example: my $user_obj = RT::User-new( $RT::SysteUser ); $user_obj-Load($id); # or $name or use another -Load* method unless ( $user_obj-id ) { ... error handling ... } $user_obj-EmailAddress; $user_obj-Name; $user_obj-id; ... adding ticket watchers. I don't want them to be added by email address, but by ID or name. I don't know how to code that command. I don't even know how to say it correctly, let alone write it, code it, whatever. I've seen code that looks like ($self-TransactionObj-CreatorObj-name; or $self-TransactionObj-CreatorObj-Id;). Does that make any sense? If you're in an user defined scrip action then you can do above things. Kenn LBNL On 5/26/2009 2:27 PM, Ruslan Zakirov wrote: I think you miss concepts: * each user is principal * each group is principal * but three above are records in different tables * id of a user is equal to id of its principal record * the same applies to groups * in DB couldn't be a group with id equal to id of a user * every watcher is a user * id, name and email address are unique fields * because of this uniquenes AddWatcher methods can take email address as an argument On Wed, May 27, 2009 at 1:14 AM, Ken Crocker kfcroc...@lbl.gov wrote: Greetings, I need to know how to take an email address (directly from an email header) and get the actual UserId/PrincipalId from RT. I have the address split out and now I just need an ID. I'm assuming that the PrincipalId is the same thing as the Name field from the USERS Table. In other words, I do NOT want to add an entire email address as a Ticket watcher, I want the Name field from the USers Table (ie. instead of kfcroc...@lbl.gov I want KFCrocker or whatever name correlates to kfcroc...@lbl.gov). Thank you in advance. Kenn LBNL ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com