[TYPO3-english] backend user
Katja Lampela
katja.lampela at lieska.net
Fri Oct 23 12:49:26 CEST 2015
Hi & wow, thanks Xavier!
- Katja
22.10.2015, 9.33, Xavier Perseguers kirjoitti:
> Never tried this extension but since I know it exists, maybe it can help
> a bit: https://typo3.org/extensions/repository/view/simulatebe
>
> Regarding restricting edition arbitrarily in backend, in one of my
> projects I had a similar use case. You could implement 2 hooks:
>
> // Register hook for alt_doc.php to check access to records (edit, create)
> $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'][]
> = 'EXT:' . $_EXTKEY .
> '/Classes/Hooks/EditDocumentController.php:Causal\\Lionsbase\\Hooks\\EditDocumentController->accessCheck';
>
> // Register hook for class.t3lib_userauthgroup.php to possibly disable
> operation icons in Web > List
> $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'][]
> = 'EXT:' . $_EXTKEY .
> '/Classes/Hooks/DataRecordList.php:Causal\\Lionsbase\\Hooks\\DataRecordList';
>
> (remember: noawadays you could just specify the class without its path)
>
> Actual restriction, on edit document:
>
> /**
> * Checks whether a record may be updated.
> *
> * @param array $params
> * @param \TYPO3\CMS\Backend\Controller\EditDocumentController $pObj
> * @return boolean TRUE if access is granted, otherwise FALSE
> */
> public function accessCheck(array $params,
> \TYPO3\CMS\Backend\Controller\EditDocumentController $pObj)
> {
>
> // TODO: your own business logic based on the table,
> $params['uid'], ...
>
> switch ($params['cmd']) {
> case 'edit':
> $hasAccess = true;
> break;
> case 'new':
> $hasAccess = true;
> break;
> }
>
> return $hasAccess;
> }
>
> the other one (db_list_extra) is to let you remove clipboard actions and
> similar from Web > List:
>
>
> /**
> * Modifies Web>List clip icons (copy, cut, paste, etc.) of a
> displayed row
> *
> * @param string $table the current database table
> * @param array $row the current record row
> * @param array $cells the default clip-icons to get modified
> * @param object $pObj Instance of calling object
> * @return array the modified clip-icons
> */
> public function makeClip($table, $row, $cells, &$pObj)
> {
> // TODO: your own business logic:
> $hasAccess = false;
>
> if (!$hasAccess) {
> $cells['copy'] = $pObj->spaceIcon;
> $cells['cut'] = $pObj->spaceIcon;
> }
> return $cells;
> }
>
> /**
> * Modifies Web>List control icons of a displayed row
> *
> * @param string $table the current database table
> * @param array $row the current record row
> * @param array $cells the default control-icons to get modified
> * @param object $pObj Instance of calling object
> * @return array the modified control-icons
> */
> public function makeControl($table, $row, $cells, &$pObj)
> {
> // Same here:
> $hasAccess = false;
>
> if (!$hasAccess) {
> $cells['delete'] = $pObj->spaceIcon;
> }
> return $cells;
> }
>
> HTH
>
--
Kind regards,
Katja Lampela
www.lieska.net
More information about the TYPO3-english
mailing list