Added feature #10585: Enable BE-User to change their OpenID
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / class.tx_openid_mod_setup.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Steffen Gebert <steffen@steffen-gebert.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24 /**
25 * [CLASS/FUNCTION INDEX of SCRIPT]
26 */
27
28 /**
29 * This class is the OpenID return script for the TYPO3 Backend.
30 *
31 * $Id$
32 *
33 * @author Steffen Gebert <steffen@steffen-gebert.de>
34 */
35 class tx_openid_mod_setup {
36
37 /**
38 * Checks weather BE user has access to change its OpenID identifier
39 *
40 * @param $config config of the field
41 * @return boolean TRUE if user has access, false if not
42 */
43 public function accessLevelCheck($config) {
44 $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
45 if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled'] == 1) {
46 return FALSE;
47 }
48 return TRUE;
49 }
50
51 /**
52 * Render OpenID identifier field for user setup
53 *
54 * @param $params config of the field
55 * @param $ref $class reference
56 * @return HTML code for input field or only OpenID if change not allowed
57 */
58 public function renderOpenID($params, $ref) {
59 $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
60 return '<input id="field_tx_openid_openid" type="text" name="data[be_users][tx_openid_openid]" value="' . $openid . '" style="width:192px;" />';
61 }
62 }
63
64 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php']) {
65 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php']);
66 }
67 ?>