[rt-users] Authentication Question

Mark Farrington mark.farrington at gtn.uk.com
Tue Jan 12 05:14:35 EST 2010


Ok,

I've got somewhere with this following falcone's advice.

If it's any use to anyone else, I added the following to ExternalAuth.pm (mostly borrowed from the LDAPImport Extension) - it's creating a group based on the name of the Auth service in RTSiteConfig and adding the user to it.

It needs some debug added (as there currently is none) - but if it can be of use to anyone feel free to borrow it.

M*

##### Added By MRF

# Creates Groups based on $service

    my $rt_group = RT::Group->new($RT::SystemUser);

    $rt_group->LoadUserDefinedGroup( $service );
    unless ($rt_group->Id) {
        my ($gp_id,$gp_msg) = $rt_group->CreateUserDefinedGroup( Name => $service );
        unless ($gp_id) {
            #$self->_error("Can't create group $group_name [$msg]")
        }
    }

    #group already exists (or does now) - so we can add user to it

#Adds Users to groups

	#my $principal = $UserObj->PrincipalObj;
	 if ($rt_group->HasMember($session->{'CurrentUser'})) {
        #$self->_debug($user->Name . " already a member of " . $group->Name);
        return;
    	 }

	$rt_group->AddMember($session->{'CurrentUser'}->Id);



##### Snip



Mark Farrington
Broadcast Engineer
Global Traffic Network UK 



Please note: Our office address has now changed to:
Global Traffic Network (UK) Ltd, 5th Floor, 5 Golden Square, London, W1F 9BS

Global Traffic Network (UK) is a limited Company registered in England and Wales. Registered number: 5867987   Registered office: 179 Great Portland Street, London, UK.

Global Traffic Network (UK) Commercial is a limited Company registered in England and Wales. Registered number: 2229296  Registered office: 179 Great Portland Street, London, UK.

This email is intended for the addressee only. If you have received this email in error, then please notify the sender immediately and delete the email without copying, storing or disclosing its contents to any other person.

Copyright of this email and its attachment(s) are the property of Global Traffic Network (UK) and/or Global Traffic Network (UK) Commercial, unless otherwise stated.
______________________________________________________________________
This email has been scanned by MessageLabs 
and is free of all known viruses and spyware.
______________________________________________________________________



More information about the rt-users mailing list