Restrict use of execute-script-action to admin only

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2015 05:01 AM
I'm using the replacement for the old alfresco explorer interface which allowed script execution, with the share-extras script found here:
http://share-extras.github.io/addons/execute-script-action/
To limit this use to only administrators, I made a simple change to the execute-script.get.js, wrapping up all the code in a conditional checking for whether the user is an admin:
And that works, but unfortunately doesn't hide the "Execute script" action from showing in the first place.
Anybody know how to hide this as well?
Perhaps in the share-config-custom.xml code, is there a way to also do a config evaluator where condition="isAdmin" or some equivalent? e.g.
http://share-extras.github.io/addons/execute-script-action/
To limit this use to only administrators, I made a simple change to the execute-script.get.js, wrapping up all the code in a conditional checking for whether the user is an admin:
if (user.isAdmin) {…}
And that works, but unfortunately doesn't hide the "Execute script" action from showing in the first place.
Anybody know how to hide this as well?
Perhaps in the share-config-custom.xml code, is there a way to also do a config evaluator where condition="isAdmin" or some equivalent? e.g.
<!– Custom Execute Script Action –> <config evaluator="string-compare" condition="isAdmin"> <!– just guessing! –> <config evaluator="string-compare" condition="DocLibActions"> <actionGroups> <actionGroup id="folder-browse"> <action index="980" id="org_sharextras_execute-script" /> </actionGroup>…etc… </config> </config>
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2015 08:18 AM
Hey xarope, how are you?
Do you speak portuguese? I'm asking that because your nickname is funny in portuguese
So, answering your question, you can use the approach presented on this blog post https://angelborroy.wordpress.com/2015/06/03/alfresco-customizing-actions-and-document-details-by-us...
Basically what you have to do is to create an extension module and include the evaluator:
Try it and let me know if it worked.
Do you speak portuguese? I'm asking that because your nickname is funny in portuguese

So, answering your question, you can use the approach presented on this blog post https://angelborroy.wordpress.com/2015/06/03/alfresco-customizing-actions-and-document-details-by-us...
Basically what you have to do is to create an extension module and include the evaluator:
<module> <id>Hide action for non-admin</id> <auto-deploy>true</auto-deploy> <evaluator type="group.module.evaluator"> <params> <groups>GROUP_ALFRESCO_ADMINISTRATORS</groups> <groupRelation>AND</groupRelation> <negate>false</negate> </params> </evaluator> <configurations> <config evaluator="string-compare" condition="DocLibActions"> <action id="org_sharextras_execute-script"> <evaluator>evaluator.doclib.action.disableAction</evaluator> </action> </config> </configurations></module>
Try it and let me know if it worked.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2015 09:21 PM
Thanks douglascrp, I'll give it a try.
P.S. xarope is my old capoeira nickname, yes it's quite funny!
P.S. xarope is my old capoeira nickname, yes it's quite funny!
