04-24-2017 02:01 PM
Hellow,
I'm searching how to restrict the results of search API basead on some permission.
My business requirements is:
Document A belongs to Entity X
Document B belongs to Entity Y
Document C belongs to Entity X
So I need to apply a restriction on search to show only documents of Entity X.
How I can implement this?
04-24-2017 03:29 PM
In the api AuthenticationUtil (Alfresco 5.0.3 Public API) , there is a method runAs . Try it .I guess it should work .
04-24-2017 03:47 PM
Thanks for the answer Mansha but stil not clear to me.
Because in my case I'm using Rest Api "/search" and running query with cmis language or alfresco full text search... In this case I don't have the UID of alfresco user to try runAs
04-24-2017 04:41 PM
The only way to restrict the visibility of the documents via search is by applying specific read permissions (for different user groups) on these documents and/or their parent folders. You also need to disable permissions inheritance on some ancestor node of your content structure so that the default "everyone can read" permissions is not propagated. "Manage Permissions" is the action you want to look for within Share.
04-24-2017 05:16 PM
Thanks Axel.
How does Alfresco work with this permissions on a query? Is it not necessary to apply "where" restrictions in a cmis query? Because I thought it was necessary to append the restrictions on a query to a group or something like that.
One more time Thanks.
04-24-2017 05:20 PM
Permissions are always handled in the background of queries and do not require any special fragments in the query. Only when you use AuthenticationUtils.runAsSystem() can you circumvent the permission checks.
Explore our Alfresco products with the links below. Use labels to filter content by product module.