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());
}
}
}