예제 #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);
 }