I can keep users from deleting articles, but I can't find a way to keep them from deleting content in the articles. Is there a way to be this granular with User Settings?
I can keep users from deleting articles, but I can't find a way to keep them from deleting content in the articles. Is there a way to be this granular with User Settings?
I don't know how to make this granular to the point that you are checking user and group permissions -- you'll probably have to reverse engineer something. But a quick and dirty way is to disable it for non-admins.
Code:// You can put this in dcaconfig if( !$this->User->isAdmin ) { // Non-admins can't copy unset( $GLOBALS['TL_DCA']['tl_content']['list']['operations']['copy'] ); // Non-admins can't cut unset( $GLOBALS['TL_DCA']['tl_content']['list']['operations']['cut'] ); // Non-admins can't delete unset( $GLOBALS['TL_DCA']['tl_content']['list']['operations']['delete'] ); // Hides that Info icon for non-admins unset( $GLOBALS['TL_DCA']['tl_content']['list']['operations']['show'] ); // Don't let non-admins create new content elements $GLOBALS['TL_DCA']['tl_content']['config']['closed'] = true; }
Brian
Thanks for that bit o' code.
I'll have to see what the boss wants done for this. We have Writers, Editors, Publishers, and Admins... as far as I know, both Publishers and Admins will have rights to delete content, but others will not. Not sure if she will want to give Publishers admin rights however.
Maybe I can make an alternate backend template for these user groups to utilize and just remove instances of those buttons from the template?
Possibly -- but I'm not sure you could do that through a template, since everything is so dynamic.
A better strategy might be to check out, say, the news module and see how it checks for permissions. You just need to replace my "if" statement with whatever checks are necessary for user groups. It might be surprisingly straightforward.
It's something I have on my list of things to learn, but haven't gotten to it yet.
Brian
...Edit...
Bookmarks