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

Question

Question

Hosted Repository User Name Different than Locking User Name

asked on October 2, 2020

When working with a repository hosted on laserfiche.com, we have found that there are two different user names being used, and we need to know how to link them together. 

A user can login with their email or username. Regardless of which one, the following code will always return the email address:

RepositoryRegistration rep = new RepositoryRegistration(myServer, myRep);
Session session = new Session();
session.LogIn("user1", "***", rep);
return session.UserName;  // always returns email address (e.g. user1@company.com)

Also regardless of which on, this code will show documents are checked out to the username:

RepositoryRegistration rep = new RepositoryRegistration(myServer, myRep);
Session session = new Session();
session.LogIn("user1", "***", rep);
EntryInfo lfEntry = Entry.GetEntryInfo(entryId, session);
AccountReference acctRef = new AccountReference(lfEntry.PersistentLock.Owner, session);
return acctRef.AccountName;  // Always returns username (e.g. user1) instead of email address

When we access a locked document from different processes, we need to know whether the logged in user has previously locked the document or not.  How can we either get the username of the logged in user, or how can we get the email address for the account that has locked a document? The former would probably be more useful, thanks.

0 0

Answer

SELECTED ANSWER
replied on November 16, 2020

The account name is mostly for display purposes, the most reliable way to compare accounts is by the SID. E.g. compare session.UserIdentity.ToString() and lfEntry.PersistentLock.Owner.ToString().

2 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.