【发布时间】:2016-04-01 22:23:48
【问题描述】:
我正在尝试找到一种方法来获取 Lotus Notes 文档的完整用户列表。 我无法获取用户并在 openCMIS 中显示他们的权限。
有谁知道如何获取每个用户对特定文档的完整 ACL?
public class AclServiceUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(AclServiceUtils.class);
public static Acl getAcl(Session session, String objectId, Boolean onlyBasicPermissions) throws IOException {
ObjectIdentity objId = ObjectIdentity.getObjectIdentity(objectId);
try {
AccessControlListImpl acl = new AccessControlListImpl();
List<Ace> aces = new ArrayList<Ace>();
PrincipalImpl principal=new PrincipalImpl();
principal.setId(objId.getType() + " ");
// here we want info of user
AccessControlEntryImpl ace = new AccessControlEntryImpl();
ace.setDirect(true);
ace.setPrincipal(principal);
aces.add(ace);
acl.setAces(aces);
return acl;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
public class ObjectIdentity {
@JsonIgnore
private static final ObjectMapper mapper = new ObjectMapper();
@JsonIgnore
private static final String UTF_8 = "UTF-8";
private ObjectIdentityType type;
private String unid;
private String id;
private String parentFolderPath;
public ObjectIdentityType getType() {
return type;
}
public void setType(ObjectIdentityType type) {
this.type = type;
}
public String getUnid() {
return unid;
}
public void setUnid(String unid) {
this.unid = unid;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentFolderPath() {
return parentFolderPath;
}
public void setParentFolderPath(String parentId) {
this.parentFolderPath = parentId;
}
@JsonIgnore
public String getEncodedObjectId() throws IOException {
String json = mapper.writeValueAsString(this);
byte[] encodeBase64 = Base64.encode(json);
String result = new String(encodeBase64);
result = URLEncoder.encode(result, UTF_8);
return result;
}
@JsonIgnore
public static ObjectIdentity getObjectIdentity(String encodedString)
throws IOException {
String decodedString = URLDecoder.decode(encodedString, UTF_8);
byte[] decodeBase64 = Base64.decode(decodedString);
String result = new String(decodeBase64);
return mapper.readValue(result, ObjectIdentity.class);
}
public static void main(String args[]) throws IOException{
ObjectIdentity identity = new ObjectIdentity();
identity.setId("<1__=EABBF5CEDFB501988f9e8a93df93869091@local>");
identity.setUnid("DEF");
identity.setType(ObjectIdentityType.ATTACHMENT);
ObjectIdentity decoded = ObjectIdentity.getObjectIdentity(identity.getEncodedObjectId());
/*System.out.println(decoded.id);
System.out.println(decoded.unid);
System.out.println(decoded.type);*/
System.out.println(decoded.id.equals(identity.id));
}
}
【问题讨论】:
-
您希望从 IBM Notes Domino 中检索什么样的用户信息?
-
关于访问权限
-
Notes 文档可以有读者和作者字段。它们可以包含用户名、组名和角色。数据库的 ACL 列出了所有用户和用户组及其特定的权限和角色。那么,您究竟需要什么?所有可以阅读或更新某个文档的用户?
-
Domino 的设计目的不是让回答“谁是有权阅读或更新此文档的所有用户”这个问题变得容易?甚至很难回答“现在有哪些用户有权在此服务器上阅读或更新此文档?”这个问题?要回答这个问题,您必须从有权访问服务器的所有用户的列表开始,将其缩小到有权访问数据库的所有用户,然后将该组划分为以下组:那些访问权限低于 Reader 的用户,那些具有读者、访问权限、具有作者访问权限以及具有编辑权限或以上权限的人员。
-
这需要查阅 ACL 并解析一个或多个引用的 Domino 目录中的任何组。然后,您必须检查文档中的所有项目,以确定它们中是否有任何设置了“SUMMARY READ ACCESS”或“SUMMARY READ/WRITE ACCESS”标志,如果其中有任何一项,您必须阅读名称列表,这可能包括您必须从 ACL 解析的角色,和/或您从一个或多个 Domino 目录解析的组。
标签: java lotus-notes opencmis