2013-06-08 3 views
2

Typo3 확장 프로그램에서 사용자를 프로그래밍 방식으로 만들거나 삭제할 수 있습니까 (, SQL 제외)?TYPO3 - 프로그래밍 방식으로 사용자 만들기

+0

SQL이 없다면 무엇을 의미합니까? TYPO3 사용자는 데이터베이스에 저장되므로 SQL 명령을 작성하거나 삭제하려면 SQL 명령 끝에 필요합니다. –

+0

나는 TYPO3 함수를 사용하여 사용자를 추가 할 수있을 것이라고 생각 했습니까? (TYPO3 API?) –

+0

나를위한 한 가지 질문은 "왜?"입니다. ... TYPO3가 fe_users 또는 be_users의 DB 구조를 변경한다고 생각하지 않기 때문에 ... 그렇지 않으면 많이 (그리고 실제로는 많이) 확장이 중단됩니다. – SimonSimCity

답변

1

몇 가지 코드 예제 :

function createUser() { 
    // TypoScript Template mit userid anlegen 
    // Neue Seite anlegen 
    $tmpId = 'NEWuser478d8d'; 
    $data['be_users'][$tmpId] = array(
     'username' => $this->email, 
     'password' => $this->password, 
     'admin' => 0, 
     'pid' => 0, 
     'usergroup' => $this->usergroup, 
     'lang' => 'de', 
     'email' => $this->email, 
     'db_mountpoints' => '', 
     'realName' => $this->realName, 
     'file_mountpoints' => '', 
     'fileoper_perms' => (int)$this->conf['fileoper_perms'], 
     'options' => '2', // mount from group: filemount, aber nicht dbmount 
     'db_mountpoints' => $this->dbMountPage, 
     'file_mountpoints' => $this->conf['file_mountpoints'], 
     'workspace_perms' => 0, 
     'workspace_id' => 0, 
     'workspace_preview' => 0 
    ); 
    $this->debug($data, 'beuser'); 
    $this->tce->start($data,array()); 
    $this->tce->process_datamap(); 
    $this->userid = $this->tce->substNEWwithIDs[$tmpId]; 
    // t3lib_div::debug('Neue Userid:'.$this->userid); 
    return true; 
} 

afair 당신은 활성 인 BE-사용자가 필요하므로 하나 만들 :

/** 
* Creates a Be-User 
* 
* @return  void 
*/ 
function setBeUser() { 
    global $BE_USER; 
    unset($BE_USER); 
    $BE_USER  = t3lib_div::makeInstance('t3lib_beUserAuth'); 
    $BE_USER->OS = TYPO3_OS; 
    $BE_USER->setBeUserByUid($this->conf['setBeUserByUid']); 
    $BE_USER->fetchGroupData(); 
    $BE_USER->backendSetUC(); 

    $GLOBALS['BE_USER'] = $BE_USER; 

    $GLOBALS['LANG'] = t3lib_div::makeInstance('language'); 
    $GLOBALS['LANG']->init($BE_USER->uc['lang']); 

    return $BE_USER; 
} 

초기화 TCE :

$this->tce = t3lib_div::makeInstance('t3lib_TCEmain'); 
$this->tce->BE_USER = $this->setBeUser(); 
$this->tce->stripslashes_values = 0; 
$this->createUser(); 
+0

pa-ddy, 여기 백엔드 또는 프런트 엔드 사용자에 대해 이야기하고 있습니까? – SimonSimCity

+0

$ data [ 'be_users']는 "백엔드 사용자"를 의미합니다 $ data [ 'fe_users']는 Frontend 사용자를 의미하지만 필드를 확인합니다. – maholtz

2

CRUD 프론트 엔드로를 사용자 (fe_users)는 이미 자신의 Extbase 확장에서 사용할 수있는 저장소와 모델을 사용할 수 있습니다. 다음은 ...

TYPO3/sysext/extbase/클래스/도메인

당신은 모델 및 저장소 클래스를 찾을 수 있습니다.

관련 문제