如何获取文件的ACL?
我已经在存储库中创建了文档…
并且我在下面设置了Acls Like …
public void setPermissionsToDocument(Session session, List<String> users, String documentPath) { List<String> permissions = new LinkedList<String>();
List<Ace> addAces = new LinkedList<Ace>();
// permissions.add(BasicPermissions.WRITE);
permissions.add(PermissionService.TAKE_OWNERSHIP);
for (String user : users) {
Ace addAce = session.getObjectFactory().createAce(user, permissions);
addAces.add(addAce);
}
Document document = (Document) session.getObjectByPath(documentPath);
// CmisObjectNotFoundException(String message)
// document.addAcl(addAces, AclPropagation.REPOSITORYDETERMINED);
document.setAcl(addAces);
System.out.println("permissions are setted");
}
现在,我没有得到如下所示的特殊文档的Acls。并返回null。
Document document = dmsService.getDocument(session, "/Manohar/Manohar1/Manohar2/app-logo-48.png"); document.getAcl();
任何人请帮助我…
回答:
尝试这个 :
System.out.println("getting ACL capabilities"); AclCapabilities aclCapabilities = session.getRepositoryInfo().getAclCapabilities();
System.out.println("Propogation for this repository is " + aclCapabilities.getAclPropagation().toString());
System.out.println("permissions for this repository are: ");
for (PermissionDefinition definition : aclCapabilities.getPermissions()) {
System.out.println(definition.toString());
}
System.out.println("\npermission mappings for this repository are: ");
Map<String, PermissionMapping> repoMapping = aclCapabilities.getPermissionMapping();
for (String key: repoMapping.keySet()) {
System.out.println(key + " maps to " + repoMapping.get(key).getPermissions());
}
以上是 如何获取文件的ACL? 的全部内容, 来源链接: utcz.com/qa/398978.html