You are viewing limited content. For full access, please sign in.

Question

Question

Unable to grant Group access to a Folder

SDK
asked on August 20, 2018 • Show version history

Hello,

I'm trying to programmatically modify Lf folder's Entry Access by adding a group to the folder with specified access.  The function below executes without exception but I see no change to the specified folder:  the specified group is not mentioned in the list of Access Rights Trustees.

 

 public void AddGroupToFolder(string theFolder, string theGroup)
            {
                EntryInfo folderEntryInfo;
                folderEntryInfo = Entry.GetEntryInfo(theFolder, _session);
                EntrySecurity folderEntrySecurity = folderEntryInfo.GetAccessControl();

                AccountReference groupAccountReference = new AccountReference(theGroup, _session);
                EntryAccessRule groupEntryAccessRule = new EntryAccessRule(groupAccountReference, 
                        EntryRights.Read, EntryAccessScope.All, System.Security.AccessControl.AccessControlType.Allow);

                folderEntrySecurity.ResetAccessRule(groupEntryAccessRule); 

                folderEntryInfo.SetAccessControl(folderEntrySecurity);

                folderEntryInfo.Save();
                
            }

 

0 0

Answer

SELECTED ANSWER
replied on August 21, 2018

Your code works for me.  After I run it, when I look in the "Access Rights" dialog in Web Access I see the specified group is granted read rights on the folder.  AccountReferences are for Laserfiche groups -- is that the correct type (vs. domain, ldap or LFDS)?

0 0
replied on August 21, 2018 • Show version history

Brian, thank you for your time.

You are quite right, the code works, and is working for me today.

The only reasonable explanation I can think of is that I was looking at the wrong repository when testing!

FYI: For anyone else who comes across this thread, I've added a link to a useful, related, post, that has an entire application in C#:

https://answers.laserfiche.com/questions/105773/Folder-Access-Rights--Stored-in-XML-or-DB

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.