xml - add alfresco ui action visible only by administrator -
I am trying to add a UI action to Alfreso and it works with this code:
& lt; Action ID = "CreateDoc" & gt; & Lt; Permissions & gt; & Lt ;! - Each permission can be allowed or denied - & gt; & Lt; Permission permission = "true" & gt; Type & lt; / Permission & gt; & Lt; / Permissions & gt; & Lt; Label ID & gt; CreateDoc & lt; / Labels ID & gt; & Lt; Image & gt; /someco/images/icons/stoplight-disable.png< / Image & gt; & Lt; Action Listener & gt; # {WebSettingsBean.createDoc} & lt; / Action listener & gt; & Lt; / Action & gt; & Lt; Action-group id = "document_browse" & gt; & Lt; Action idref = "CreateDoc" /> & Lt; / Action group & gt; & Lt; Action-group id = "document_browse_menu" & gt; & Lt; Action idref = "CreateDoc" /> & Lt; / Action group & gt; & Lt; Action-group id = "doc_details_actions" & gt; & Lt; Action idref = "CreateDoc" /> & Lt; / Action group & gt;
The problem now is that I want the UI action to be seen by all users who have "write" permission, I want to see it only by the administrator . Is this possible? How do I change the permission section?
You can set a permission or role in the permission permission file in the file permissions Definitions.xml The file is included in Alfresco. There is a role called coordinator which has many permissions similar to that of the administrator. There is also a role called Administrator, but it seems that he is not deprecated.
In addition to this, you can use the tag evaluator and can enhance your own evaluator org.alfresco.web.action.evaluator.BaseActionEvaluator. In this way, you can make many evaluations, for example, check whether the user is in the admin user group or not.
You can use web-client-config-action. You can see some examples of usage in XML, including a complete example of action defragment
& lt;! - Full example - & gt; & Lt; Action ID = "Example 1_edit_doc_http" & gt; & Lt ;! - A list of permissions to evaluate the action before examining other prerequisites - & gt; & Lt; Permissions & gt; & Lt ;! - Each permission can be allowed or denied - & gt; & Lt; Permission permission = "true" & gt; Type & lt; / Permission & gt; & Lt; Permission permission = "false" & gt; Extra child & lt; / Permission & gt; & Lt; / Permissions & gt; & Lt ;! - The evaluator is a class that implements the org.alfresco.web.action.ActionEvaluator contract, passing it in the context for the external verb component will be executed - & gt; & Lt; Evaluator & gt; Org.alfresco.web.action.evaluator.EditDocHttpEvaluator & lt; / Evaluator & gt; & Lt ;! - Label and tooltip text or better I18N message ID - & gt; & Lt; Label & gt; Edit & lt; / Labels & gt; & Lt; Label ID & gt; Edit & lt; / Labels ID & gt; & Lt; Tooltip & gt; My tooltip & lt; / Tooltip & gt; & Lt; Tooltip-id & gt; Tooltip & lt; / Tooltip-id & gt; & Lt ;! - Various presentation attributes - Generally it is better to provide them as part of the 'verb' definition of parents so that a group of verbs can be found in a consistent way - & gt; & Lt; Show-link & gt; False & lt; / Show-link & gt; & Lt; Style & gt; Padding: 4px & lt; / Style & gt; & Lt; Style level & gt; InlineAction & lt; / Style level & gt; & Lt; Image & gt; /images/icons/edit_icon.gif< / Image & gt; & Lt ;! - Action, action-listener, onclick, href, and target action features are supported - & gt; & Lt; Action Listener & gt; # {CheckinCheckoutDialog.editFile} & lt; / Action listener & gt; & Lt; Action & gt; EditDocument & lt; / Action & gt; & Lt; Href & gt; Http: //...< / Href & gt; & Lt; Goal & gt; New & lt; / Target & gt; & Lt; Onclick & gt; Javascript: myhandler & lt; / Onclick & gt; & Lt ;! - To specify a JavaScript file to execute the script attribute - by path or node reef - & gt; & Lt; Script & gt; / Company Home / Data Dictionary / Scripts / myjavascript.js & lt; / Script & gt; & Lt ;! - The parameter has & lt; F: param & gt; Tags generated in the form of children of the action component - & gt; & Lt ;! - Passed directly in the form of accessible or href / script URL logic by ActionAvent handler - & gt; & Lt; Parameter & gt; & Lt; Param name = "id" & gt; # {ActionContext.id} & lt; / Param & gt; & Lt; / Parameters & gt; & Lt; / Action & gt;
Comments
Post a Comment