[Typo3-dev] creating BE users with code (eg LDAP sync, etc)

Martin T. Kutschker Martin.no5pam.Kutschker at blackbox.n0spam.net
Sat Jan 29 15:08:08 CET 2005


René Fritz wrote:
> 
>>If you add your code in the context of the authentication you can do
>>stuff like this:
>>
>>$uc = $auth->getTSConfigProp('setup.default');
> 
> Good idea. I'll think about it and integrate it in my current solution.

This is the code I wrote for the predecessor of (auth_ldap

Assume we're in an authentication service class and we got the eg LDAP 
data in $this->user:

$uc = null;
if ($this->userExists)  {
   $uc = unserialize($this->user['uc']); // User TS in external "DB"
}

// create default
if (!is_array($uc)){
  $uc = array_merge($this->pObj->uc_default,
                    $TYPO3_CONF_VARS['BE']['defaultUC'],
                    $this->pObj->getTSConfigProp('setup.default'));
}

// hook for extending user TS by other extensions

$params = array('user'=>&$u, 'uc'=>&$uc,
                 'server'=>&$this->LDAPserver, 'type'=>'be');
 
foreach($TYPO3_CONF_VARS['EXTCONF']['myext']['hook'] as $hookMethod) {
   t3lib_div::callUserFunction($hookMethod,$params,$his);
}

// don't let extensions take over
$uc = array_merge($uc, $this->pObj->getTSConfigProp('setup.override'));

$u['uc'] = serialize($uc);

>>This cannot be done in any other code. Syndaction is IMHO currently
>>growing more important. Any chance we see an API for this in 3.8? And is
>>there a chance cc_sv_auth gets into 3.8 (obsoleting the extension)?
> 
> Maybe it will go into 3.8. But another idea is to provide a hook that make it 
> possible to install sv-auth cleanly. So it is a "core option".

Hm, I don't like hooks for special extensions. But perhaps the Core 
could be modifed that less or cleaner XCLASS modifcations are necessary 
for cc_sv_auth (and other auth extensions).

> BTW: The new cc_svauth extension had to change it's API slightly
> !! change $this->info into $this->authInfo in your auth services !!
> Any services on TER will be updated too.

Thanx for the info.

Masi




More information about the TYPO3-dev mailing list