[TYPO3-dev] Changing TCA for certain BE users/groups
Steffen Müller
typo3 at t3node.com
Fri Feb 13 11:10:52 CET 2009
Hi.
I am looking for a way to alter TCA on a BE users/groups base.
The solution I have looks a bit oversized to me, so I'm asking you, if
there's a smarter way which does the trick?
In the example below, there's an extension with a field 'myfield' in
table 'my_ext_tbl'. The field is visible for all BE users, but
readOnly=1 is the default value in tca.php. Only a special group (or
admin) should be allowed to edit this field.
The following code is added to ext_tables.php:
if (!is_object($GLOBALS['BE_USER'])) {
// Create new backend user object
$GLOBALS['BE_USER'] = t3lib_div::makeInstance('t3lib_beUserAuth');
// Initialize backend user object and load group information
$GLOBALS['BE_USER']->start(); // Object is initialized
$GLOBALS['BE_USER']->backendCheckLogin();
}
// is user admin?
if ($GLOBALS['BE_USER']->isAdmin()) {
t3lib_div::loadTCA('tx_pumtravel_tours');
// allow editing of field myfield in table myext_tbl
$TCA['tx_myext_tbl']['columns']['myfield']['config']['readOnly'] = 0;
}
Any suggestions?
--
cheers,
Steffen
http://www.t3node.com/
More information about the TYPO3-dev
mailing list