Tenant yapısına uygunluğu kontrol edildi.
Hatalar giderildi.
This commit is contained in:
parent
7d006e0d74
commit
0f30c4ad7c
14 changed files with 174 additions and 119 deletions
|
|
@ -90,10 +90,10 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
||||||
ColumnOptionJson = DefaultColumnOptionJson(),
|
ColumnOptionJson = DefaultColumnOptionJson(),
|
||||||
PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Note"),
|
PermissionJson = DefaultPermissionJson(TenantManagementPermissions.Tenants.Create, TenantManagementPermissions.Tenants.Default, TenantManagementPermissions.Tenants.Update, TenantManagementPermissions.Tenants.Delete, TenantManagementPermissions.Tenants.Default + ".Export", TenantManagementPermissions.Tenants.Default + ".Import", TenantManagementPermissions.Tenants.Default + ".Note"),
|
||||||
PagerOptionJson = DefaultPagerOptionJson,
|
PagerOptionJson = DefaultPagerOptionJson,
|
||||||
EditingOptionJson = DefaultEditingOptionJson(TenantManagementPermissions.Tenants.Default, 850, 700, true, true, true, true, false, true),
|
EditingOptionJson = DefaultEditingOptionJson(TenantManagementPermissions.Tenants.Default, 950, 700, true, true, true, true, false, true),
|
||||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>()
|
||||||
{
|
{
|
||||||
new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =
|
new() { Order=1, ColCount=3, ColSpan=1, ItemType="group", Items =
|
||||||
[
|
[
|
||||||
new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
new EditingFormItemDto { Order=1, DataField = "Name", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
||||||
new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
new EditingFormItemDto { Order=2, DataField = "OrganizationName", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
|
||||||
|
|
@ -107,7 +107,7 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
||||||
new EditingFormItemDto { Order=10, DataField = "MaxConcurrentUsers", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxNumberBox },
|
new EditingFormItemDto { Order=10, DataField = "MaxConcurrentUsers", ColSpan=1, IsRequired=false, EditorType2=EditorTypes.dxNumberBox },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
new() { Order=2, ColCount=2, ColSpan=1, ItemType="group", Items =
|
new() { Order=2, ColCount=3, ColSpan=1, ItemType="group", Items =
|
||||||
[
|
[
|
||||||
new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order=1, DataField = "Country", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order=2, DataField = "City", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order=2, DataField = "City", ColSpan=1, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,15 @@ using IdentityRole = Volo.Abp.Identity.IdentityRole;
|
||||||
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
using Sozsoft.Platform.Entities;
|
using Sozsoft.Platform.Entities;
|
||||||
|
using Volo.Abp.TenantManagement;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.Data.Seeds;
|
namespace Sozsoft.Platform.Data.Seeds;
|
||||||
|
|
||||||
[Dependency(ReplaceServices = true)]
|
[Dependency(ReplaceServices = true)]
|
||||||
public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
{
|
{
|
||||||
private readonly IPermissionGrantRepository permissionGrantRepository;
|
private readonly IPermissionGrantRepository _permissionGrantRepository;
|
||||||
|
private readonly ITenantRepository _tenantRepository;
|
||||||
private readonly IRepository<Branch, Guid> _branchRepository;
|
private readonly IRepository<Branch, Guid> _branchRepository;
|
||||||
private readonly IRepository<BranchUsers, Guid> _branchUsersRepository;
|
private readonly IRepository<BranchUsers, Guid> _branchUsersRepository;
|
||||||
|
|
||||||
|
|
@ -34,10 +36,12 @@ public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
IdentityRoleManager roleManager,
|
IdentityRoleManager roleManager,
|
||||||
IPermissionGrantRepository permissionGrantRepository,
|
IPermissionGrantRepository permissionGrantRepository,
|
||||||
ICurrentTenant currentTenant,
|
ICurrentTenant currentTenant,
|
||||||
|
ITenantRepository tenantRepository,
|
||||||
IOptions<IdentityOptions> identityOptions
|
IOptions<IdentityOptions> identityOptions
|
||||||
) : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
|
) : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
|
||||||
{
|
{
|
||||||
this.permissionGrantRepository = permissionGrantRepository;
|
this._permissionGrantRepository = permissionGrantRepository;
|
||||||
|
this._tenantRepository = tenantRepository;
|
||||||
this._branchRepository = branchRepository;
|
this._branchRepository = branchRepository;
|
||||||
this._branchUsersRepository = branchUsersRepository;
|
this._branchUsersRepository = branchUsersRepository;
|
||||||
}
|
}
|
||||||
|
|
@ -53,14 +57,33 @@ public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
|
|
||||||
var result = new IdentityDataSeedResult();
|
var result = new IdentityDataSeedResult();
|
||||||
|
|
||||||
var branchId = GuidGenerator.Create();
|
var branchCode = "";
|
||||||
var defaultBranch = await _branchRepository.FirstOrDefaultAsync(b => b.Code == PlatformConsts.Branches.BranchCode);
|
var branchName = "";
|
||||||
|
|
||||||
|
if (tenantId == null && !CurrentTenant.IsAvailable)
|
||||||
|
{
|
||||||
|
branchCode = PlatformConsts.Branches.BranchCode;
|
||||||
|
branchName = PlatformConsts.Branches.BranchName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var tenant = await _tenantRepository.FindAsync(tenantId ?? CurrentTenant.Id.Value);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
branchCode = tenant.Name;
|
||||||
|
branchName = tenant.GetOrganizationName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Default Branch otomatik olarak oluşturuluyor.
|
||||||
|
var defaultBranch = await _branchRepository.FirstOrDefaultAsync(b => b.Code == branchCode);
|
||||||
if (defaultBranch == null)
|
if (defaultBranch == null)
|
||||||
{
|
{
|
||||||
await _branchRepository.InsertAsync(new Branch(branchId)
|
var branchId = GuidGenerator.Create();
|
||||||
|
defaultBranch = await _branchRepository.InsertAsync(new Branch(branchId)
|
||||||
{
|
{
|
||||||
Code = PlatformConsts.Branches.BranchCode,
|
Code = branchCode,
|
||||||
Name = PlatformConsts.Branches.BranchName,
|
Name = branchName,
|
||||||
VknTckn = PlatformConsts.Branches.BranchVknTckn,
|
VknTckn = PlatformConsts.Branches.BranchVknTckn,
|
||||||
TaxOffice = PlatformConsts.Branches.BranchTaxOffice,
|
TaxOffice = PlatformConsts.Branches.BranchTaxOffice,
|
||||||
MobileNumber = PlatformConsts.Branches.BranchMobileNumber,
|
MobileNumber = PlatformConsts.Branches.BranchMobileNumber,
|
||||||
|
|
@ -125,30 +148,32 @@ public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
adminUser.SetBirthDate(PlatformConsts.AbpIdentity.User.AdminBirthDateDefaultValue);
|
adminUser.SetBirthDate(PlatformConsts.AbpIdentity.User.AdminBirthDateDefaultValue);
|
||||||
adminUser.SetBirthPlace(PlatformConsts.AbpIdentity.User.AdminBirthPlaceDefaultValue);
|
adminUser.SetBirthPlace(PlatformConsts.AbpIdentity.User.AdminBirthPlaceDefaultValue);
|
||||||
adminUser.SetMaritalStatus(PlatformConsts.AbpIdentity.User.AdminMaritalStatusDefaultValue);
|
adminUser.SetMaritalStatus(PlatformConsts.AbpIdentity.User.AdminMaritalStatusDefaultValue);
|
||||||
|
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
||||||
|
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
||||||
|
|
||||||
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
result.CreatedAdminUser = true;
|
result.CreatedAdminUser = true;
|
||||||
|
|
||||||
(await UserManager.AddToRoleAsync(adminUser, PlatformConsts.AbpIdentity.User.AdminRoleName)).CheckErrors();
|
(await UserManager.AddToRoleAsync(adminUser, PlatformConsts.AbpIdentity.User.AdminRoleName)).CheckErrors();
|
||||||
|
|
||||||
//BranchUsers tablosuna admin kullanıcısı ekleniyor
|
// BranchUsers tablosuna admin kullanicisi ekleniyor.
|
||||||
var defaultBranchUsers = await _branchUsersRepository.FirstOrDefaultAsync(bu => bu.UserId == userId && bu.BranchId == branchId);
|
var defaultBranchUsers = await _branchUsersRepository.FirstOrDefaultAsync(bu => bu.UserId == adminUser.Id && bu.BranchId == defaultBranch.Id);
|
||||||
if (defaultBranchUsers is null)
|
if (defaultBranchUsers is null)
|
||||||
{
|
{
|
||||||
await _branchUsersRepository.InsertAsync(new BranchUsers
|
await _branchUsersRepository.InsertAsync(new BranchUsers
|
||||||
{
|
{
|
||||||
BranchId = branchId,
|
BranchId = defaultBranch.Id,
|
||||||
UserId = userId,
|
UserId = adminUser.Id,
|
||||||
TenantId = tenantId
|
TenantId = tenantId
|
||||||
}, autoSave: true);
|
}, autoSave: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*admin rolüne ait yetkiler otomatik atanıyor*/
|
/*admin rolüne ait yetkiler otomatik atanıyor*/
|
||||||
var permissions = await permissionGrantRepository.GetListAsync("R", PlatformConsts.AbpIdentity.User.AdminRoleName);
|
var permissions = await _permissionGrantRepository.GetListAsync("R", PlatformConsts.AbpIdentity.User.AdminRoleName);
|
||||||
if (permissions.Count == 0)
|
if (permissions.Count == 0)
|
||||||
{
|
{
|
||||||
await permissionGrantRepository.InsertManyAsync(
|
await _permissionGrantRepository.InsertManyAsync(
|
||||||
[
|
[
|
||||||
new(Guid.NewGuid(), IdentityPermissions.Roles.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
new(Guid.NewGuid(), IdentityPermissions.Roles.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
||||||
new(Guid.NewGuid(), IdentityPermissions.Roles.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
new(Guid.NewGuid(), IdentityPermissions.Roles.Create, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
||||||
|
|
@ -166,6 +191,7 @@ public class PlatformIdentityDataSeeder : IdentityDataSeeder
|
||||||
new(Guid.NewGuid(), IdentityPermissions.UserLookup.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
new(Guid.NewGuid(), IdentityPermissions.UserLookup.Default, "R", PlatformConsts.AbpIdentity.User.AdminRoleName, tenantId),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ public static class PlatformConsts
|
||||||
|
|
||||||
public static class Branches
|
public static class Branches
|
||||||
{
|
{
|
||||||
public const string BranchCode = "DEMO";
|
public const string BranchCode = "Sozsoft";
|
||||||
public const string BranchName = "Demo";
|
public const string BranchName = "Sozsoft Branch";
|
||||||
public const long BranchVknTckn = 52849619172;
|
public const long BranchVknTckn = 52849619172;
|
||||||
public const string BranchTaxOffice = "Sarıgazi";
|
public const string BranchTaxOffice = "Sarıgazi";
|
||||||
public const string BranchMobileNumber = "5449476346";
|
public const string BranchMobileNumber = "5449476346";
|
||||||
|
|
@ -167,8 +167,10 @@ public static class PlatformConsts
|
||||||
public const string AdminPhoneNumberDefaultValue = "05449476346";
|
public const string AdminPhoneNumberDefaultValue = "05449476346";
|
||||||
public const string AdminRocketUsernameDefaultValue = "sedat.ozturk";
|
public const string AdminRocketUsernameDefaultValue = "sedat.ozturk";
|
||||||
public const string AdminWorkHourDefaultValue = "00:00-23:59";
|
public const string AdminWorkHourDefaultValue = "00:00-23:59";
|
||||||
public const string AdminDepartmentIdDefaultValue = "Yönetim";
|
public const string AdminDepartmentDefaultValue = "Yönetim";
|
||||||
public const string AdminJobPositionIdDefaultValue = "Genel Müdür";
|
public static Guid AdminDepartmentIdDefaultValue = Guid.Parse("8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f");
|
||||||
|
public const string AdminJobPositionDefaultValue = "Genel Müdür";
|
||||||
|
public static Guid AdminJobPositionIdDefaultValue = Guid.Parse("d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60");
|
||||||
public const string AdminNationalityDefaultValue = "Türkiye";
|
public const string AdminNationalityDefaultValue = "Türkiye";
|
||||||
public const string AdminBloodTypeDefaultValue = "B Rh+";
|
public const string AdminBloodTypeDefaultValue = "B Rh+";
|
||||||
public const string AdminEducationLevelDefaultValue = "Yüksek Lisans";
|
public const string AdminEducationLevelDefaultValue = "Yüksek Lisans";
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ public class BranchUsers : Entity<Guid>, IMultiTenant
|
||||||
{
|
{
|
||||||
public Guid? TenantId { get; set; }
|
public Guid? TenantId { get; set; }
|
||||||
public Guid BranchId { get; set; }
|
public Guid BranchId { get; set; }
|
||||||
public Branch Branch { get; set; }
|
|
||||||
public Guid UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
|
|
||||||
Guid? IMultiTenant.TenantId => TenantId;
|
Guid? IMultiTenant.TenantId => TenantId;
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,9 @@ public class Department : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
Guid? IMultiTenant.TenantId => TenantId;
|
Guid? IMultiTenant.TenantId => TenantId;
|
||||||
|
|
||||||
public ICollection<JobPosition> JobPositions { get; set; }
|
public ICollection<JobPosition> JobPositions { get; set; }
|
||||||
|
|
||||||
|
public Department(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,9 @@ public class JobPosition : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
public Guid? ParentId { get; set; }
|
public Guid? ParentId { get; set; }
|
||||||
|
|
||||||
Guid? IMultiTenant.TenantId => TenantId;
|
Guid? IMultiTenant.TenantId => TenantId;
|
||||||
|
|
||||||
|
public JobPosition(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Volo.Abp.Domain.Entities.Auditing;
|
using Volo.Abp.Domain.Entities.Auditing;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.Entities;
|
namespace Sozsoft.Platform.Entities;
|
||||||
|
|
@ -26,8 +25,6 @@ public class Branch : FullAuditedEntity<Guid>
|
||||||
public string Website { get; set; }
|
public string Website { get; set; }
|
||||||
public bool? IsActive { get; set; }
|
public bool? IsActive { get; set; }
|
||||||
|
|
||||||
public ICollection<BranchUsers> UserBranches { get; set; }
|
|
||||||
|
|
||||||
public Branch(Guid id)
|
public Branch(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
|
|
||||||
|
|
@ -229,10 +229,10 @@ public class PlatformDbContext :
|
||||||
|
|
||||||
b.HasIndex(x => new { x.TenantId, x.BranchId, x.UserId }).IsUnique().HasFilter(null);
|
b.HasIndex(x => new { x.TenantId, x.BranchId, x.UserId }).IsUnique().HasFilter(null);
|
||||||
|
|
||||||
b.HasOne(x => x.Branch)
|
// b.HasOne(x => x.Branch)
|
||||||
.WithMany(x => x.UserBranches)
|
// .WithMany(x => x.UserBranches)
|
||||||
.HasForeignKey(x => x.BranchId)
|
// .HasForeignKey(x => x.BranchId)
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
// .OnDelete(DeleteBehavior.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Entity<GlobalSearch>(b =>
|
builder.Entity<GlobalSearch>(b =>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||||
namespace Sozsoft.Platform.Migrations
|
namespace Sozsoft.Platform.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PlatformDbContext))]
|
[DbContext(typeof(PlatformDbContext))]
|
||||||
[Migration("20260525143351_Initial")]
|
[Migration("20260526185809_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -1179,8 +1179,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("BranchId");
|
|
||||||
|
|
||||||
b.HasIndex("TenantId", "BranchId", "UserId")
|
b.HasIndex("TenantId", "BranchId", "UserId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
|
|
@ -8139,17 +8137,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
b.Navigation("Category");
|
b.Navigation("Category");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Sozsoft.Platform.Entities.Branch", "Branch")
|
|
||||||
.WithMany("UserBranches")
|
|
||||||
.HasForeignKey("BranchId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Branch");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Sozsoft.Platform.Entities.Country", null)
|
b.HasOne("Sozsoft.Platform.Entities.Country", null)
|
||||||
|
|
@ -8662,11 +8649,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
b.Navigation("Posts");
|
b.Navigation("Posts");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.Branch", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("UserBranches");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Districts");
|
b.Navigation("Districts");
|
||||||
|
|
@ -1749,6 +1749,20 @@ namespace Sozsoft.Platform.Migrations
|
||||||
table.PrimaryKey("PK_Sas_T_Branch", x => x.Id);
|
table.PrimaryKey("PK_Sas_T_Branch", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Sas_T_BranchUsers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
|
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Sas_T_BranchUsers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Sas_T_ForumCategory",
|
name: "Sas_T_ForumCategory",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
|
|
@ -2825,26 +2839,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Sas_T_BranchUsers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
||||||
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
|
||||||
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
||||||
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Sas_T_BranchUsers", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Sas_T_BranchUsers_Sas_T_Branch_BranchId",
|
|
||||||
column: x => x.BranchId,
|
|
||||||
principalTable: "Sas_T_Branch",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Sas_T_ForumTopic",
|
name: "Sas_T_ForumTopic",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
|
|
@ -4024,11 +4018,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
unique: true,
|
unique: true,
|
||||||
filter: "[IsDeleted] = 0");
|
filter: "[IsDeleted] = 0");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Sas_T_BranchUsers_BranchId",
|
|
||||||
table: "Sas_T_BranchUsers",
|
|
||||||
column: "BranchId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Sas_T_BranchUsers_TenantId_BranchId_UserId",
|
name: "IX_Sas_T_BranchUsers_TenantId_BranchId_UserId",
|
||||||
table: "Sas_T_BranchUsers",
|
table: "Sas_T_BranchUsers",
|
||||||
|
|
@ -4304,6 +4293,9 @@ namespace Sozsoft.Platform.Migrations
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Sas_H_Uom");
|
name: "Sas_H_Uom");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Sas_T_Branch");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Sas_T_BranchUsers");
|
name: "Sas_T_BranchUsers");
|
||||||
|
|
||||||
|
|
@ -4382,9 +4374,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Sas_H_UomCategory");
|
name: "Sas_H_UomCategory");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Sas_T_Branch");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Sas_T_ForumTopic");
|
name: "Sas_T_ForumTopic");
|
||||||
|
|
||||||
|
|
@ -1176,8 +1176,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("BranchId");
|
|
||||||
|
|
||||||
b.HasIndex("TenantId", "BranchId", "UserId")
|
b.HasIndex("TenantId", "BranchId", "UserId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
|
|
@ -8136,17 +8134,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
b.Navigation("Category");
|
b.Navigation("Category");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.BranchUsers", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Sozsoft.Platform.Entities.Branch", "Branch")
|
|
||||||
.WithMany("UserBranches")
|
|
||||||
.HasForeignKey("BranchId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Branch");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Sozsoft.Platform.Entities.Country", null)
|
b.HasOne("Sozsoft.Platform.Entities.Country", null)
|
||||||
|
|
@ -8659,11 +8646,6 @@ namespace Sozsoft.Platform.Migrations
|
||||||
b.Navigation("Posts");
|
b.Navigation("Posts");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.Branch", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("UserBranches");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
modelBuilder.Entity("Sozsoft.Platform.Entities.City", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Districts");
|
b.Navigation("Districts");
|
||||||
|
|
|
||||||
|
|
@ -1257,45 +1257,55 @@
|
||||||
],
|
],
|
||||||
"Departments": [
|
"Departments": [
|
||||||
{
|
{
|
||||||
|
"Id": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
||||||
"Name": "Yönetim"
|
"Name": "Yönetim"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "2c1743a3-91b7-4b57-a6c8-7d8e9f0a1b2c",
|
||||||
"Name": "Üretim",
|
"Name": "Üretim",
|
||||||
"ParentName": "Yönetim"
|
"ParentName": "Yönetim"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "987bcab0-1b92-4a4e-8d7f-3c2b1a0f9e8d",
|
||||||
"Name": "Satış",
|
"Name": "Satış",
|
||||||
"ParentName": "Yönetim"
|
"ParentName": "Yönetim"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "05b048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||||
"Name": "Finans",
|
"Name": "Finans",
|
||||||
"ParentName": "Yönetim"
|
"ParentName": "Yönetim"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "63dc7ed1-81f2-4c5a-9d8b-0a1b2c3d4e5f",
|
||||||
"Name": "Muhasebe",
|
"Name": "Muhasebe",
|
||||||
"ParentName": "Finans"
|
"ParentName": "Finans"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "3cd38ab3-7e6f-4b8d-9c0a-5f4e3d2c1b0a",
|
||||||
"Name": "Bilgi İşlem",
|
"Name": "Bilgi İşlem",
|
||||||
"ParentName": "Yönetim"
|
"ParentName": "Yönetim"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"JobPositions": [
|
"JobPositions": [
|
||||||
{
|
{
|
||||||
|
"Id": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60",
|
||||||
"DepartmentName": "Yönetim",
|
"DepartmentName": "Yönetim",
|
||||||
"Name": "Genel Müdür"
|
"Name": "Genel Müdür"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "a2b3c4d5-e6f7-4890-ab12-cd34ef56ab78",
|
||||||
"DepartmentName": "Yönetim",
|
"DepartmentName": "Yönetim",
|
||||||
"Name": "Genel Müdür Yardımcısı",
|
"Name": "Genel Müdür Yardımcısı",
|
||||||
"ParentName": "Genel Müdür"
|
"ParentName": "Genel Müdür"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d5e",
|
||||||
"DepartmentName": "Muhasebe",
|
"DepartmentName": "Muhasebe",
|
||||||
"Name": "Muhasebe Müdürü",
|
"Name": "Muhasebe Müdürü",
|
||||||
"ParentName": "Genel Müdür"
|
"ParentName": "Genel Müdür"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"Id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
|
||||||
"DepartmentName": "Muhasebe",
|
"DepartmentName": "Muhasebe",
|
||||||
"Name": "Muhasebe Şefi",
|
"Name": "Muhasebe Şefi",
|
||||||
"ParentName": "Muhasebe Müdürü"
|
"ParentName": "Muhasebe Müdürü"
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ public class AnnouncementSeedDto
|
||||||
|
|
||||||
public class JobPositionSeedDto
|
public class JobPositionSeedDto
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
public string DepartmentName { get; set; }
|
public string DepartmentName { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string BranchCode { get; set; }
|
public string BranchCode { get; set; }
|
||||||
|
|
@ -233,6 +234,7 @@ public class JobPositionSeedDto
|
||||||
|
|
||||||
public class DepartmentSeedDto
|
public class DepartmentSeedDto
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string BranchCode { get; set; }
|
public string BranchCode { get; set; }
|
||||||
public string ParentName { get; set; }
|
public string ParentName { get; set; }
|
||||||
|
|
@ -961,7 +963,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
var branch = await _branchRepository.FirstOrDefaultAsync(x => x.Code == item.BranchCode);
|
var branch = await _branchRepository.FirstOrDefaultAsync(x => x.Code == item.BranchCode);
|
||||||
var parent = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
var parent = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
||||||
|
|
||||||
await _departmentRepository.InsertAsync(new Department
|
await _departmentRepository.InsertAsync(new Department(item.Id)
|
||||||
{
|
{
|
||||||
Name = item.Name,
|
Name = item.Name,
|
||||||
ParentId = parent?.Id
|
ParentId = parent?.Id
|
||||||
|
|
@ -977,7 +979,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
var department = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.DepartmentName);
|
var department = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.DepartmentName);
|
||||||
var parent = await _jobPositionRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
var parent = await _jobPositionRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
||||||
|
|
||||||
await _jobPositionRepository.InsertAsync(new JobPosition
|
await _jobPositionRepository.InsertAsync(new JobPosition(item.Id)
|
||||||
{
|
{
|
||||||
Name = item.Name,
|
Name = item.Name,
|
||||||
DepartmentId = department.Id,
|
DepartmentId = department.Id,
|
||||||
|
|
@ -1270,24 +1272,5 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//admin kullanının departmen ve pozisyonunu default olarak belirliyoruz
|
|
||||||
var adminUser = await _repositoryUser.FindByNormalizedEmailAsync(PlatformConsts.AbpIdentity.User.AdminEmailDefaultValue);
|
|
||||||
if (adminUser != null)
|
|
||||||
{
|
|
||||||
var defaultDepartment = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
|
||||||
if (defaultDepartment != null)
|
|
||||||
{
|
|
||||||
adminUser.SetDepartmentId(defaultDepartment.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
var defaultJobPosition = await _jobPositionRepository.FirstOrDefaultAsync(x => x.Name == PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
|
||||||
if (defaultJobPosition != null)
|
|
||||||
{
|
|
||||||
adminUser.SetJobPositionId(defaultJobPosition.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
await _repositoryUser.UpdateAsync(adminUser);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,27 +11,39 @@ using Volo.Abp.MultiTenancy;
|
||||||
using Volo.Abp.PermissionManagement;
|
using Volo.Abp.PermissionManagement;
|
||||||
using IdentityRole = Volo.Abp.Identity.IdentityRole;
|
using IdentityRole = Volo.Abp.Identity.IdentityRole;
|
||||||
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
using IdentityUser = Volo.Abp.Identity.IdentityUser;
|
||||||
|
using Volo.Abp.Domain.Repositories;
|
||||||
|
using Sozsoft.Platform.Entities;
|
||||||
|
using Volo.Abp.TenantManagement;
|
||||||
|
|
||||||
namespace Sozsoft.Platform.Data.Seeds;
|
namespace Sozsoft.Platform.Data.Seeds;
|
||||||
|
|
||||||
[Dependency(ReplaceServices = true)]
|
[Dependency(ReplaceServices = true)]
|
||||||
public class TenantIdentityDataSeeder : IdentityDataSeeder
|
public class TenantIdentityDataSeeder : IdentityDataSeeder
|
||||||
{
|
{
|
||||||
private readonly IPermissionGrantRepository permissionGrantRepository;
|
private readonly IRepository<Branch, Guid> _branchRepository;
|
||||||
|
private readonly IRepository<BranchUsers, Guid> _branchUsersRepository;
|
||||||
|
private readonly IPermissionGrantRepository _permissionGrantRepository;
|
||||||
|
private readonly ITenantRepository _tenantRepository;
|
||||||
|
|
||||||
public TenantIdentityDataSeeder(
|
public TenantIdentityDataSeeder(
|
||||||
IGuidGenerator guidGenerator,
|
IGuidGenerator guidGenerator,
|
||||||
IIdentityRoleRepository roleRepository,
|
IIdentityRoleRepository roleRepository,
|
||||||
IIdentityUserRepository userRepository,
|
IIdentityUserRepository userRepository,
|
||||||
|
IRepository<Branch, Guid> branchRepository,
|
||||||
|
IRepository<BranchUsers, Guid> branchUsersRepository,
|
||||||
ILookupNormalizer lookupNormalizer,
|
ILookupNormalizer lookupNormalizer,
|
||||||
IdentityUserManager userManager,
|
IdentityUserManager userManager,
|
||||||
IdentityRoleManager roleManager,
|
IdentityRoleManager roleManager,
|
||||||
IPermissionGrantRepository permissionGrantRepository,
|
IPermissionGrantRepository permissionGrantRepository,
|
||||||
ICurrentTenant currentTenant,
|
ICurrentTenant currentTenant,
|
||||||
|
ITenantRepository tenantRepository,
|
||||||
IOptions<IdentityOptions> identityOptions
|
IOptions<IdentityOptions> identityOptions
|
||||||
) : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
|
) : base(guidGenerator, roleRepository, userRepository, lookupNormalizer, userManager, roleManager, currentTenant, identityOptions)
|
||||||
{
|
{
|
||||||
this.permissionGrantRepository = permissionGrantRepository;
|
this._branchRepository = branchRepository;
|
||||||
|
this._branchUsersRepository = branchUsersRepository;
|
||||||
|
this._permissionGrantRepository = permissionGrantRepository;
|
||||||
|
this._tenantRepository = tenantRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<IdentityDataSeedResult> SeedAsync(string adminEmail, string adminPassword, Guid? tenantId = null, string adminUserName = null)
|
public override async Task<IdentityDataSeedResult> SeedAsync(string adminEmail, string adminPassword, Guid? tenantId = null, string adminUserName = null)
|
||||||
|
|
@ -45,6 +57,47 @@ public class TenantIdentityDataSeeder : IdentityDataSeeder
|
||||||
|
|
||||||
var result = new IdentityDataSeedResult();
|
var result = new IdentityDataSeedResult();
|
||||||
|
|
||||||
|
var branchCode = "";
|
||||||
|
var branchName = "";
|
||||||
|
|
||||||
|
if (tenantId == null && !CurrentTenant.IsAvailable)
|
||||||
|
{
|
||||||
|
branchCode = PlatformConsts.Branches.BranchCode;
|
||||||
|
branchName = PlatformConsts.Branches.BranchName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var tenant = await _tenantRepository.FindAsync(tenantId ?? CurrentTenant.Id.Value);
|
||||||
|
if (tenant != null)
|
||||||
|
{
|
||||||
|
branchCode = tenant.Name;
|
||||||
|
branchName = tenant.GetOrganizationName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Default Branch otomatik olarak oluşturuluyor.
|
||||||
|
var defaultBranch = await _branchRepository.FirstOrDefaultAsync(b => b.Code == branchCode);
|
||||||
|
if (defaultBranch == null)
|
||||||
|
{
|
||||||
|
var branchId = GuidGenerator.Create();
|
||||||
|
defaultBranch = await _branchRepository.InsertAsync(new Branch(branchId)
|
||||||
|
{
|
||||||
|
Code = branchCode,
|
||||||
|
Name = branchName,
|
||||||
|
VknTckn = PlatformConsts.Branches.BranchVknTckn,
|
||||||
|
TaxOffice = PlatformConsts.Branches.BranchTaxOffice,
|
||||||
|
MobileNumber = PlatformConsts.Branches.BranchMobileNumber,
|
||||||
|
Country = PlatformConsts.Branches.BranchCountry,
|
||||||
|
City = PlatformConsts.Branches.BranchCity,
|
||||||
|
District = PlatformConsts.Branches.BranchDistrict,
|
||||||
|
Township = PlatformConsts.Branches.BranchTownship,
|
||||||
|
Email = PlatformConsts.Branches.BranchEmail,
|
||||||
|
Website = PlatformConsts.Branches.BranchWebsite,
|
||||||
|
IsActive = PlatformConsts.Branches.BranchIsActive,
|
||||||
|
TenantId = tenantId,
|
||||||
|
}, autoSave: true);
|
||||||
|
}
|
||||||
|
|
||||||
var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(PlatformConsts.AbpIdentity.User.AdminRoleName));
|
var adminRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(PlatformConsts.AbpIdentity.User.AdminRoleName));
|
||||||
if (adminRole is null)
|
if (adminRole is null)
|
||||||
{
|
{
|
||||||
|
|
@ -85,11 +138,33 @@ public class TenantIdentityDataSeeder : IdentityDataSeeder
|
||||||
adminUser.SetRocketUsername(PlatformConsts.AbpIdentity.User.AdminRocketUsernameDefaultValue);
|
adminUser.SetRocketUsername(PlatformConsts.AbpIdentity.User.AdminRocketUsernameDefaultValue);
|
||||||
adminUser.SetPhoneNumber(PlatformConsts.AbpIdentity.User.AdminPhoneNumberDefaultValue, true);
|
adminUser.SetPhoneNumber(PlatformConsts.AbpIdentity.User.AdminPhoneNumberDefaultValue, true);
|
||||||
adminUser.SetWorkHour(PlatformConsts.AbpIdentity.User.AdminWorkHourDefaultValue);
|
adminUser.SetWorkHour(PlatformConsts.AbpIdentity.User.AdminWorkHourDefaultValue);
|
||||||
|
adminUser.SetNationality(PlatformConsts.AbpIdentity.User.AdminNationalityDefaultValue);
|
||||||
|
adminUser.SetBloodType(PlatformConsts.AbpIdentity.User.AdminBloodTypeDefaultValue);
|
||||||
|
adminUser.SetEducationLevel(PlatformConsts.AbpIdentity.User.AdminEducationLevelDefaultValue);
|
||||||
|
adminUser.SetGraduationSchool(PlatformConsts.AbpIdentity.User.AdminGraduationSchoolDefaultValue);
|
||||||
|
adminUser.SetHomeAddress(PlatformConsts.AbpIdentity.User.AdminHomeAddressDefaultValue);
|
||||||
|
adminUser.SetBirthDate(PlatformConsts.AbpIdentity.User.AdminBirthDateDefaultValue);
|
||||||
|
adminUser.SetBirthPlace(PlatformConsts.AbpIdentity.User.AdminBirthPlaceDefaultValue);
|
||||||
|
adminUser.SetMaritalStatus(PlatformConsts.AbpIdentity.User.AdminMaritalStatusDefaultValue);
|
||||||
|
adminUser.SetDepartmentId(PlatformConsts.AbpIdentity.User.AdminDepartmentIdDefaultValue);
|
||||||
|
adminUser.SetJobPositionId(PlatformConsts.AbpIdentity.User.AdminJobPositionIdDefaultValue);
|
||||||
|
|
||||||
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
(await UserManager.CreateAsync(adminUser, adminPassword, validatePassword: false)).CheckErrors();
|
||||||
result.CreatedAdminUser = true;
|
result.CreatedAdminUser = true;
|
||||||
|
|
||||||
(await UserManager.AddToRoleAsync(adminUser, PlatformConsts.AbpIdentity.User.AdminRoleName)).CheckErrors();
|
(await UserManager.AddToRoleAsync(adminUser, PlatformConsts.AbpIdentity.User.AdminRoleName)).CheckErrors();
|
||||||
|
|
||||||
|
// BranchUsers tablosuna admin kullanicisi ekleniyor.
|
||||||
|
var defaultBranchUsers = await _branchUsersRepository.FirstOrDefaultAsync(bu => bu.UserId == adminUser.Id && bu.BranchId == defaultBranch.Id);
|
||||||
|
if (defaultBranchUsers is null)
|
||||||
|
{
|
||||||
|
await _branchUsersRepository.InsertAsync(new BranchUsers
|
||||||
|
{
|
||||||
|
BranchId = defaultBranch.Id,
|
||||||
|
UserId = adminUser.Id,
|
||||||
|
TenantId = tenantId
|
||||||
|
}, autoSave: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant all permission kısmı Abp tarafından otomatik çalıştırılıyor.
|
// Grant all permission kısmı Abp tarafından otomatik çalıştırılıyor.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue