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

Question

Question

How to Disable/Enable user using SDK ?

SDK
asked on October 29, 2023

Hello folks ,

I am getting user information on my application, so I want to get the user status (Disabled or Enabled) and also can disable or enable it from my code via SDK?

  session.LogIn(repository);

                var lstGroups = new List<string>();
                AccountInfo oAccountInfo = Account.GetInfo("Test", session);              
                 var des = oAccountInfo.Description;              
                var userType = oAccountInfo.TrusteeType;

thanks all.

0 0

Answer

SELECTED ANSWER
replied on October 30, 2023

If you are using Laserfiche users (not domain accounts or LFDS accounts), the UserInfo class is used to enable/disable a user:

if (oAccountInfo.TrusteeType == TrusteeType.LaserficheUser)
{
    UserInfo userInfo = (UserInfo)oAccountInfo;

    if (userInfo.IsDisabled)
        Console.WriteLine($"User {userInfo.Name} is disabled.");
    else
    {
        Console.WriteLine($"User {userInfo.Name} was enabled, disabling now.");
        userInfo.IsDisabled = true;
        userInfo.Save();
    }
}

 

2 0
replied on October 30, 2023

The idea behind why you can only disable repository users is that the status of an account is something that should be managed by the Identity Provider. Repository accounts are the ones where the Laserfiche server is the identity provider, otherwise the change needs to be made in e.g. LFDS.

1 0
replied on November 1, 2023

I just want to control repository users from my application in an easy and fast way instead of lunch administration console or LFDS.

0 0
replied on November 1, 2023

Thank you 

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.