private static bool CurrentUser(string googleId) { var linker = new AccountLinker("webstudio"); var linkedProfiles = linker.GetLinkedObjectsByHashId(HashHelper.MD5(string.Format("{0}/{1}", ProviderConstants.Google, googleId))); linkedProfiles = linkedProfiles.Concat(linker.GetLinkedObjectsByHashId(HashHelper.MD5(string.Format("{0}/{1}", ProviderConstants.OpenId, googleId)))); Guid tmp; return linkedProfiles.Any(profileId => Guid.TryParse(profileId, out tmp) && tmp == SecurityContext.CurrentAccount.ID); }
private static bool CurrentUser(string googleId) { var linker = new AccountLinker("webstudio"); var accounts = linker.GetLinkedObjectsByHashId(HashHelper.MD5(string.Format("{0}/{1}", ProviderConstants.Google, googleId))); accounts = accounts.Concat(linker.GetLinkedObjectsByHashId(HashHelper.MD5(string.Format("{0}/{1}", ProviderConstants.OpenId, googleId)))); return accounts.Select(x => { try { return new Guid(x); } catch { return Guid.Empty; } }) .Any(account => account == SecurityContext.CurrentAccount.ID); }