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

Question

Question

Individual user security

SDK
asked on March 15, 2024

I'm currently working on something similar to what is in the Web Client where you're able to export a list of user security. Due to timeout limitations with the Web Client that we currently have in place I'm trying to do this using the Laserfiche SDK. I currently have a short script that does a search and pulls the security for the returned items. This only grabs the groups that are listed explicitly and inherited from parent. How would I go about checking an individual account instead? Would I need to loop to find all the groups associated with the user and then make a condition if the group is listed then write to the list or is there another call that can be made to check a specific user against the folder/document?

 for (int i = 1; i <= num; i++) 
 {
     FolderInfo currentFolder = Folder.GetFolderInfo(Convert.ToInt32(searchResultListing.GetDatumAsString(i, SystemColumn.Id)), session);
     EntrySecurity entrySecurity = currentFolder.GetAccessControl();
     
     

     Console.WriteLine("Folder Path: " + currentFolder.Path);
     foreach (EntryAccessRule rule in entrySecurity.GetAccessRules(includeExplicit, includeImplicit))
     {
         try
         {
             currentLine = currentFolder.Id.ToString() + ",\"" + currentFolder.Path + "\"," + rule.AccountReference.AccountName.ToString() + ",";
             accessRights = rule.EntryRights.ToString();
             if (accessRights == "Browse, Read")
                 File.AppendAllText(fileLocation, currentLine + "X," + Environment.NewLine);
             else
                 File.AppendAllText(fileLocation, currentLine + ",X" + Environment.NewLine);
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
         }
     }
 }

 

0 0

Replies

replied on March 20, 2024

I think you are looking for EntryInfo.GetEffectiveRights. This will look at group membership and figure out how the access rules combine to result in a user's effective rights.

2 0
replied on March 20, 2024

The other functions that you might look into in a reporting context are Entry.BatchGetEffectiveRights (similar to the above, but allows for getting rights for multiple entries and/or multiple users with one function call) and Entry.BatchGetAclDisplayRights (similar to the above, but based only on the ACLs, ignoring privileges and other conditions).

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.