示例#1
0
  /** @return map of roles Role -> DocumentPermissionSet instances. */
  public Map<Role, DocumentPermissionSet> getRolesMappedToPermissions() {
    RoleIdToDocumentPermissionSetTypeMappings roleIdToDocumentPermissionSetTypeMappings =
        internalDocument.getRoleIdsMappedToDocumentPermissionSetTypes();

    Map<RoleDomainObject, DocumentPermissionSetDomainObject> result = new HashMap<>();
    RoleIdToDocumentPermissionSetTypeMappings.Mapping[] mappings =
        roleIdToDocumentPermissionSetTypeMappings.getMappings();
    RoleGetter roleGetter = contentManagementSystem.getInternal().getRoleGetter();
    for (RoleIdToDocumentPermissionSetTypeMappings.Mapping mapping : mappings) {
      RoleId roleId = mapping.getRoleId();
      RoleDomainObject role = roleGetter.getRole(roleId);
      DocumentPermissionSetTypeDomainObject documentPermissionSetType =
          mapping.getDocumentPermissionSetType();
      if (DocumentPermissionSetTypeDomainObject.FULL.equals(documentPermissionSetType)) {
        result.put(role, DocumentPermissionSetDomainObject.FULL);
      } else if (DocumentPermissionSetTypeDomainObject.RESTRICTED_1.equals(
          documentPermissionSetType)) {
        result.put(role, internalDocument.getPermissionSets().getRestricted1());
      } else if (DocumentPermissionSetTypeDomainObject.RESTRICTED_2.equals(
          documentPermissionSetType)) {
        result.put(role, internalDocument.getPermissionSets().getRestricted2());
      } else if (DocumentPermissionSetTypeDomainObject.READ.equals(documentPermissionSetType)) {
        result.put(role, DocumentPermissionSetDomainObject.READ);
      } else if (!DocumentPermissionSetTypeDomainObject.NONE.equals(documentPermissionSetType)) {
        log.warn("A missing mapping in DocumentPermissionSetMapper");
      }
    }

    return wrapDomainObjectsInMap(result);
  }
示例#2
0
 public DocumentPermissionSet getPermissionSetRestrictedTwo() {
   DocumentPermissionSetDomainObject restrictedTwo =
       internalDocument.getPermissionSets().getRestricted2();
   return new DocumentPermissionSet(restrictedTwo);
 }
示例#3
0
 public DocumentPermissionSet getPermissionSetRestrictedOne() {
   DocumentPermissionSetDomainObject restrictedOne =
       internalDocument.getPermissionSets().getRestricted1();
   return new DocumentPermissionSet(restrictedOne);
 }