cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Webscripts for giving permission to custom roles on file/folders on repository side

piyush48
Star Contributor
Star Contributor

Hi All,

I want to create webscript such that when it is executed then only permissions on file/folder are given to Custom roles which are created.

I have gone through basic documentation of Webscript as i hadnt work on it before but didnt got much help on how to proceed furthur with my task. If any one could help out how should i move on creating this type of webscipt which on execution gives permission to custom roles on files/folders.

Thanks,

Piyush.

2 REPLIES 2

abhinavmishra14
World-Class Innovator
World-Class Innovator

If i understood correctly, there is no way you can apply the permission on the webscripts invocation. You can however authenticate the webscript via "user" authentication and write your custom logic to check permissions within the webscript.

See here for more details on webscript authentication: https://docs.alfresco.com/6.1/concepts/ws-authenticating.html

Have a look at this post where you can see a download webscript which checks for permissions (look for isNotAuthorised method call): https://hub.alfresco.com/t5/alfresco-content-services-blog/downloading-content-from-alfresco-reposit...

http://javaworld-abhinav.blogspot.com/2017/08/downloading-content-from-alfresco.html

You can take a reference and write your webscript to check permissions and perform required operation.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

malekgn
Confirmed Champ
Confirmed Champ

Hello,

You have to create a basic web script first to be sure that it works fine and place under alfresco.
You can follow the official documentation

If the basic web script works fine, then u can implement your custom code to set permissions using PermissionService:

  1. It's recommended to disable the inheritance behaviour for permissions on the node specified (the folder or the file).
  2. Set the specific permission on the node specified to the custom roles.
    Note: It's recommended to give permissions to groups, not users.

For more help how to set permissions have a look on this and this.

Best regards.