Author: fmui
Date: Mon Mar 1 22:15:41 2010
New Revision: 917756
URL: http://svn.apache.org/viewvc?rev=917756&view=rev
Log:
CMIS-142: ACL merge allows empty add and remove ACLs
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java?rev=917756&r1=917755&r2=917756&view=diff
==============================================================================
---
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
(original)
+++
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
Mon Mar 1 22:15:41 2010
@@ -497,22 +497,9 @@
*/
protected AccessControlList mergeAcls(AccessControlList originalAces,
AccessControlList addAces,
AccessControlList removeAces) {
-
- if ((originalAces == null) || (originalAces.getAces() == null)) {
- originalAces = new AccessControlListImpl(new
ArrayList<AccessControlEntry>());
- }
-
- if ((addAces == null) || (addAces.getAces() == null)) {
- throw new IllegalArgumentException("add ACEs must not be null!");
- }
-
- if ((removeAces == null) || (removeAces.getAces() == null)) {
- throw new IllegalArgumentException("remove ACEs must not be null!");
- }
-
- Map<String, Set<String>> originals =
convertACEsToMap(originalAces.getAces());
- Map<String, Set<String>> adds = convertACEsToMap(addAces.getAces());
- Map<String, Set<String>> removes = convertACEsToMap(removeAces.getAces());
+ Map<String, Set<String>> originals = convertAclToMap(originalAces);
+ Map<String, Set<String>> adds = convertAclToMap(addAces);
+ Map<String, Set<String>> removes = convertAclToMap(removeAces);
List<AccessControlEntry> newACEs = new ArrayList<AccessControlEntry>();
// iterate through the original ACEs
@@ -551,10 +538,14 @@
/**
* Converts a list of ACEs into Map for better handling.
*/
- private Map<String, Set<String>> convertACEsToMap(List<AccessControlEntry>
aces) {
+ private Map<String, Set<String>> convertAclToMap(AccessControlList acl) {
Map<String, Set<String>> result = new HashMap<String, Set<String>>();
- for (AccessControlEntry ace : aces) {
+ if ((acl == null) || (acl.getAces() == null)) {
+ return result;
+ }
+
+ for (AccessControlEntry ace : acl.getAces()) {
// don't consider indirect ACEs - we can't change them
if (!ace.isDirect()) {
// ignore