You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Denis Andreev <an...@elilink.com> on 2013/04/16 12:55:14 UTC

DotCMIS library - ACL issue

Hi Everyone

There is an issue with ACL applying when a document is being created. 

The code below does not work:

IDocument cmisDoc = folder.CreateDocument(properties, contentStream, null,
null, cmisAces, null, new OperationContext() { IncludeAcls = true });

 

cmisDoc.Acl does not contain provided ACEs.

 

But after that :

cmisDoc.ApplyAcl(cmisAces, null, AclPropagation.RepositoryDetermined);

 

It does.

 

I looked into the code and found out that the method
DotCMIS.Binding.AtomPub.ObjectService.HandleAclModifications() seems to be
working wrong.

The condition "if (originalAces != null)" is always false. If I comment it
then it works.

 

        private void HandleAclModifications(String repositoryId, AtomEntry
entry, IAcl addAces, IAcl removeAces)

        {

           if (!IsAclMergeRequired(addAces, removeAces))

            {

                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;

                }

            }

 

            if (originalAces != null)

            {

                // merge and update ACL

                IAcl newACL = MergeAcls(originalAces, addAces, removeAces);

                if (newACL != null)

                {

                    UpdateAcl(repositoryId, entry.Id, newACL, null);

                }

            }

        }

 

Would you please have a look and fix it.

 

 

Best regards,

Denis Andreev

 


RE: DotCMIS library - ACL issue

Posted by Denis Andreev <an...@elilink.com>.
Hi Florian

I've created the ticket:
https://issues.apache.org/jira/browse/CMIS-645

Best regards,
Denis Andreev

-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org] 
Sent: Tuesday, April 16, 2013 2:09 PM
To: andreev@elilink.com
Cc: dev@chemistry.apache.org
Subject: Re: DotCMIS library - ACL issue

 Hi Denis,

 Please open an issue here:
 https://issues.apache.org/jira/browse/CMIS


 Thanks,

 Florian


> Hi Everyone
>
> There is an issue with ACL applying when a document is being created.
>
> The code below does not work:
>
> IDocument cmisDoc = folder.CreateDocument(properties, contentStream, 
> null,
> null, cmisAces, null, new OperationContext() { IncludeAcls = true });
>
>
>
> cmisDoc.Acl does not contain provided ACEs.
>
>
>
> But after that :
>
> cmisDoc.ApplyAcl(cmisAces, null, 
> AclPropagation.RepositoryDetermined);
>
>
>
> It does.
>
>
>
> I looked into the code and found out that the method
> DotCMIS.Binding.AtomPub.ObjectService.HandleAclModifications() seems 
> to be
> working wrong.
>
> The condition "if (originalAces != null)" is always false. If I 
> comment it
> then it works.
>
>
>
>         private void HandleAclModifications(String repositoryId, 
> AtomEntry
> entry, IAcl addAces, IAcl removeAces)
>
>         {
>
>            if (!IsAclMergeRequired(addAces, removeAces))
>
>             {
>
>                 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;
>
>                 }
>
>             }
>
>
>
>             if (originalAces != null)
>
>             {
>
>                 // merge and update ACL
>
>                 IAcl newACL = MergeAcls(originalAces, addAces, 
> removeAces);
>
>                 if (newACL != null)
>
>                 {
>
>                     UpdateAcl(repositoryId, entry.Id, newACL, null);
>
>                 }
>
>             }
>
>         }
>
>
>
> Would you please have a look and fix it.
>
>
>
>
>
> Best regards,
>
> Denis Andreev


Re: DotCMIS library - ACL issue

Posted by Florian Müller <fm...@apache.org>.
 Hi Denis,

 Please open an issue here:
 https://issues.apache.org/jira/browse/CMIS


 Thanks,

 Florian


> Hi Everyone
>
> There is an issue with ACL applying when a document is being created.
>
> The code below does not work:
>
> IDocument cmisDoc = folder.CreateDocument(properties, contentStream, 
> null,
> null, cmisAces, null, new OperationContext() { IncludeAcls = true });
>
>
>
> cmisDoc.Acl does not contain provided ACEs.
>
>
>
> But after that :
>
> cmisDoc.ApplyAcl(cmisAces, null, 
> AclPropagation.RepositoryDetermined);
>
>
>
> It does.
>
>
>
> I looked into the code and found out that the method
> DotCMIS.Binding.AtomPub.ObjectService.HandleAclModifications() seems 
> to be
> working wrong.
>
> The condition "if (originalAces != null)" is always false. If I 
> comment it
> then it works.
>
>
>
>         private void HandleAclModifications(String repositoryId, 
> AtomEntry
> entry, IAcl addAces, IAcl removeAces)
>
>         {
>
>            if (!IsAclMergeRequired(addAces, removeAces))
>
>             {
>
>                 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;
>
>                 }
>
>             }
>
>
>
>             if (originalAces != null)
>
>             {
>
>                 // merge and update ACL
>
>                 IAcl newACL = MergeAcls(originalAces, addAces, 
> removeAces);
>
>                 if (newACL != null)
>
>                 {
>
>                     UpdateAcl(repositoryId, entry.Id, newACL, null);
>
>                 }
>
>             }
>
>         }
>
>
>
> Would you please have a look and fix it.
>
>
>
>
>
> Best regards,
>
> Denis Andreev