[Rt-devel] Proposed: RT::User->_LoadOSUserInfo()
Jim Meyer
purp at acm.org
Mon Apr 3 17:06:10 EDT 2006
Hello!
There's a FIXME in the autohandler with regards to autocreating users
when $RT::WebExternal* is configured:
my $new_user_info = RT::Interface::Web::WebExternalAutoInfo($user);
# set the attributes that have been defined.
# FIXME: this is a horrible kludge. I'm sure there's something cleaner
foreach my $attribute ('Name', 'Comments', 'Signature', 'EmailAddress',
'PagerEmailAddress', 'FreeformContactInfo',
'Organization', 'Disabled', 'Privileged',
'RealName', 'NickName', 'Lang', 'EmailEncoding',
'WebEncoding', 'ExternalContactInfoId',
'ContactInfoSystem', 'ExternalAuthId', 'Gecos',
'HomePhone', 'WorkPhone', 'MobilePhone',
'PagerPhone', 'Address1', 'Address2', 'City',
'State', 'Zip', 'Country') {
$m->comp('/Elements/Callback', %ARGS, _CallbackName => 'NewUser');
my $method = "Set$attribute";
$UserObj->$method($new_user_info->{$attribute})
if ( defined $new_user_info->{$attribute} );
}
RT::Interface::Web::WebExternalAutoInfo() (called at the top of that
code snippet) fetches username-based info from the operating system; it
uses getpwnam() on Unix-y OSes and has placeholder code for where you'd
pull in info from the Windows PDC but no implementation. I took a run at
tidying this up last week which used RT::User internals, which is a bad
thing to do when you're not another method on the object.
I was thinking about it over the weekend and wondered why
WebExternalAutoInfo() and the autohandler code above, which is all
pretty strongly linked to the RT::User object, isn't actually a method
on that object, e.g. $UserObj->_LoadOSUserInfo() or somesuch. If it
were, it could be incorporated in RT::User->Create(), which makes it
useful for all autocreated accounts.
As always, if this seems like a good idea, I'll offer patches.
Cheers!
--j
--
Jim Meyer, Geek at Large purp at acm.org
More information about the Rt-devel
mailing list