[FEATURE] Wizard to add OpenID to backend user
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / ext_tables.php
1 <?php
2 // Make sure that we are executed only from the inside of TYPO3
3 if (!defined('TYPO3_MODE')) {
4 die('Access denied.');
5 }
6 // Prepare new columns for be_users table
7 $tempColumns = array(
8 'tx_openid_openid' => array(
9 'exclude' => 0,
10 'label' => 'LLL:EXT:openid/locallang_db.xlf:be_users.tx_openid_openid',
11 'config' => array(
12 'type' => 'input',
13 'size' => '30',
14 // Requirement: unique (BE users are unique in the whole system)
15 'eval' => 'trim,nospace,unique',
16 'wizards' => Array(
17 '_PADDING' => 2,
18 '0' => Array(
19 'type' => 'popup',
20 'title' => 'Add OpenID',
21 'script' => 'mod.php?M=openid_wizard',
22 'icon' => 'EXT:openid/ext_icon.gif',
23 'JSopenParams' => ',width=600,height=400,status=0,menubar=0,scrollbars=0',
24 )
25 ),
26 )
27 )
28 );
29 // Add new columns to be_users table
30 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', $tempColumns, FALSE);
31 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('be_users', 'tx_openid_openid;;;;1-1-1', '', 'after:username');
32 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('be_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xlf');
33 // Prepare new columns for fe_users table
34 $tempColumns['tx_openid_openid']['config']['eval'] = 'trim,nospace,uniqueInPid';
35 // Add new columns to fe_users table
36 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns, FALSE);
37 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToAllPalettesOfField('fe_users', 'username', 'tx_openid_openid');
38 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('fe_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xlf');
39 // Add field to setup module
40 $GLOBALS['TYPO3_USER_SETTINGS']['columns']['tx_openid_openid'] = array(
41 'type' => 'user',
42 'table' => 'be_users',
43 'label' => 'LLL:EXT:openid/locallang_db.xlf:_MOD_user_setup.tx_openid_openid',
44 'csh' => 'tx_openid_openid',
45 'userFunc' => 'TYPO3\\CMS\\Openid\\OpenidModuleSetup->renderOpenID',
46 'access' => 'TYPO3\\CMS\\Openid\\OpenidModuleSetup'
47 );
48 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('tx_openid_openid', 'after:password2');
49 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_user_setup', 'EXT:openid/locallang_csh_mod.xlf');
50
51 if (TYPO3_MODE === 'BE') {
52 // Register wizard
53 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
54 'openid_wizard',
55 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'wizard/'
56 );
57 }