我試圖找到一種方法來獲取蓮花筆記文檔的完整用戶列表。 我無法取得用戶並在openCMIS中顯示他們的權限。如何實現AclServiceUtils.getAcl()以檢索用戶信息lotusnotes
有誰知道如何獲取每個用戶對特定文檔的完整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("<[email protected]>");
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列出了所有用戶和用戶組及其特定的權限和角色。那麼,你需要什麼?所有可以閱讀或更新某個文檔的用戶? –