Browse Source

renaming organizationUnit namepsace

pull/3732/head
Galip Tolga Erdem 7 years ago
parent
commit
cdf8cf9907
  1. 4
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitConsts.cs
  2. 4
      modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj
  3. 1
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs
  4. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs
  5. 1
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs
  6. 1
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserOrganizationUnit.cs
  7. 5
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs
  8. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs
  9. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitRole.cs
  10. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentityEntityFrameworkCoreModule.cs
  11. 10
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs
  12. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs
  13. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs
  14. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs
  15. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs
  16. 1
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs
  17. 1
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs
  18. 1
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs
  19. 1
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbModule.cs
  20. 1
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs
  21. 1
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs
  22. 13
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs
  23. 4
      modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs
  24. 9
      modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs
  25. 5
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs
  26. 1
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs
  27. 1
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/Identity_Repository_Resolve_Tests.cs
  28. 1
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs
  29. 4
      modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs

4
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Organizations/OrganizationUnitConsts.cs → modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/OrganizationUnitConsts.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.Identity.Organizations
namespace Volo.Abp.Identity
{
public class OrganizationUnitConsts
public static class OrganizationUnitConsts
{
/// <summary>
/// Maximum length of the <see cref="DisplayName"/> property.

4
modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj

@ -33,4 +33,8 @@
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Volo\Abp\Identity\Organizations\" />
</ItemGroup>
</Project>

1
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs

@ -5,7 +5,6 @@ using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity
{

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/IOrganizationUnitRepository.cs → modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs

@ -4,7 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace Volo.Abp.Identity.Organizations
namespace Volo.Abp.Identity
{
public interface IOrganizationUnitRepository : IBasicRepository<OrganizationUnit, Guid>
{

1
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs

@ -10,7 +10,6 @@ using Microsoft.Extensions.Options;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
using Volo.Abp.Settings;

1
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserOrganizationUnit.cs

@ -1,6 +1,5 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Identity

5
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnit.cs → modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnit.cs

@ -5,7 +5,7 @@ using System.Linq;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Identity.Organizations
namespace Volo.Abp.Identity
{
/// <summary>
/// Represents an organization unit (OU).
@ -52,8 +52,9 @@ namespace Volo.Abp.Identity.Organizations
/// <param name="tenantId">Tenant's Id or null for host.</param>
/// <param name="displayName">Display name.</param>
/// <param name="parentId">Parent's Id or null if OU is a root.</param>
public OrganizationUnit(Guid? tenantId, string displayName, Guid? parentId = null)
public OrganizationUnit(Guid id, string displayName, Guid? parentId = null, Guid? tenantId = null)
{
Id = id;
TenantId = tenantId;
DisplayName = displayName;
ParentId = parentId;

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs → modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs

@ -8,7 +8,7 @@ using Volo.Abp.Identity.Localization;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
namespace Volo.Abp.Identity.Organizations
namespace Volo.Abp.Identity
{
/// <summary>
/// Performs domain logic for Organization Units.

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitRole.cs → modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitRole.cs

@ -2,7 +2,7 @@
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Identity.Organizations
namespace Volo.Abp.Identity
{
/// <summary>
/// Represents membership of a User to an OU.

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentityEntityFrameworkCoreModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Volo.Abp.Users.EntityFrameworkCore;

10
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs

@ -8,7 +8,6 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity.EntityFrameworkCore
{
@ -140,6 +139,15 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
join role in DbContext.Roles.IncludeDetails(includeDetails) on userRole.RoleId equals role.Id
where userRole.UserId == id
select role;
//TODO
//var q2 = from userOrganization in DbContext.Set<IdentityUserOrganizationUnit>()
// join userOrg in DbContext.OrganizationUnits.IncludeDetails(includeDetails) on userOrganization.UserId equals id
// select userOrg.Roles;
//var q3 = from ouRole in DbContext.Set<OrganizationUnitRole>()
// join role in DbContext.Roles.IncludeDetails(includeDetails) on ouRole.RoleId equals role.Id
// where ouRole.RoleId == id
// select role;
//query = q2.Union(query);
return await query.ToListAsync(GetCancellationToken(cancellationToken));
}

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs

@ -6,7 +6,6 @@ using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity.EntityFrameworkCore
{

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs

@ -1,7 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity.EntityFrameworkCore
{

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs

@ -1,7 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity.EntityFrameworkCore
{

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs

@ -2,7 +2,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Users.EntityFrameworkCore;
namespace Volo.Abp.Identity.EntityFrameworkCore

1
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs

@ -1,6 +1,5 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity.EntityFrameworkCore
{

1
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs

@ -1,6 +1,5 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MongoDB;
namespace Volo.Abp.Identity.MongoDB

1
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs

@ -1,5 +1,4 @@
using System;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MongoDB;
namespace Volo.Abp.Identity.MongoDB

1
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbModule.cs

@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Volo.Abp.Users.MongoDB;

1
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs

@ -1,6 +1,5 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MongoDB;
namespace Volo.Abp.Identity.MongoDB

1
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

@ -9,7 +9,6 @@ using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.Guids;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MongoDB;
namespace Volo.Abp.Identity.MongoDB

13
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs

@ -6,7 +6,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.MongoDB;
namespace Volo.Abp.Identity.MongoDB
@ -20,7 +19,7 @@ namespace Volo.Abp.Identity.MongoDB
}
public async Task<List<OrganizationUnit>> GetChildrenAsync(
Guid? parentId,
Guid? parentId,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
@ -30,8 +29,8 @@ namespace Volo.Abp.Identity.MongoDB
}
public async Task<List<OrganizationUnit>> GetAllChildrenWithParentCodeAsync(
string code,
Guid? parentId,
string code,
Guid? parentId,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
@ -41,7 +40,7 @@ namespace Volo.Abp.Identity.MongoDB
}
public async Task<List<OrganizationUnit>> GetListAsync(
IEnumerable<Guid> ids,
IEnumerable<Guid> ids,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
@ -51,8 +50,8 @@ namespace Volo.Abp.Identity.MongoDB
}
public async Task<OrganizationUnit> GetOrganizationUnitAsync(
string displayName,
bool includeDetails = false,
string displayName,
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
return await GetMongoQueryable()

4
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs

@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Shouldly;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Castle.DynamicProxy;
using Volo.Abp.Uow;
using Xunit;
using System.Linq;
namespace Volo.Abp.Identity
{

9
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs

@ -1,11 +1,8 @@
using Microsoft.AspNetCore.Identity;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Guids;
using Volo.Abp.Uow;
using Xunit;
@ -19,6 +16,7 @@ namespace Volo.Abp.Identity
private readonly IIdentityRoleRepository _identityRoleRepository;
private readonly ILookupNormalizer _lookupNormalizer;
private readonly IUnitOfWorkManager _unitOfWorkManager;
private readonly IGuidGenerator _guidGenerator;
public OrganizationUnitManager_Tests()
{
_organizationUnitManager = GetRequiredService<OrganizationUnitManager>();
@ -27,12 +25,13 @@ namespace Volo.Abp.Identity
_lookupNormalizer = GetRequiredService<ILookupNormalizer>();
_testData = GetRequiredService<IdentityTestData>();
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
_guidGenerator = GetService<IGuidGenerator>();
}
[Fact]
public async Task CreateAsnyc()
{
await _organizationUnitManager.CreateAsync(new OrganizationUnit(null, "Root 1"));
await _organizationUnitManager.CreateAsync(new OrganizationUnit(_guidGenerator.Create(), "Root 1"));
var root1 = await _organizationUnitRepository.GetOrganizationUnitAsync("Root 1");
root1.ShouldNotBeNull();

5
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs

@ -4,7 +4,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Identity.Organizations;
namespace Volo.Abp.Identity
{
@ -88,7 +87,7 @@ namespace Volo.Abp.Identity
var ou2 = await CreateOU("OU2", OrganizationUnit.CreateCode(2));
var ou21 = await CreateOU("OU21", OrganizationUnit.CreateCode(2, 1), ou2.Id);
_ou111 = new OrganizationUnit(null, "OU111", ou11.Id);
_ou111 = new OrganizationUnit(_guidGenerator.Create(), "OU111", ou11.Id);
_ou111.Code = OrganizationUnit.CreateCode(1, 1, 1);
_ou111.AddRole(_moderatorRole.Id);
_ou111.AddRole(_managerRole.Id);
@ -134,7 +133,7 @@ namespace Volo.Abp.Identity
private async Task<OrganizationUnit> CreateOU(string displayName, string code, Guid? parentId = null)
{
var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(null, displayName, parentId) { Code = code });
var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(_guidGenerator.Create(), displayName, parentId) { Code = code });
return ou;
}
}

1
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs

@ -5,7 +5,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Xunit;

1
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/Identity_Repository_Resolve_Tests.cs

@ -2,7 +2,6 @@
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Xunit;

1
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs

@ -3,7 +3,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;
using Xunit;

4
modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs

@ -1,13 +1,9 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Guids;
using Volo.Abp.Identity.Organizations;
using Volo.Abp.Modularity;
using Xunit;

Loading…
Cancel
Save