[TYPO3-dev] Changing TCA for certain BE users/groups

Peter Russ "peter,russ" at 4many.net
Fri Feb 13 11:22:38 CET 2009


--- Original Nachricht ---
Absender:   Steffen Müller
Datum:       13.02.2009 11:10:
> 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?
> 

The beginning of some kind of ACL ;-)

Q: why do you initialize BE_BE_USER? Shouldn't it be available at that 
point in BE?

Then I would define the group(s) allowed to edit the record either in 
page config or user config and do the check and do the TCA as mentioned.

Peter.

-- 
Fiat lux!
Docendo discimus.
http://www.gidf.de

_____________________________
4Many� Services
uon GbR

XING:	http://www.xing.com/profile/Peter_Russ
	https://www.xing.com/go/invita/360052
	http://www.xing.com/go/privatemessage/Peter_Russ




More information about the TYPO3-dev mailing list