chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1469730 - /chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
Date Fri, 19 Apr 2013 07:54:54 GMT
Author: fmui
Date: Fri Apr 19 07:54:54 2013
New Revision: 1469730

URL: http://svn.apache.org/r1469730
Log:
CMIS-645: fixed ACL handling during object creation

Modified:
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs?rev=1469730&r1=1469729&r2=1469730&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs Fri Apr 19 07:54:54 2013
@@ -635,6 +635,25 @@ namespace DotCMIS.Binding.AtomPub
             return result;
         }
 
+        protected IAcl GetAclInternal(string repositoryId, string objectId, bool? onlyBasicPermissions,
IExtensionsData extension)
+        {
+            // find the link
+            String link = LoadLink(repositoryId, objectId, AtomPubConstants.RelACL, AtomPubConstants.MediatypeACL);
+
+            if (link == null)
+            {
+                ThrowLinkException(repositoryId, objectId, AtomPubConstants.RelACL, AtomPubConstants.MediatypeACL);
+            }
+
+            UrlBuilder url = new UrlBuilder(link);
+            url.AddParameter(AtomPubConstants.ParamOnlyBasicPermissions, onlyBasicPermissions);
+
+            // read and parse
+            HttpUtils.Response resp = Read(url);
+            AtomAcl acl = Parse<AtomAcl>(resp.Stream);
+
+            return Converter.Convert(acl.ACL, null);
+        }
 
         protected AtomAcl UpdateAcl(string repositoryId, string objectId, IAcl acl, AclPropagation?
aclPropagation)
         {
@@ -2130,20 +2149,7 @@ namespace DotCMIS.Binding.AtomPub
                 return;
             }
 
-            IAcl originalAces = null;
-
-            // walk through the entry and find the current ACL
-            foreach (AtomElement element in entry.GetElements())
-            {
-                if (element.Object is cmisObjectType)
-                {
-                    // extract current ACL
-                    cmisObjectType cmisObject = (cmisObjectType)element.Object;
-                    originalAces = Converter.Convert(cmisObject.acl, cmisObject.exactACLSpecified
? (bool?)cmisObject.exactACL : null);
-
-                    break;
-                }
-            }
+            IAcl originalAces = GetAclInternal(repositoryId, entry.Id, false, null);
 
             if (originalAces != null)
             {
@@ -2742,22 +2748,7 @@ namespace DotCMIS.Binding.AtomPub
 
         public IAcl GetAcl(string repositoryId, string objectId, bool? onlyBasicPermissions,
IExtensionsData extension)
         {
-            // find the link
-            String link = LoadLink(repositoryId, objectId, AtomPubConstants.RelACL, AtomPubConstants.MediatypeACL);
-
-            if (link == null)
-            {
-                ThrowLinkException(repositoryId, objectId, AtomPubConstants.RelACL, AtomPubConstants.MediatypeACL);
-            }
-
-            UrlBuilder url = new UrlBuilder(link);
-            url.AddParameter(AtomPubConstants.ParamOnlyBasicPermissions, onlyBasicPermissions);
-
-            // read and parse
-            HttpUtils.Response resp = Read(url);
-            AtomAcl acl = Parse<AtomAcl>(resp.Stream);
-
-            return Converter.Convert(acl.ACL, null);
+            return GetAclInternal(repositoryId, objectId, onlyBasicPermissions, extension);
         }
 
         public IAcl ApplyAcl(string repositoryId, string objectId, IAcl addAces, IAcl removeAces,
AclPropagation? aclPropagation,



Mime
View raw message