04-13-2017 07:41 PM
Hello,
As contributor and not the owner of a content I want to move the content from folder to another folder inside a site. The manager of the site is the owner of the content.The move action is fired from a rule on a folder created by the manager
What is the best solution for this scenario
Thanks
Jamil
04-15-2017 09:59 AM
Yes, my idea is to create my own java actionExecuter (AdminMove) with a parameter the destination folder and perform the move of the content node with the Admin privilege using AuthenticationUtil.runAsSystem().
This AdminMove will be shown in the list of the rules action and can be called to perform a force move
Is this ok?
Any security issue?
Thanks
Jamil
04-15-2017 09:32 AM
There is no way to achieve this with just Contributor privileges. Moving an item requires delete privileges on the item to move, and a Contributor by definition does not have that. If not the owner you would need to be a Site Administrator to be allowed to move an item. Given the default permission model of Alfresco there also is no way to allow a move without granting delete privileges.
In Java code you could technically perform a piece of an action with elevated privileges via the AuthenticationUtil.runAsSystem() utility. But that is not easily available in scripts triggered by a rule.
04-15-2017 09:59 AM
Yes, my idea is to create my own java actionExecuter (AdminMove) with a parameter the destination folder and perform the move of the content node with the Admin privilege using AuthenticationUtil.runAsSystem().
This AdminMove will be shown in the list of the rules action and can be called to perform a force move
Is this ok?
Any security issue?
Thanks
Jamil
04-17-2017 04:52 PM
As long as you are okay with anyone being able to move any piece of content in your repository to any folder of their choosing, there is no issue.
You might want to add some logic in your action to check the destination so that you exclude targets such as the Data Dictionary, or maybe only allow targets that are Share sites or something like that.
04-17-2017 05:03 PM
Okay great...
One more question please. I created the custom actionExecuter with one parameter the destinationFolder. I can see and select it in the list of rules actions.
My question is how to show the user the select button to choose and auto fill the destinationFolder? Right now I can see an input field which is not practical to fill by hand
Thanks
Jamil
04-17-2017 05:07 PM
Take a look at this tutorial:
http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html
In it, a custom action is implemented that needs a destination node
reference. The tutorial overrides some web scripts and client-side
JavaScript to implement the control.
Explore our Alfresco products with the links below. Use labels to filter content by product module.