cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply permission on search content

maiconramones
Confirmed Champ
Confirmed Champ

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?

5 REPLIES 5

mbajpai
Confirmed Champ
Confirmed Champ

In the api AuthenticationUtil (Alfresco 5.0.3 Public API) , there is a method runAs . Try it .I guess it should work .

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

afaust
Legendary Innovator
Legendary Innovator

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.

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.

afaust
Legendary Innovator
Legendary Innovator

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.