use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl 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);
}
use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl 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);
}
use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl in project SearchServices by Alfresco.
the class CMISDataCreatorTest method testCreateLots.
public void testCreateLots() throws Exception {
Session session = getSession("admin", "admin");
Folder root = session.getRootFolder();
String folderNameBase = getRootFolderName();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, folderNameBase);
Folder base = root.createFolder(properties);
for (int i = 0; i < 10; i++) {
AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("" + i + i + i);
List<String> permissions = new ArrayList<String>(1);
permissions.add(BasicPermissions.ALL);
List<Ace> addAces = new ArrayList<Ace>(1);
addAces.add(new AccessControlEntryImpl(principal, permissions));
base.addAcl(addAces, AclPropagation.PROPAGATE);
}
Thread last = null;
for (int i = 0; i < 10; i++) {
Creator creator = new Creator(base.getPath(), i);
Thread thread = new Thread(creator);
thread.start();
last = thread;
}
if (last != null) {
last.join();
}
ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
assertTrue(result.getTotalNumItems() > 0);
// result = session.query("select * from cmis:folder where cmis:name = '"+folderName+"'", false);
// assertTrue(result.getTotalNumItems() > 0);
}
use of org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl in project SearchServices by Alfresco.
the class CMISDataCreatorTest method testCreate.
public void testCreate() {
Session session = getSession("admin", "admin");
String folderName = getRootFolderName();
Folder root = session.getRootFolder();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
properties.put(PropertyIds.NAME, folderName);
// create the folder
Folder newFolder = root.createFolder(properties);
for (int i = 0; i < 50; i++) {
AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl("user" + i);
List<String> permissions = new ArrayList<String>(1);
permissions.add(BasicPermissions.READ);
List<Ace> addAces = new ArrayList<Ace>(1);
addAces.add(new AccessControlEntryImpl(principal, permissions));
newFolder.addAcl(addAces, AclPropagation.PROPAGATE);
Map<String, Object> updateProperties = new HashMap<String, Object>();
updateProperties.put("cm:title", "Update title " + i);
newFolder.updateProperties(properties);
if (i % 10 == 0) {
System.out.println("@ " + i);
}
}
ItemIterable<QueryResult> result = session.query("select * from cmis:folder", false);
assertTrue(result.getTotalNumItems() > 0);
result = session.query("select * from cmis:folder where cmis:name = '" + folderName + "'", false);
assertTrue(result.getTotalNumItems() > 0);
}
Aggregations