Book Image

Alfresco CMIS

By : Martin Bergljung
Book Image

Alfresco CMIS

By: Martin Bergljung

Overview of this book

Table of Contents (14 chapters)
Alfresco CMIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing permissions for documents and folders


ACLs are used to manage permissions for folders and documents. Each ACL contains one or more Access Control Entries (ACE). Each ACE contains a principal, permission(s), and propagation direction. To add a new permission for an object such as a folder, we use the addAcl method on the object. To be able to use this method, we have to first check if the repository supports managing permissions, as follows:

public void addPermissionToFolder(Session session, Folder folder) {
  // Check if the repo supports ACLs
  RepositoryInfo repoInfo = session.getRepositoryInfo();
  if (!repoInfo.getCapabilities().getAclCapability().equals( 
  CapabilityAcl.MANAGE)) {
    logger.warn("Repository does not allow ACL management" +
    " [repoName=" + repoInfo.getProductName() +
    "][repoVersion=" + repoInfo.getProductVersion() + "]");
  } else {
    // Check that we got the folder, if not don't 
    // assign new permission to it
    if (folder != null) {
     ...