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

Question

Question

Windows Account do not show under Account.EnumUsers method in RA

asked on December 29, 2014 • Show version history

I am trying to iterate through all users to see if they belong to each group in a repository. I only see Laserfiche trustee account. How can I accomplish this?

 

Here is my code:

 

foreach (AccountInfo user in Account.EnumUsers(sess))
{
	foreach (AccountInfo group in Account.EnumGroups(sess))
	{
		if (user.Groups.Contains(group.Name))
		{
			//yes logic
		}
		else
		{
			//no logic
		}
	}
}

 

0 0

Replies

replied on December 31, 2014

It looks like you should be using the Laserfiche.RepositoryAccess.Linq.LfAccountGroupsRow object, but I find no documentation on how to access, fill, or consume it.

1 0
replied on January 2, 2015

Thanks for pointing that out. I don't see anything regarding its usage either. I'll just wait for Laserfiche to provide some info soon.

0 0
replied on December 29, 2014 • Show version history
foreach (TrusteeInfo winUser in Trustee.EnumAllWindowsAccounts(sess))
{
    foreach (Trustee group in Trustee.EnumGroups(sess))
    {
        if (winUser.Groups.Contains(group.Name))
        {
            //yes logic
        }
        else
        {
            //no logic
        }
    }
}

I was able to pick up the windows accounts this way. This means you will have to have a separate loop for this unless there is another method to do both at once. Although I am still trying to get windows account names I verified that this worked by comparing the last login time using the loop.

0 0
replied on December 30, 2014 • Show version history

Thanks for the reply. How were you able to call Trustee.EnumGroups with just 1 parameter. there is no such overload method. Trustee.EnumGroups takes two arguments. Also, winUser object does not have a Groups function.

 

I am using 9.1. What version of sdk are you on?

0 0
replied on December 30, 2014

Sorry I didn't test out the second loop I assumed that the methods would take in the same arguments. I have tried to test this out though I cannot figure it out myself.

0 0
replied on January 2, 2015 • Show version history

As you found out, Trustee.EnumGroups takes 2 parameters. For the first parameter, you can use the SID from your TrusteeInfo instance to get all the Laserfiche groups that are linked with that Windows Account. Then you can do a comparison between this list of Laserfiche groups and the list of all Laserfiche groups in your repository. Depending on how/when you want to do the comparison, it may look something like:

foreach (TrusteeInfo winUser in Trustee.EnumAllWindowsAccounts(mySess))
{
  foreach (AccountReference GroupReference in Trustee.EnumGroups(winUser.Sid, mySess)) 
  {
    foreach (AccountInfo Group in Account.EnumGroups(mySess))
    {
      if (Group.Name == GroupReference.AccountName)
      {
        // TODO
      }
    }
  }
}

 

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

Sign in to reply to this post.