Is there a way I can change the Form fields and options depending on the current user?
Like for instance, if the current user is just a Simple_User he/she should not be shown the option "evaluate". But for an Admin, the evaluate option should be available.
How can I achieve this using TCA for creating backend forms for a plugin ?
In the TCA there is the option "exclude", which gives you the option to set the permission for BackendUser or BackendGroup if the user is allowed to view/edit the field.
Related
I would like to restrict access to a dialog's field (input field) to a given role.
Only specific role can enter the value in the the input field others can read only the field.
I looked into the Dialog Definition documentation of Magnolia CMS and found nothing on this topic.
Need code like
id:
label: Model ID
$type: textField
roles:
- superuser
# could also be written as
# roles: [superuser]
Might be duplicate of Magnolia CMS: permission to edit dialog
Anyhow, you can restrict either Path that user can access or you can restrict actions that user can invoke.
In former case, user will still be able to open the dialog and see the values in it in read only mode.
In latter user will not be able to open dialog or if you also apply same availability rules on the commit action in the dialog itself, user would not be able to save the dialog even if you failed to restrict all the actions that lead to opening the dialog.
But all in all it is important to remember that there are multiple ways to access the content hence if you want to restrict someone from either modifying or seeing certain content, you should restrict content by type/path not just hide the dialog.
For my Trac plugin, I would like to add a color (as string or rgb values) to each user for use from somewhere else in the plugin. The color should be configurable via the admin page.
Is it possible to add another column to the table in the Users settings of the AccountManagerPlugin panel, and if it is, how do I add the information to the database so I can access it from elsewhere?
Another option would be to make a new Admin Panel for my plugin, which is what I am currently doing, with a table with just the user names and their colors. But in this case, although I already have the empty admin panel, I don't know how to add the table and add new items to the database.
To explain what I need the colors for:
My plugin adds a new export option for tickets, and formats them with my own html and css structure. The tickets contain the owner's name, and this name should be displayed with their respective colors. The code for this already exists, now I just need to retrieve the colors from the database, and beforehand save them to the database via the admin panel.
The colors should be changable only via the admin page.
There's no Users admin panel in Trac, however the AccountManagerPlugin has a User management panel. Let me know if you are using the AccountManagerPlugin and I'll provide more info on that.
Keeping the discussion within the scope of Trac, you could implement the ability for the user to make a selection through a preference panel by implementing IPreferencePanelProvider. You could save the value in the session_attribute table and make use of it anywhere else. For an attribute named user_color, the value can be retrieved using req.session.get('user_color').
Examples can be found in trac.prefs.web_ui. I've linked to the code in Trac 1.1.6 because the module was refactored so that the preferences were more modular #9162.
I want to "hide/deactivate" the table element for specific users/usergroups in the typo3 BE.
Or to be more clear: I want to ONLY allow it to ONE specific user (admin).
How can i do that?
NOTE: At the moment the table element is deactivated in the global TS-config via tt_content removeItems().
TIA
Note: I have only an old Typo3 4.3.5 installation, but I hope this hasn't changed much.
In User admin, edit group permissions and go to Access lists. At the bottom is "Explicitly allow/deny field values" where you can restrict specific content types.
With the restriction, affected users still see the restricted content element in BE, but get a message when trying to edit it.
TCA offers the possibility for conditional displaying fields using displayCond. for an instance HIDE_FOR_NON_ADMINS allows to display field only for admin, but is there a way to display given field only for its creator, determined by cruser_id field?
Not out of the box. You can hook into TCEMAIN (DataHandler) or TCEFORM (FormEngine) to archive this.
You can however use access rights and set the rights to show the page (storage folder) only the the given backend user. Check out the access module.
How do I hide the content resource field from non-admin users?
So you'd like a user to be able to change document fields such as title, alias etc but not the content?
You can not lock individual fields to admin user (as far as I know). You can either lock the whole page/resource or you could put the content that you want to be locked into the template for that document and lock the template to only the admin user which would achieve the same effect.
Make sure you don't have a reference to [+content+] in the template and even if the user enters document content it won't impact the page.
New answer instead of editing the above as this is a much cleaner solution.
Create different user groups eg. Admin & Editor
Make sure admin is in the admin user group
Create a template variable for your content and in the Access Permissions section only tick the admin group.
Assign the TV to your template.
Now if the user isn't in the admin user group the TV won't even be visible when they are editing the resource.
Hey, thanks for the answer.
I thought I'd post what I ended up doing.
With MODx Evo 1+, you have managermanager included. After removing the included file(which is used rather than the default chunk) using the rules in there I can rename hide and sync content.