cancel
Showing results for 
Search instead for 
Did you mean: 

Help: Inherit Parent Space Permissions

robobot
Champ in-the-making
Champ in-the-making
Hello there,
is it possible to set this property via the Repository Service. Each Folder which is created with the following Standardcode, has this property set by default. But for every Folder i create, this should be not checked.

 
  public String createFolder(String folderPath, final String folderId,final String folderName) {  
  
   final ParentReference parentReference = new ParentReference(STORE,null,folderPath,Constants.ASSOC_CONTAINS,getChildName(folderName));
   final String newId = (null == folderId) ? "-1" : folderId;
   CMLCreate create = new CMLCreate(newId, parentReference, null, null, null, Constants.TYPE_FOLDER, createDefaultProperties(folderName));
   //create content manipulation language
   CML cml = new CML();
   //set content to create
   cml.setCreate(new CMLCreate[]{create});      
   UpdateResult[] result;
   try {
     result = WebServiceFactory.getRepositoryService().update(cml);
     folderPath = result[0].getDestination().getPath();
   } catch (RepositoryFault e) {
     e.printStackTrace();
   } catch (RemoteException e) {
     e.printStackTrace();
   } 
 
   return folderPath;
}

[img]http://www2.pic-upload.de/14.12.09/kzwfevnsx2wx.jpg[/img]

Thanks very much vor any advice!
Steve
5 REPLIES 5

dhalupa
Champ on-the-rise
Champ on-the-rise
Not sure what you mean by Repository service. This property can be set using permission service, presuming that serviceRegistry is a reference to ServiceRegistry

serviceRegistry.getPermissionService().setInheritParentPermissions(folderRef, inheritPermissions);

Denis

robobot
Champ in-the-making
Champ in-the-making
Thank you!
With RepositoryService I generally  mean the classes found in the package
org.alfresco.webservice.*

But how can i use the ServiceRegistry ? It does not seem to be available in the alfresco-webservice-client.jar ?

dhalupa
Champ on-the-rise
Champ on-the-rise
Not sure, I have never used web services interface myself. Having a quick look at web-service-client it does not seem that PermissionService is exposed for invocation.
You might want to try web scripts interface instead of  web service which has far more richer api and IMHO is more actively supported by alfresco itself.

Kind regards,

Denis

openpj
Elite Collaborator
Elite Collaborator
You can use the AccessControlService exposed by the Web Services API.
To set inheritPermission you can use the following code:

Reference nodeReference = new Reference(SPACES_STORE, nodeUuid, null);
Predicate nodes = new Predicate(new Reference[]{reference});
WebServiceFactory.getAccessControlService().setInheritPermission(predicate, true);
Hope this helps.

robobot
Champ in-the-making
Champ in-the-making
thank you. that was exactlly what i had  been searching for.