cancel
Showing results for 
Search instead for 
Did you mean: 

How to Grant/Revoke roles using Rules

senthil_chinnai
Champ in-the-making
Champ in-the-making
Hi All:

My requirements are:

1. We will have spaces like this:

Banking->Drafts
Consulting->Drafts


All users will upload documents under Drafts folder and it will go through advanced workflow and then will be published by admin group.

2. All published contents will be moved to one level above. i.e from Drafts to Banking in the above example. Published folder (Banking) will have consumer access.

3. When the document is uploaded to Drafts folder, others should not see it. But any body should be able upload any document in Drafts folder.

So basically we need some kind of Restricted Contributor Role for Drafts, which will have Add children+Restricted Consumer, meaning users should see only their own documents.

Is it possible to achieve through Permission configuration?

Another option in my mind is to create a custom action and create a rule for Drafts folder to fire the action upon newly created/added documents. In this approach, I know how to create custom actions but I don't know how to Revoke/Grant Roles. Can any one send me piece of code which should be kept in Action Executer please?

Thanks,
Senthil.
3 REPLIES 3

andy
Champ on-the-rise
Champ on-the-rise
Hi

Create a contributor style role with no read access.
Read will be provided by roles assigned to the owner.

Andy

senthil_chinnai
Champ in-the-making
Champ in-the-making
Andy,

I tried the same the Drafts space itself is not visible to users because it doesn't have Consumer role.

Is it possible to grant/revoke role for a specific node using code? If possible could you guide me how to do that please?

Thanks,
Senthil.

senthil_chinnai
Champ in-the-making
Champ in-the-making
I have done this using a custom action and it works as expected !

      permissionService.deletePermissions(nodeRef);
      permissionService.setInheritParentPermissions(nodeRef, false);

Thanks for your help !

Senthil.