Beispiel #1
0
        public virtual async Task UnlinkAsync(IdentityLinkUserInfo sourceLinkUser, IdentityLinkUserInfo targetLinkUser)
        {
            if (!await IsLinkedAsync(sourceLinkUser, targetLinkUser))
            {
                return;
            }

            var linkedUser = await IdentityLinkUserRepository.FindAsync(sourceLinkUser, targetLinkUser);

            if (linkedUser != null)
            {
                await IdentityLinkUserRepository.DeleteAsync(linkedUser);
            }
        }
Beispiel #2
0
    public virtual async Task UnlinkAsync(IdentityLinkUserInfo sourceLinkUser, IdentityLinkUserInfo targetLinkUser, CancellationToken cancellationToken = default)
    {
        using (CurrentTenant.Change(null))
        {
            if (!await IsLinkedAsync(sourceLinkUser, targetLinkUser, cancellationToken: cancellationToken))
            {
                return;
            }

            var linkedUser = await IdentityLinkUserRepository.FindAsync(sourceLinkUser, targetLinkUser, cancellationToken);

            if (linkedUser != null)
            {
                await IdentityLinkUserRepository.DeleteAsync(linkedUser, cancellationToken : cancellationToken);
            }
        }
    }
Beispiel #3
0
        public async Task DeleteAsync()
        {
            var john = await UserRepository.GetAsync(TestData.UserJohnId);

            var david = await UserRepository.GetAsync(TestData.UserDavidId);

            (await IdentityLinkUserRepository.FindAsync(
                 new IdentityLinkUserInfo(john.Id, john.TenantId),
                 new IdentityLinkUserInfo(david.Id, david.TenantId))).ShouldNotBeNull();

            await IdentityLinkUserRepository.DeleteAsync(new IdentityLinkUserInfo(david.Id, david.TenantId));

            (await IdentityLinkUserRepository.FindAsync(
                 new IdentityLinkUserInfo(john.Id, john.TenantId),
                 new IdentityLinkUserInfo(david.Id, david.TenantId))).ShouldBeNull();

            (await IdentityLinkUserRepository.FindAsync(
                 new IdentityLinkUserInfo(david.Id, david.TenantId),
                 new IdentityLinkUserInfo(john.Id, john.TenantId))).ShouldBeNull();
        }