コード例 #1
0
  /**
   * @param repositoryId TODO
   * @param key
   * @param userPermissions
   * @return
   */
  private boolean checkCalculatedPermissions(
      String repositoryId, String key, Set<String> userPermissions) {
    Map<String, PermissionMapping> table =
        repositoryInfoMap.get(repositoryId).getAclCapabilities().getPermissionMapping();
    List<String> actionPermissions = table.get(key).getPermissions();

    for (String up : userPermissions) {
      if (actionPermissions.contains(up) || CmisPermission.ALL.equals(up)) {
        // If any one of user permissions is contained, action is allowed.
        return true;
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public void constraintPermissionDefined(
      String repositoryId, org.apache.chemistry.opencmis.commons.data.Acl acl, String objectId) {
    boolean aclIsEmpty =
        (acl == null) || (acl != null && CollectionUtils.isEmpty(acl.getAces())) ? true : false;
    List<PermissionDefinition> definitions =
        repositoryInfoMap.get(repositoryId).getAclCapabilities().getPermissions();
    List<String> definedIds = new ArrayList<String>();
    for (PermissionDefinition pdf : definitions) {
      definedIds.add(pdf.getId());
    }

    if (!aclIsEmpty) {
      for (org.apache.chemistry.opencmis.commons.data.Ace ace : acl.getAces()) {
        List<String> permissions = ace.getPermissions();
        for (String p : permissions) {
          if (!definedIds.contains(p)) {
            constraint(objectId, "A provided ACE includes an unsupported permission");
          }
        }
      }
    }
  }
コード例 #3
0
 @Override
 public void objectNotFoundParentFolder(String repositoryId, String id, Content content) {
   if (!repositoryInfoMap.get(repositoryId).getCapabilities().isMultifilingSupported())
     objectNotFound(DomainType.OBJECT, content, id, "The specified parent folder is not found");
 }
コード例 #4
0
 @Override
 public void invalidArgumentOrderBy(String repositoryId, String orderBy) {
   if (repositoryInfoMap.get(repositoryId).getCapabilities().getOrderByCapability()
           == CapabilityOrderBy.NONE
       && orderBy != null) invalidArgument("OrderBy capability is not supported");
 }
コード例 #5
0
 @Override
 public void invalidArgumentRequiredParentFolderId(String repositoryId, String folderId) {
   if (!repositoryInfoMap.get(repositoryId).getCapabilities().isMultifilingSupported())
     invalidArgumentRequiredString("folderId", folderId);
 }
コード例 #6
0
 public void constraintDeleteRootFolder(String repositoryId, String objectId) {
   String rootFolderId = repositoryInfoMap.get(repositoryId).getRootFolderId();
   if (rootFolderId.equals(objectId)) {
     constraint(objectId, "Cannot delete root folder");
   }
 }