LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help with Perl (https://www.linuxquestions.org/questions/programming-9/help-with-perl-793449/)

VeeDubbs 03-05-2010 12:30 PM

Help with Perl
 
Hi all -

Using the open source help desk software Request Tracker 3.8.7 if that makes a difference to anyone.

One of the main files that drive RT is /opt/rt3/etc/RT_SiteConfig.pm. The comments at the top of the file state that it is a perl module and can include valid perl code.

I was working on getting authenticating our users via LDAP against Novell which I was able to do. RT can also map LDAP attributes to RT. Here is what that snippet of code looks like:

Code:

## RT ATTRIBUTE MATCHING SECTION
# The list of RT attributes that uniquely identify a user
# This example shows what you *can* specify.. I recommend reducing this
# to just the Name and EmailAddress to save encountering problems later.
'attr_match_list'          => [    'Name',
                                    'EmailAddress',
                                    'RealName',
                              ],

# The mapping of RT attributes on to LDAP attributes
'attr_map'                  =>  {  'Name' => 'uid',
                                    'EmailAddress' => 'uid',
                                    'RealName' => 'givenName',
                                    'ExternalAuthId' => 'uid',
                                    'Gecos' => 'uid',
                                }

There is no problem with this code, the problem is with the ino that comes from LDAP. We use Novell eDirectory and do not fill in the EmailAddress field for any of our users.

So, what I'd like to do is maybe create EmailAddresses for anyone that authenticates via LDAP. As you can see, I am currently using the uid from LDAP to populate the EmailAddress of RT. If my uid is bsmith my e-mail address would be bsmith@school.edu. Is there any way to tack on the @school.edu to the LDAP value?

I'm hoping that since this is a perl file, there is some way of doing it in perl. I'm no expert in perl, in fact I no very little about it. But here is what I have tried thus far:


Code:

'EmailAddress' => 'uid'+'@school.edu',
'EmailAddress' => 'uid'&&'@school.edu',
'EmailAddress' => 'uid' . '@school.edu',

Those either crash RT or ignore everything except uid.

Can anyone point me in the right direction? Or tell me it's not possible so I stop wasting my time?

Thanks!!

Sergei Steshenko 03-05-2010 01:39 PM

Quote:

Originally Posted by VeeDubbs (Post 3887235)
Hi all -
...
Can anyone point me in the right direction? Or tell me it's not possible so I stop wasting my time?

Thanks!!

Of course ! The right direction is always to read the documentation first.

On a UNIXish box with Perl installed start from

perldoc perlop

and look there for, say, 'concatenation'.

At all, learn about single and double quotes in Perl - both can be used to represent strings.

In the same document look for 'Quote-like Operators'.

bigearsbilly 03-06-2010 06:18 AM

we can't work out from the few clues given


All times are GMT -5. The time now is 06:25 AM.