Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Create UnifiedDirectory with ACL

Vote:
 

Hi

Got a problem, i´m trying to create a directory and set specific access rights to that folder. Can´t get it to work properly. I want to add all rights except administer to a specific user and everything I tired returns an error or just a single accessright.
Anyone got any ideas?

This is my latest attemt to accomplish this:

string vPath = "/Documents/Private"; if (!HostingEnvironment.VirtualPathProvider.DirectoryExists(vPath)) { UnifiedDirectory ud = UnifiedDirectory.CreateDirectory(vPath); UnifiedDirectory u = HostingEnvironment.VirtualPathProvider.GetDirectory(vPath) as UnifiedDirectory; u.ACL.IsInherited = false; RawACE raw = new RawACE(); raw.Access = u.ACL.QueryAccess(AccessLevel.Delete & AccessLevel.Create & AccessLevel.Read & AccessLevel.Edit); raw.Name = "PrivateUser"; u.ACL.Add(new AccessControlEntry(raw)); u.ACL.Save(); }
#24170
Sep 26, 2008 8:45
Vote:
 

Hi,

When i need to add rights to a page i do it like this:

AccessControlEntry ent = new AccessControlEntry("PrivateUser", AccessLevel.Delete | AccessLevel.Create | AccessLevel.Read | AccessLevel.Edit);
                u.ACL.Add(ent);
                u.ACL.Save();

 Maybe it will work on your folder as well?

 -Kjetil Simensen

#24179
Sep 26, 2008 9:27
Vote:
 

That did it.

Thank you very much. Saved my day

/Oskar

#24181
Sep 26, 2008 9:52
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.