[TYPO3-english] backend user
Xavier Perseguers
xavier.perseguers at typo3.org
Thu Oct 22 08:33:23 CEST 2015
Hi Katja,
> I have a hard and until now unsolved problem on 6.1.9 site (can't update
> at the moment) with frontend users editing their own information.
>
> It seems the info (also some custom fields) doesn't now get saved
> reliably when edited and saved in frontend.
Can't help here.
> Now I'm wondering if there is a way to assign a feuser record to a
> beuser. This backend user would login to backend and could edit only his
> own feuser record. Is this possible? At the moment I can think only a
> system that every feuser would be in his own sysfolder and this
> sysfolder would be editable for the beuser. But easier way?
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
--
Xavier Perseguers
TYPO3 CMS Team
TYPO3 .... inspiring people to share!
Get involved: http://typo3.org
More information about the TYPO3-english
mailing list