public static bool TryGetUserByHash(string hashId, out Guid userId) { userId = Guid.Empty; if (string.IsNullOrEmpty(hashId)) return false; var linkedProfiles = new AccountLinker("webstudio").GetLinkedObjectsByHashId(hashId); var tmp = Guid.Empty; if (linkedProfiles.Any(profileId => Guid.TryParse(profileId, out tmp) && CoreContext.UserManager.UserExists(tmp))) userId = tmp; return true; }
private static bool CurrentUser(string boxUserId) { var linkedProfiles = new AccountLinker("webstudio") .GetLinkedObjectsByHashId(HashHelper.MD5(string.Format("{0}/{1}", ProviderConstants.Box, boxUserId))); Guid tmp; return linkedProfiles.Any(profileId => Guid.TryParse(profileId, out tmp) && tmp == SecurityContext.CurrentAccount.ID); }