Exemplo n.º 1
0
    public async Task RemoveRoleFromOrganizationUnitAsync()
    {
        var ou = await _organizationUnitRepository.GetAsync("OU1", true);

        var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"));

        await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole.Id, ou.Id);

        await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(adminRole.Id, ou.Id);

        ou = await _organizationUnitRepository.GetAsync("OU1", includeDetails : true);

        ou.Roles.FirstOrDefault(r => r.RoleId == adminRole.Id).ShouldBeNull();
    }
    public async Task RemoveRoleFromOrganizationUnit()
    {
        using (var uow = _unitOfWorkManager.Begin())
        {
            var ou111 = await _organizationUnitRepository.GetAsync(
                _lookupNormalizer.NormalizeName("OU111"));

            ou111.Roles.ShouldContain(q => q.RoleId == _testData.RoleModeratorId);

            await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(_testData.RoleModeratorId, ou111.Id);

            await uow.CompleteAsync();
        }

        var ou111Updated = await _organizationUnitRepository.GetAsync(
            _lookupNormalizer.NormalizeName("OU111"));

        ou111Updated.Roles.ShouldNotContain(q => q.RoleId == _testData.RoleModeratorId);
    }
Exemplo n.º 3
0
 public async Task RemoveRoleFromOrganizationUnitAsync(Guid id, Guid roleId)
 {
     await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(roleId, id);
 }
Exemplo n.º 4
0
 public async Task RemoveRoleFromOrganizationUnitAsync(DeleteOrganizationUnitRolesInput input)
 {
     await OrganizationUnitManager.RemoveRoleFromOrganizationUnitAsync(input.UserId, input.OuId);
 }
        public virtual async Task RemoveOrganizationUnitsAsync(Guid id, Guid ouId)
        {
            await OrganizationUnitManager.RemoveRoleFromOrganizationUnitAsync(id, ouId);

            await CurrentUnitOfWork.SaveChangesAsync();
        }