cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Permissions with API starting from Alfresco Search API

DM8800
Champ in-the-making
Champ in-the-making

Hi,

Situation: 
We have a software supplier that is a Contributor to a site, creating a folder structure and putting files.
The user is software_supplier1

Example of the folder structure

 

 

- Folder 1
 - 1_Extern
 - 2_Intern

- Folder 2
 - 1_Extern

- Folder 3
 - 1_Extern
 - 2_Intern
 - 3_Sensitive

There there is another software supplier that only has ALLOWED access to all 1_Extern folder. That part works already. This is done with a separate user for separating users for different tasks. 
Example user is modifying_user

ButI thought that if I query that the modifier is software_supplier1 I'm getting only the nodeId's that needs to be checked for permissions and be updated. This works on the the first run. Then the folder  modified user is modifying_user.

But when there's a document put in 1_Extern the parent folder is set back to software_supplier1 instead of modifying_user. Thus my query for filtering out the nodeId's for the folders that needs to be updated doesn't work anymore.

{
   "query":{
      "query":"PATH:'//app:company_home/st:sites/cm:sitename/cm:documentLibrary//*' AND TYPE:'cm:folder' AND NOT cm:modifier:'modifying_user'"
   },
   "paging":{
      "maxItems":50
   },
   "include":[
      "permissions",
      "path"
   ]
}

 

Are there any hints/tips to get this working or for a better workflow?

 

Thanks!

Jonathan

 

1 REPLY 1

LeoMattioli
Employee
Employee

My 2 cents: create an Aspect with one property and add it to folder you already worked on.

For example, your aspect is "acme:my-aspect" with property "acme:my-property", you can modify your query with:

 

"query":"PATH:'//app:company_home/st:sites/cm:sitename/cm:documentLibrary//*' AND TYPE:'cm:folder' AND ISUNSET:'acme:my-property'"

 

Or, probably, you can search also for folder without the aspect with:

"query":"PATH:'//app:company_home/st:sites/cm:sitename/cm:documentLibrary//*' AND TYPE:'cm:folder' AND (NOT ASPECT:'acme:my-aspect')"

Hope this helps.

 


Leo Mattioli - Technical Account Manager @Hyland.