Search in sources :

Example 1 with AccessControlListImpl

use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl in project copper-cms by PogeyanOSS.

the class CmisRequestParameter method createAddAcl.

public Acl createAddAcl(ControlParser controlParser, PostRequest request) {
    List<String> principals = controlParser.getValues(QueryGetRequest.CONTROL_ADD_ACE_PRINCIPAL);
    if (principals == null) {
        return null;
    }
    List<Ace> aces = new ArrayList<Ace>();
    int i = 0;
    for (String principalId : principals) {
        aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser.getValues(QueryGetRequest.CONTROL_ADD_ACE_PERMISSION, i)));
        i++;
    }
    return new AccessControlListImpl(aces);
}
Also used : AccessControlEntryImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl) Ace(org.apache.chemistry.opencmis.commons.data.Ace) ArrayList(java.util.ArrayList) AccessControlListImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl) AccessControlPrincipalDataImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl)

Example 2 with AccessControlListImpl

use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl in project copper-cms by PogeyanOSS.

the class CmisRequestParameter method createRemoveAcl.

public Acl createRemoveAcl(ControlParser controlParser, PostRequest request) {
    List<String> principals = controlParser.getValues(QueryGetRequest.CONTROL_REMOVE_ACE_PRINCIPAL);
    if (principals == null) {
        return null;
    }
    List<Ace> aces = new ArrayList<Ace>();
    int i = 0;
    for (String principalId : principals) {
        aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser.getValues(QueryGetRequest.CONTROL_REMOVE_ACE_PERMISSION, i)));
        i++;
    }
    return new AccessControlListImpl(aces);
}
Also used : AccessControlEntryImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl) Ace(org.apache.chemistry.opencmis.commons.data.Ace) ArrayList(java.util.ArrayList) AccessControlListImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl) AccessControlPrincipalDataImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl)

Example 3 with AccessControlListImpl

use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl in project iaf by ibissource.

the class FilterCmisService method applyAcl.

@Override
public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
    Acl orgAcl = getAclService().getAcl(repositoryId, objectId, Boolean.FALSE, null);
    Acl removeAces = null;
    if (orgAcl != null && orgAcl.getAces() != null && !orgAcl.getAces().isEmpty()) {
        List<Ace> directAces = new ArrayList<Ace>();
        for (Ace ace : orgAcl.getAces()) {
            if (ace.isDirect()) {
                directAces.add(ace);
            }
        }
        if (!directAces.isEmpty()) {
            removeAces = new AccessControlListImpl(directAces);
        }
    }
    return getAclService().applyAcl(repositoryId, objectId, aces, removeAces, aclPropagation, null);
}
Also used : Ace(org.apache.chemistry.opencmis.commons.data.Ace) ArrayList(java.util.ArrayList) AccessControlListImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl) Acl(org.apache.chemistry.opencmis.commons.data.Acl)

Aggregations

ArrayList (java.util.ArrayList)3 Ace (org.apache.chemistry.opencmis.commons.data.Ace)3 AccessControlListImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl)3 AccessControlEntryImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl)2 AccessControlPrincipalDataImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl)2 Acl (org.apache.chemistry.opencmis.commons.data.Acl)1