cancel
Showing results for 
Search instead for 
Did you mean: 

Removing ACL from document and folder

shivtechno
Champ in-the-making
Champ in-the-making

Hi All,

I am trying to remove access control from document or from folder but action was not done by using remove acl method, kindly see the below source for more detail which i am using to remove acl from file or folder..

            Document doc = ((Document)session.GetObject("workspace://SpacesStore/" + ObjectId));

            List<String> permissions = new List<String>();

            permissions.Add("Consumer");

            string AssignEmpName = UserName;

            DotCMIS.Data.IAce aceIn = session.ObjectFactory.CreateAce(principal, permissions);

            List<IAce> aceListIn = new List<IAce>();

            aceListIn.Add(aceIn);

            doc.RemoveAcl(aceListIn, DotCMIS.Enums.AclPropagation.ObjectOnly);

            doc.ApplyAcl(aceListIn, null, DotCMIS.Enums.AclPropagation.ObjectOnly);

7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator

RemoveAcl method can only remove direct aces,can't remove inherited aces.

Thanks kayne  for replying ,

i have another question on above code i had tried above given to remove but still aces are not removed

so how to remove inherited aces and given permission..

Kindly provide your valuable suggestion

Regards,

Shivkumar Swamy

kaynezhang
World-Class Innovator
World-Class Innovator

Why do you want to remove inherited aces?

you can add some aces to this node to  override ancestor's permissions.

If you really want to remove inherited aces ,you need to

1.You can get acl of this node using GetAcl method

2.iterate all aces in the returned acl and find all  not direct(indirect ) ace

3.iterate this node's parent and remove indirect ace setted on ancestor.

Thank you Kayne !

Actually I am assigning and de-assigning permission from document.  so removing permission i am using remove acl.

but aces not removed from document. and i am not removing inherited aces just removing permission given like contributer.

kaynezhang
World-Class Innovator
World-Class Innovator

It seems it is a bug.

What version of your dotcmis are you  using? and which binding are you using? what version of alfresco are you using?

Hi Kayne,

                  i am using latest version 5.0 of alfresco and accessing through atompub  api.

                  using Dotcmis version frameword 3.5 and higher

                  

                    Dictionary<string, string> parameters = new Dictionary<string, string>();

                    parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;

                    parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://server:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/";

                    parameters[DotCMIS.SessionParameter.User] = UserName;

                    parameters[DotCMIS.SessionParameter.Password] = Password;

                    SessionFactory factory = SessionFactory.NewInstance();

                    ISession session = factory.GetRepositories(parameters)[0].CreateSession();

kaynezhang
World-Class Innovator
World-Class Innovator

I have tested it on alfresco 5.0 and dotcims 0.7 using both following url

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom

like you said ,RemoveAcl cann't remove aces correctly.

I'm also not sure now whether it is a bug of dotcmis or of alfresco.