Seeder düzenlemeleri
This commit is contained in:
parent
a35421b73a
commit
dd89822131
8 changed files with 2033 additions and 1610 deletions
|
|
@ -1,36 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Kurs.Platform.Entities;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
|
||||||
|
|
||||||
public class BackgroundWorkerSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IRepository<BackgroundWorker, Guid> _backgroundWorkerRepository;
|
|
||||||
|
|
||||||
public BackgroundWorkerSeeder(
|
|
||||||
IRepository<BackgroundWorker, Guid> backgroundWorkerRepository)
|
|
||||||
{
|
|
||||||
_backgroundWorkerRepository = backgroundWorkerRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
#region BackgroundWorker
|
|
||||||
|
|
||||||
await _backgroundWorkerRepository.InsertManyAsync([
|
|
||||||
new() {
|
|
||||||
Name = "Notification Worker",
|
|
||||||
Cron = "5 * * * *",
|
|
||||||
WorkerType = Enums.WorkerTypeEnum.NotificationWorker,
|
|
||||||
IsActive = true,
|
|
||||||
DataSourceCode = SeedConsts.DataSources.DefaultCode,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Kurs.Platform.Entities;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
|
||||||
|
|
||||||
public class GlobalSearchSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IRepository<GlobalSearch> _globalSearchRepository;
|
|
||||||
|
|
||||||
public GlobalSearchSeeder(
|
|
||||||
IRepository<GlobalSearch> globalSearchRepository)
|
|
||||||
{
|
|
||||||
_globalSearchRepository = globalSearchRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
#region GlobalSearch
|
|
||||||
|
|
||||||
await _globalSearchRepository.InsertManyAsync([
|
|
||||||
new() {
|
|
||||||
System = "Platform",
|
|
||||||
Group = "Setting Definitions",
|
|
||||||
Term = "Abp.Account.Captcha.EndPoint",
|
|
||||||
Weight = "0.2",
|
|
||||||
Url = "/list/List-0009"
|
|
||||||
},
|
|
||||||
new() {
|
|
||||||
System = "Platform",
|
|
||||||
Group = "Setting Definitions",
|
|
||||||
Term = "Abp.Account.IsSelfRegistrationEnabled",
|
|
||||||
Weight = "0.8",
|
|
||||||
Url = "/list/List-0009"
|
|
||||||
},
|
|
||||||
new() {
|
|
||||||
System = "Platform",
|
|
||||||
Group = "Setting Definitions",
|
|
||||||
Term = "Abp.Account.IsSelfRegistrationEnabled",
|
|
||||||
Weight = "0.7",
|
|
||||||
Url = "/list/List-0009"
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,519 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Kurs.Platform.Entities;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
|
||||||
using Volo.Abp.TenantManagement;
|
|
||||||
using static Kurs.Platform.Data.Seeds.SeedConsts;
|
|
||||||
using static Volo.Abp.Identity.IdentityPermissions;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
|
||||||
|
|
||||||
public class MenuSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IRepository<Menu, Guid> _repository;
|
|
||||||
|
|
||||||
public MenuSeeder(
|
|
||||||
IRepository<Menu, Guid> repository)
|
|
||||||
{
|
|
||||||
_repository = repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
if (await _repository.GetCountAsync() > 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Platform
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = SeedConsts.Platform,
|
|
||||||
DisplayName = SeedConsts.Platform,
|
|
||||||
Order = 9,
|
|
||||||
IsDisabled = false,
|
|
||||||
Icon = "FcTabletAndroid"
|
|
||||||
});
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Home
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Home,
|
|
||||||
DisplayName = AppCodes.Home,
|
|
||||||
Order = 0,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = null,
|
|
||||||
Icon = "FcHome",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = "/"
|
|
||||||
});
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Settings
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Setting,
|
|
||||||
DisplayName = AppCodes.Setting,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
Icon = "FcSettings",
|
|
||||||
Url = "/settings",
|
|
||||||
RequiredPermissionName = AppCodes.Setting
|
|
||||||
});
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Saas
|
|
||||||
var menuSaas = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Saas,
|
|
||||||
DisplayName = AppCodes.Saas,
|
|
||||||
Order = 3,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = null,
|
|
||||||
Icon = "FcPodiumWithAudience",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = TenantManagementPermissions.Tenants.Default,
|
|
||||||
DisplayName = TenantManagementPermissions.Tenants.Default,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuSaas.Code,
|
|
||||||
Icon = "FcDepartment",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Tenants}",
|
|
||||||
RequiredPermissionName = TenantManagementPermissions.Tenants.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Branches,
|
|
||||||
DisplayName = AppCodes.Branches,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuSaas.Code,
|
|
||||||
Icon = "FcShop",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Branch}",
|
|
||||||
RequiredPermissionName = AppCodes.Branches
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Administration
|
|
||||||
var menuAdministration = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Administration,
|
|
||||||
DisplayName = AppCodes.Administration,
|
|
||||||
Order = 4,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = null,
|
|
||||||
Icon = "FcOrganization",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
//Setting Management
|
|
||||||
var menuSettings = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Settings.Default,
|
|
||||||
DisplayName = AppCodes.Settings.Default,
|
|
||||||
Order = 0,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcCircuit",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu //SettingDefinitions Management
|
|
||||||
{
|
|
||||||
Code = AppCodes.Settings.SettingDefinitions,
|
|
||||||
DisplayName = AppCodes.Settings.SettingDefinitions,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuSettings.Code,
|
|
||||||
Icon = "FcSupport",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.SettingDefinition}",
|
|
||||||
RequiredPermissionName = AppCodes.Settings.SettingDefinitions
|
|
||||||
},
|
|
||||||
new Menu //Global Search Ayarları
|
|
||||||
{
|
|
||||||
Code = AppCodes.Settings.GlobalSearch,
|
|
||||||
DisplayName = AppCodes.Settings.GlobalSearch,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuSettings.Code,
|
|
||||||
Icon = "FcSearch",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.GlobalSearch}",
|
|
||||||
RequiredPermissionName = AppCodes.Settings.GlobalSearch
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Languages Management
|
|
||||||
var menuLanguages = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Languages.Default,
|
|
||||||
DisplayName = AppCodes.Languages.Default,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcGlobe",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Languages.Language,
|
|
||||||
DisplayName= AppCodes.Languages.Language,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuLanguages.Code,
|
|
||||||
Icon = "FcGraduationCap",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Language}",
|
|
||||||
RequiredPermissionName= AppCodes.Languages.Language
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Languages.LanguageText,
|
|
||||||
DisplayName= AppCodes.Languages.LanguageText,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuLanguages.Code,
|
|
||||||
Icon = "FcMindMap",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.LanguageText}",
|
|
||||||
RequiredPermissionName = AppCodes.Languages.LanguageText
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Identity Management
|
|
||||||
var menuIdentity = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AbpIdentity.GroupName,
|
|
||||||
DisplayName = AbpIdentity.GroupName,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcConferenceCall",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AbpIdentity.PermissionGroups.Default,
|
|
||||||
DisplayName= AbpIdentity.PermissionGroups.Default,
|
|
||||||
Order = 0,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcEngineering",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.PermissionGroup}",
|
|
||||||
RequiredPermissionName = AbpIdentity.PermissionGroups.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AbpIdentity.Permissions.Default,
|
|
||||||
DisplayName= AbpIdentity.Permissions.Default,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcSupport",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Permission}",
|
|
||||||
RequiredPermissionName = AbpIdentity.Permissions.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = Roles.Default,
|
|
||||||
DisplayName = Roles.Default,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcFlowChart",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Roles}",
|
|
||||||
RequiredPermissionName = Roles.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = Users.Default,
|
|
||||||
DisplayName= Users.Default,
|
|
||||||
Order = 3,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcBusinessman",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Users}",
|
|
||||||
RequiredPermissionName = Users.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AbpIdentity.OrganizationUnits.Default,
|
|
||||||
DisplayName= AbpIdentity.OrganizationUnits.Default,
|
|
||||||
Order = 4,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcOrganization",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/admin/ous",
|
|
||||||
RequiredPermissionName = AbpIdentity.OrganizationUnits.Default
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.IpRestrictions,
|
|
||||||
DisplayName = AppCodes.IpRestrictions,
|
|
||||||
Order = 5,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcNfcSign",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.IpRestriction}",
|
|
||||||
RequiredPermissionName = AppCodes.IpRestrictions
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.IdentityPermissions.Users.SecurityLogs,
|
|
||||||
DisplayName = AppCodes.IdentityPermissions.Users.SecurityLogs,
|
|
||||||
Order = 6,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuIdentity.Code,
|
|
||||||
Icon = "FcPrivacy",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.SecurityLog}",
|
|
||||||
RequiredPermissionName = AppCodes.IdentityPermissions.Users.SecurityLogs
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Menu Management
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Menus,
|
|
||||||
DisplayName = AppCodes.Menus,
|
|
||||||
Order = 3,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcMenu",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Menu}",
|
|
||||||
RequiredPermissionName = AppCodes.Menus
|
|
||||||
});
|
|
||||||
|
|
||||||
//Listform Management
|
|
||||||
var menuListFormManagement = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Listforms.Default,
|
|
||||||
DisplayName = AppCodes.Listforms.Default,
|
|
||||||
Order = 4,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcList",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Listforms.DataSource,
|
|
||||||
DisplayName= AppCodes.Listforms.DataSource,
|
|
||||||
Order = 0,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuListFormManagement.Code,
|
|
||||||
Icon = "FcAcceptDatabase",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.DataSource}",
|
|
||||||
RequiredPermissionName = AppCodes.Listforms.DataSource
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Listforms.Wizard,
|
|
||||||
DisplayName= AppCodes.Listforms.Wizard,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuListFormManagement.Code,
|
|
||||||
Icon = "FcFlashAuto",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/admin/listform/wizard",
|
|
||||||
RequiredPermissionName = AppCodes.Listforms.Wizard
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Listforms.Listform,
|
|
||||||
DisplayName = AppCodes.Listforms.Listform,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuListFormManagement.Code,
|
|
||||||
Icon = "FcDataSheet",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Listform}",
|
|
||||||
RequiredPermissionName = AppCodes.Listforms.Listform
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Listforms.Chart,
|
|
||||||
DisplayName= AppCodes.Listforms.Chart,
|
|
||||||
Order = 3,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuListFormManagement.Code,
|
|
||||||
Icon = "FcTodoList",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Chart}",
|
|
||||||
RequiredPermissionName= AppCodes.Listforms.Chart
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Notification Management
|
|
||||||
var menuNotifications = await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Notifications.Default,
|
|
||||||
DisplayName = AppCodes.Notifications.Default,
|
|
||||||
Order = 5,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcWorkflow",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.InsertManyAsync([
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Notifications.NotificationRules,
|
|
||||||
DisplayName = AppCodes.Notifications.NotificationRules,
|
|
||||||
Order = 1,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuNotifications.Code,
|
|
||||||
Icon = "FcLibrary",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.NotificationRule}",
|
|
||||||
RequiredPermissionName = AppCodes.Notifications.NotificationRules
|
|
||||||
},
|
|
||||||
new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.Notifications.Notification,
|
|
||||||
DisplayName = AppCodes.Notifications.Notification,
|
|
||||||
Order = 2,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuNotifications.Code,
|
|
||||||
Icon = "FcBrokenLink",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.Notification}",
|
|
||||||
RequiredPermissionName = AppCodes.Notifications.Notification
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
//BackgroundWorkers Management
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.BackgroundWorkers,
|
|
||||||
DisplayName = AppCodes.BackgroundWorkers,
|
|
||||||
Order = 6,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcWorkflow",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.BackgroundWorker}",
|
|
||||||
RequiredPermissionName = AppCodes.BackgroundWorkers
|
|
||||||
});
|
|
||||||
|
|
||||||
//Public Apis Management
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.PublicApis,
|
|
||||||
DisplayName = AppCodes.PublicApis,
|
|
||||||
Order = 7,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcMindMap",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.PublicApi}",
|
|
||||||
RequiredPermissionName = AppCodes.PublicApis
|
|
||||||
});
|
|
||||||
|
|
||||||
//Audit Logs
|
|
||||||
await _repository.InsertAsync(new Menu
|
|
||||||
{
|
|
||||||
Code = AppCodes.AuditLogs,
|
|
||||||
DisplayName = AppCodes.AuditLogs,
|
|
||||||
Order = 8,
|
|
||||||
IsDisabled = false,
|
|
||||||
ParentCode = menuAdministration.Code,
|
|
||||||
Icon = "FcMultipleInputs",
|
|
||||||
Target = null,
|
|
||||||
ElementId = null,
|
|
||||||
CssClass = null,
|
|
||||||
Url = $"/list/{PlatformConsts.ListFormCodes.AuditLog}",
|
|
||||||
RequiredPermissionName = AppCodes.AuditLogs
|
|
||||||
});
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Kurs.Notifications.Domain;
|
|
||||||
using Kurs.Notifications.Entities;
|
|
||||||
using Kurs.Notifications.Enums;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
|
||||||
|
|
||||||
public class NotificationRuleSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IRepository<NotificationRule, Guid> _notificationRuleRepository;
|
|
||||||
|
|
||||||
public NotificationRuleSeeder(
|
|
||||||
IRepository<NotificationRule, Guid> notificationRuleRepository)
|
|
||||||
{
|
|
||||||
_notificationRuleRepository = notificationRuleRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
#region NotificationRule
|
|
||||||
|
|
||||||
await _notificationRuleRepository.InsertManyAsync([
|
|
||||||
new() {
|
|
||||||
NotificationType = NotificationTypes.YeniSiparis,
|
|
||||||
RecipientType = NotificationRecipientTypes.Role,
|
|
||||||
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
|
|
||||||
Channel = NotificationChannels.UiActivity,
|
|
||||||
IsActive = true,
|
|
||||||
IsFixed = false,
|
|
||||||
IsCustomized = false
|
|
||||||
},
|
|
||||||
new() {
|
|
||||||
NotificationType = NotificationTypes.SiparisPasla,
|
|
||||||
RecipientType = NotificationRecipientTypes.Role,
|
|
||||||
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
|
|
||||||
Channel = NotificationChannels.Desktop,
|
|
||||||
IsActive = true,
|
|
||||||
IsFixed = false,
|
|
||||||
IsCustomized = false
|
|
||||||
},
|
|
||||||
new() {
|
|
||||||
NotificationType = NotificationTypes.YeniKullanici,
|
|
||||||
RecipientType = NotificationRecipientTypes.Role,
|
|
||||||
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
|
|
||||||
Channel = NotificationChannels.Rocket,
|
|
||||||
IsActive = true,
|
|
||||||
IsFixed = false,
|
|
||||||
IsCustomized = false
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,891 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Kurs.Platform.Data.Seeds;
|
|
||||||
using Volo.Abp.Data;
|
|
||||||
using Volo.Abp.DependencyInjection;
|
|
||||||
using Volo.Abp.Domain.Repositories;
|
|
||||||
using Volo.Abp.Guids;
|
|
||||||
using Volo.Abp.Identity;
|
|
||||||
using Volo.Abp.MultiTenancy;
|
|
||||||
using Volo.Abp.PermissionManagement;
|
|
||||||
using Volo.Abp.TenantManagement;
|
|
||||||
using static Kurs.Platform.Data.Seeds.SeedConsts;
|
|
||||||
|
|
||||||
namespace Kurs.Platform.Permissions;
|
|
||||||
|
|
||||||
public class PermissionSeeder : IDataSeedContributor, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IRepository<PermissionDefinitionRecord, Guid> repository;
|
|
||||||
private readonly IRepository<PermissionGroupDefinitionRecord, Guid> repositoryGroup;
|
|
||||||
private readonly IGuidGenerator guidGenerator;
|
|
||||||
|
|
||||||
private readonly string[] CUDE = [
|
|
||||||
CRUD.Create,
|
|
||||||
CRUD.Update,
|
|
||||||
CRUD.Delete,
|
|
||||||
CRUD.Export
|
|
||||||
];
|
|
||||||
|
|
||||||
public PermissionSeeder(
|
|
||||||
IRepository<PermissionDefinitionRecord, Guid> repository,
|
|
||||||
IRepository<PermissionGroupDefinitionRecord, Guid> repositoryGroup,
|
|
||||||
IGuidGenerator guidGenerator)
|
|
||||||
{
|
|
||||||
this.repository = repository;
|
|
||||||
this.repositoryGroup = repositoryGroup;
|
|
||||||
this.guidGenerator = guidGenerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
|
||||||
{
|
|
||||||
var permissionGroups = await repositoryGroup.GetListAsync();
|
|
||||||
var permissions = await repository.GetListAsync();
|
|
||||||
var permissionName = "";
|
|
||||||
|
|
||||||
#region TenantManagement
|
|
||||||
if (!permissionGroups.Any(a => a.Name == TenantManagementPermissions.GroupName))
|
|
||||||
{
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = TenantManagementPermissions.GroupName,
|
|
||||||
DisplayName = TenantManagementPermissions.GroupName,
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var perm in TenantManagementPermissions.GetAll())
|
|
||||||
{
|
|
||||||
if (TenantManagementPermissions.GroupName != perm)
|
|
||||||
{
|
|
||||||
if (permissions.Any(a => a.GroupName == TenantManagementPermissions.GroupName && a.Name == perm))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pos = perm.LastIndexOf('.');
|
|
||||||
var parent = pos > 0 ? perm.Substring(0, pos) : null;
|
|
||||||
var name = perm.Substring(pos + 1);
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
TenantManagementPermissions.GroupName,
|
|
||||||
perm,
|
|
||||||
CUDE.Contains(name) ? name : perm,
|
|
||||||
parent == TenantManagementPermissions.GroupName ? null : parent,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tenant Management - Export
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
TenantManagementPermissions.GroupName,
|
|
||||||
TenantManagementPermissions.Tenants.Default + ".Export",
|
|
||||||
CUDE[3],
|
|
||||||
TenantManagementPermissions.Tenants.Default,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region AbpIdentity
|
|
||||||
if (!permissionGroups.Any(a => a.Name == IdentityPermissions.GroupName))
|
|
||||||
{
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = IdentityPermissions.GroupName,
|
|
||||||
DisplayName = IdentityPermissions.GroupName,
|
|
||||||
});
|
|
||||||
|
|
||||||
List<PermissionDefinitionRecord> entityKeys = [];
|
|
||||||
foreach (var perm in IdentityPermissions.GetAll())
|
|
||||||
{
|
|
||||||
if (IdentityPermissions.GroupName != perm)
|
|
||||||
{
|
|
||||||
if (permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == perm))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pos = perm.LastIndexOf('.');
|
|
||||||
var parent = pos > 0 ? perm.Substring(0, pos) : null;
|
|
||||||
var name = perm.Substring(pos + 1);
|
|
||||||
|
|
||||||
entityKeys.Add(GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
perm,
|
|
||||||
CUDE.Contains(name) ? name : perm,
|
|
||||||
parent == IdentityPermissions.GroupName ? null : parent));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await repository.InsertManyAsync(entityKeys);
|
|
||||||
|
|
||||||
//AbpIdentity.Users - Export
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
IdentityPermissions.Users.Default + ".Export",
|
|
||||||
CUDE[3],
|
|
||||||
IdentityPermissions.Users.Default));
|
|
||||||
|
|
||||||
//AbpIdentity.Roles - Export
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
IdentityPermissions.Roles.Default + ".Export",
|
|
||||||
CUDE[3],
|
|
||||||
IdentityPermissions.Roles.Default));
|
|
||||||
}
|
|
||||||
|
|
||||||
//AbpIdentity.PermissionGroups
|
|
||||||
if (!permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == AbpIdentity.Permissions.Default))
|
|
||||||
{
|
|
||||||
var permPermissionGroupManagement = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
AbpIdentity.PermissionGroups.Default,
|
|
||||||
AbpIdentity.PermissionGroups.Default,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AbpIdentity.PermissionGroups.Default + "." + item;
|
|
||||||
|
|
||||||
if (permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == permissionName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permPermissionGroupManagement.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//AbpIdentity.Permissions
|
|
||||||
if (!permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == AbpIdentity.Permissions.Default))
|
|
||||||
{
|
|
||||||
var permPermissionManagement = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
AbpIdentity.Permissions.Default,
|
|
||||||
AbpIdentity.Permissions.Default,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AbpIdentity.Permissions.Default + "." + item;
|
|
||||||
|
|
||||||
if (permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == permissionName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permPermissionManagement.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//AbpIdentity.Ous
|
|
||||||
if (!permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == AbpIdentity.OrganizationUnits.Default))
|
|
||||||
{
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
AbpIdentity.OrganizationUnits.Default,
|
|
||||||
AbpIdentity.OrganizationUnits.Default
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Ip Restrictions
|
|
||||||
if (!permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == AppCodes.IpRestrictions))
|
|
||||||
{
|
|
||||||
var permIpRestrictions = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
AppCodes.IpRestrictions,
|
|
||||||
AppCodes.IpRestrictions
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.IpRestrictions + "." + item;
|
|
||||||
|
|
||||||
if (permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == permissionName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permIpRestrictions.Name
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Security Logs
|
|
||||||
if (!permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == AppCodes.IdentityPermissions.Users.SecurityLogs))
|
|
||||||
{
|
|
||||||
var permSecurityLogs = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
AppCodes.IdentityPermissions.Users.SecurityLogs,
|
|
||||||
AppCodes.IdentityPermissions.Users.SecurityLogs
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.IdentityPermissions.Users.SecurityLogs + "." + item;
|
|
||||||
|
|
||||||
if (permissions.Any(a => a.GroupName == IdentityPermissions.GroupName && a.Name == permissionName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
IdentityPermissions.GroupName,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permSecurityLogs.Name
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Platform
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = SeedConsts.Platform,
|
|
||||||
DisplayName = SeedConsts.Platform
|
|
||||||
});
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Settings
|
|
||||||
var groupName = AppCodes.Setting;
|
|
||||||
|
|
||||||
if (!await repositoryGroup.AnyAsync(a => a.Name == groupName))
|
|
||||||
{
|
|
||||||
var group = await repositoryGroup.InsertAsync(
|
|
||||||
new PermissionGroupDefinitionRecord(
|
|
||||||
guidGenerator.Create(),
|
|
||||||
AppCodes.Setting,
|
|
||||||
AppCodes.Setting));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await repositoryGroup.AnyAsync(a => a.Name == AppCodes.Setting))
|
|
||||||
return;
|
|
||||||
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AppCodes.Setting, AppCodes.Setting));
|
|
||||||
|
|
||||||
#region Site_Management
|
|
||||||
var permSiteManagement = await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.SiteManagement.GroupName, AbpSettings.SiteManagement.GroupName));
|
|
||||||
|
|
||||||
//General
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.SiteManagement.General.Default, AbpSettings.SiteManagement.General.Default, permSiteManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
|
|
||||||
//Theme
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.SiteManagement.Theme.Default, AbpSettings.SiteManagement.Theme.Default, permSiteManagement.Name));
|
|
||||||
|
|
||||||
//Localization
|
|
||||||
var permLocalization = await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.AbpLocalization.GroupName, AbpSettings.AbpLocalization.GroupName, permSiteManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Sender
|
|
||||||
var permSender = await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Sender.GroupName, AbpSettings.Sender.GroupName));
|
|
||||||
|
|
||||||
//Sms
|
|
||||||
var permSms = await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Sender.Sms.Default, AbpSettings.Sender.Sms.Default, permSender.Name));
|
|
||||||
|
|
||||||
//Sms - Posta Güvercini
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Sender.Sms.PostaGuvercini.Default, AbpSettings.Sender.Sms.PostaGuvercini.Default, permSms.Name));
|
|
||||||
|
|
||||||
//Rocket
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Sender.Rocket.Default, AbpSettings.Sender.Rocket.Default, permSender.Name, true, MultiTenancySides.Host));
|
|
||||||
|
|
||||||
//WhatsApp
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Sender.WhatsApp.Default, AbpSettings.Sender.WhatsApp.Default, permSender.Name));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Mailing
|
|
||||||
var permMailing = await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Mailing.GroupName, AbpSettings.Mailing.GroupName));
|
|
||||||
|
|
||||||
//Default
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Mailing.Default.GroupName, AbpSettings.Mailing.Default.GroupName, permMailing.Name));
|
|
||||||
|
|
||||||
//Smtp
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Mailing.Smtp.GroupName, AbpSettings.Mailing.Smtp.GroupName, permMailing.Name));
|
|
||||||
|
|
||||||
//Aws
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpSettings.Mailing.AWS.GroupName, AbpSettings.Mailing.AWS.GroupName, permMailing.Name, true, MultiTenancySides.Host));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Account_Management
|
|
||||||
var permAccountManagement = await repository.InsertAsync(GetNewPermission(groupName, AbpAccount.GroupName, AbpAccount.GroupName));
|
|
||||||
|
|
||||||
//General
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpAccount.General, AbpAccount.General, permAccountManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
|
|
||||||
//Two Factor
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpAccount.TwoFactor, AbpAccount.TwoFactor, permAccountManagement.Name));
|
|
||||||
|
|
||||||
//Captcha
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpAccount.Captcha.Default, AbpAccount.Captcha.Default, permAccountManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Identity_Management
|
|
||||||
var permIdentityManagement = await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.GroupName, AbpIdentity.GroupName));
|
|
||||||
|
|
||||||
//Profile
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.Profile.Default, AbpIdentity.Profile.Default, permIdentityManagement.Name));
|
|
||||||
|
|
||||||
//Password
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.Password.Default, AbpIdentity.Password.Default, permIdentityManagement.Name));
|
|
||||||
|
|
||||||
//Lockout
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.Lockout.Default, AbpIdentity.Lockout.Default, permIdentityManagement.Name));
|
|
||||||
|
|
||||||
//SignIn
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.SignIn.Default, AbpIdentity.SignIn.Default, permIdentityManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
|
|
||||||
//User
|
|
||||||
await repository.InsertAsync(GetNewPermission(groupName, AbpIdentity.User.Default, AbpIdentity.User.Default, permIdentityManagement.Name, true, MultiTenancySides.Host));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region LanguageManagement
|
|
||||||
var permLanguageManagement = await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Languages.Default,
|
|
||||||
DisplayName = AppCodes.Languages.Default
|
|
||||||
});
|
|
||||||
|
|
||||||
var permLanguages = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Languages.Default,
|
|
||||||
AppCodes.Languages.Language,
|
|
||||||
AppCodes.Languages.Language,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Languages.Language + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Languages.Default,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permLanguages.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
var permLanguageTexts = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Languages.Default,
|
|
||||||
AppCodes.Languages.LanguageText,
|
|
||||||
AppCodes.Languages.LanguageText,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Languages.LanguageText + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Languages.Default,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permLanguageTexts.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region MenuManagement
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Menus,
|
|
||||||
DisplayName = AppCodes.Menus
|
|
||||||
});
|
|
||||||
|
|
||||||
var permMenuManagement = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Menus,
|
|
||||||
AppCodes.Menus,
|
|
||||||
AppCodes.Menus,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Menus + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Menus,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permMenuManagement.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ListformManagement
|
|
||||||
var groupListformManagement = await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Listforms.Default,
|
|
||||||
DisplayName = AppCodes.Listforms.Default
|
|
||||||
});
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
AppCodes.Listforms.Wizard,
|
|
||||||
AppCodes.Listforms.Wizard,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
var permDataSources = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
AppCodes.Listforms.DataSource,
|
|
||||||
AppCodes.Listforms.DataSource,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Listforms.DataSource + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.DataSource,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permDataSources.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
var permListforms = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
AppCodes.Listforms.Listform,
|
|
||||||
AppCodes.Listforms.Listform,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Listforms.Listform + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permListforms.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
var permListformFields = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
AppCodes.Listforms.ListformField,
|
|
||||||
AppCodes.Listforms.ListformField,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Listforms.ListformField + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permListformFields.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
var chartManagement = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
AppCodes.Listforms.Chart,
|
|
||||||
AppCodes.Listforms.Chart,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Listforms.Chart + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Listforms.Default,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
chartManagement.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SettingDefinitions
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Settings.SettingDefinitions,
|
|
||||||
DisplayName = AppCodes.Settings.SettingDefinitions
|
|
||||||
});
|
|
||||||
|
|
||||||
var permSettingManagement = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Settings.SettingDefinitions,
|
|
||||||
AppCodes.Settings.SettingDefinitions,
|
|
||||||
AppCodes.Settings.SettingDefinitions,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Settings.SettingDefinitions + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Settings.SettingDefinitions,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permSettingManagement.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region BackgroundWorker
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.BackgroundWorkers,
|
|
||||||
DisplayName = AppCodes.BackgroundWorkers
|
|
||||||
});
|
|
||||||
|
|
||||||
var permBackgroundWorkers = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.BackgroundWorkers,
|
|
||||||
AppCodes.BackgroundWorkers,
|
|
||||||
AppCodes.BackgroundWorkers,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.BackgroundWorkers + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.BackgroundWorkers,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permBackgroundWorkers.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Notifications
|
|
||||||
var permNotificationManagement = await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Notifications.Default,
|
|
||||||
DisplayName = AppCodes.Notifications.Default
|
|
||||||
});
|
|
||||||
|
|
||||||
var permNotificationRules = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Notifications.Default,
|
|
||||||
AppCodes.Notifications.NotificationRules,
|
|
||||||
AppCodes.Notifications.NotificationRules,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Notifications.NotificationRules + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Notifications.NotificationRules,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permNotificationRules.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
var permNotification = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Notifications.Default,
|
|
||||||
AppCodes.Notifications.Notification,
|
|
||||||
AppCodes.Notifications.Notification,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Notifications.Notification + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Notifications.Notification,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permNotification.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Api
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.PublicApis,
|
|
||||||
DisplayName = AppCodes.PublicApis
|
|
||||||
});
|
|
||||||
|
|
||||||
var permPublicApis = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.PublicApis + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permPublicApis.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get Api Permissions
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
AppCodes.PublicApis + ".Get",
|
|
||||||
"Get",
|
|
||||||
permPublicApis.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
//Post Api Permissions
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.PublicApis,
|
|
||||||
AppCodes.PublicApis + ".Post",
|
|
||||||
"Post",
|
|
||||||
permPublicApis.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region GlobalSearch
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Settings.GlobalSearch,
|
|
||||||
DisplayName = AppCodes.Settings.GlobalSearch
|
|
||||||
});
|
|
||||||
|
|
||||||
var permGlobalSearch = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Settings.GlobalSearch,
|
|
||||||
AppCodes.Settings.GlobalSearch,
|
|
||||||
AppCodes.Settings.GlobalSearch,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Settings.GlobalSearch + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Settings.GlobalSearch,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permGlobalSearch.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region AuditLogs
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.AuditLogs,
|
|
||||||
DisplayName = AppCodes.AuditLogs
|
|
||||||
});
|
|
||||||
|
|
||||||
var permAuditLogs = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.AuditLogs,
|
|
||||||
AppCodes.AuditLogs,
|
|
||||||
AppCodes.AuditLogs,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Both
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.AuditLogs + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.AuditLogs,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permAuditLogs.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Both
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Branches
|
|
||||||
await repositoryGroup.InsertAsync(new PermissionGroupDefinitionRecord
|
|
||||||
{
|
|
||||||
Name = AppCodes.Branches,
|
|
||||||
DisplayName = AppCodes.Branches
|
|
||||||
});
|
|
||||||
|
|
||||||
var permBranches = await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Branches,
|
|
||||||
AppCodes.Branches,
|
|
||||||
AppCodes.Branches,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
|
|
||||||
foreach (var item in CUDE)
|
|
||||||
{
|
|
||||||
permissionName = AppCodes.Branches + "." + item;
|
|
||||||
|
|
||||||
await repository.InsertAsync(
|
|
||||||
GetNewPermission(
|
|
||||||
AppCodes.Branches,
|
|
||||||
permissionName,
|
|
||||||
item,
|
|
||||||
permBranches.Name,
|
|
||||||
true,
|
|
||||||
MultiTenancySides.Host
|
|
||||||
));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PermissionDefinitionRecord GetNewPermission(
|
|
||||||
string groupName,
|
|
||||||
string name,
|
|
||||||
string displayName,
|
|
||||||
string parentName = null,
|
|
||||||
bool isEnabled = true,
|
|
||||||
MultiTenancySides multiTenancySides = MultiTenancySides.Both)
|
|
||||||
{
|
|
||||||
return new PermissionDefinitionRecord(Guid.NewGuid(),
|
|
||||||
groupName,
|
|
||||||
name,
|
|
||||||
parentName,
|
|
||||||
displayName,
|
|
||||||
isEnabled,
|
|
||||||
multiTenancySides
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Kurs.Languages.Entities;
|
using Kurs.Languages.Entities;
|
||||||
|
using Kurs.Notifications.Entities;
|
||||||
using Kurs.Platform.Charts.Dto;
|
using Kurs.Platform.Charts.Dto;
|
||||||
using Kurs.Platform.Entities;
|
using Kurs.Platform.Entities;
|
||||||
using Kurs.Platform.Enums;
|
using Kurs.Platform.Enums;
|
||||||
|
|
@ -15,6 +16,7 @@ using Microsoft.Extensions.Configuration;
|
||||||
using Volo.Abp.Data;
|
using Volo.Abp.Data;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
|
using Volo.Abp.PermissionManagement;
|
||||||
using static Kurs.Settings.SettingsConsts;
|
using static Kurs.Settings.SettingsConsts;
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
namespace Kurs.Platform.Data.Seeds;
|
||||||
|
|
@ -27,6 +29,12 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
private readonly IRepository<DataSource, Guid> _dataSources;
|
private readonly IRepository<DataSource, Guid> _dataSources;
|
||||||
private readonly IRepository<SettingDefinition, Guid> _settings;
|
private readonly IRepository<SettingDefinition, Guid> _settings;
|
||||||
private readonly IRepository<Chart> _charts;
|
private readonly IRepository<Chart> _charts;
|
||||||
|
private readonly IRepository<GlobalSearch, int> _globalSearch;
|
||||||
|
private readonly IRepository<BackgroundWorker, Guid> _backgroundWorkerRepository;
|
||||||
|
private readonly IRepository<NotificationRule, Guid> _notificationRuleRepository;
|
||||||
|
private readonly IRepository<Menu, Guid> _menuRepository;
|
||||||
|
private readonly IRepository<PermissionGroupDefinitionRecord, Guid> _permissionGroupRepository;
|
||||||
|
private readonly IRepository<PermissionDefinitionRecord, Guid> _permissionRepository;
|
||||||
|
|
||||||
public PlatformDataSeeder(
|
public PlatformDataSeeder(
|
||||||
IRepository<Language, Guid> languages,
|
IRepository<Language, Guid> languages,
|
||||||
|
|
@ -34,7 +42,13 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
IRepository<LanguageText, Guid> languagesText,
|
IRepository<LanguageText, Guid> languagesText,
|
||||||
IRepository<DataSource, Guid> dataSource,
|
IRepository<DataSource, Guid> dataSource,
|
||||||
IRepository<SettingDefinition, Guid> settings,
|
IRepository<SettingDefinition, Guid> settings,
|
||||||
IRepository<Chart> charts)
|
IRepository<Chart> charts,
|
||||||
|
IRepository<GlobalSearch, int> globalSearch,
|
||||||
|
IRepository<BackgroundWorker, Guid> backgroundWorkerRepository,
|
||||||
|
IRepository<NotificationRule, Guid> notificationRuleRepository,
|
||||||
|
IRepository<Menu, Guid> menuRepository,
|
||||||
|
IRepository<PermissionGroupDefinitionRecord, Guid> permissionGroupRepository,
|
||||||
|
IRepository<PermissionDefinitionRecord, Guid> permissionRepository)
|
||||||
{
|
{
|
||||||
_languages = languages;
|
_languages = languages;
|
||||||
_languageKey = languageKey;
|
_languageKey = languageKey;
|
||||||
|
|
@ -42,6 +56,12 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
_dataSources = dataSource;
|
_dataSources = dataSource;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
_charts = charts;
|
_charts = charts;
|
||||||
|
_globalSearch = globalSearch;
|
||||||
|
_backgroundWorkerRepository = backgroundWorkerRepository;
|
||||||
|
_notificationRuleRepository = notificationRuleRepository;
|
||||||
|
_menuRepository = menuRepository;
|
||||||
|
_permissionGroupRepository = permissionGroupRepository;
|
||||||
|
_permissionRepository = permissionRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IConfigurationRoot BuildConfiguration()
|
private static IConfigurationRoot BuildConfiguration()
|
||||||
|
|
@ -202,5 +222,110 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.GlobalSearch)
|
||||||
|
{
|
||||||
|
if (!await _globalSearch.AnyAsync(x => x.System == item.System && x.Group == item.Group && x.Term == item.Term))
|
||||||
|
{
|
||||||
|
await _globalSearch.InsertAsync(new GlobalSearch
|
||||||
|
{
|
||||||
|
System = item.System,
|
||||||
|
Group = item.Group,
|
||||||
|
Term = item.Term,
|
||||||
|
Weight = item.Weight,
|
||||||
|
Url = item.Url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.BackgroundWorkers)
|
||||||
|
{
|
||||||
|
if (!await _backgroundWorkerRepository.AnyAsync(x => x.Name == item.Name))
|
||||||
|
{
|
||||||
|
await _backgroundWorkerRepository.InsertAsync(new BackgroundWorker
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
Cron = item.Cron,
|
||||||
|
WorkerType = Enum.Parse<WorkerTypeEnum>(item.WorkerType),
|
||||||
|
IsActive = item.IsActive,
|
||||||
|
DataSourceCode = item.DataSourceCode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.NotificationRules)
|
||||||
|
{
|
||||||
|
var exists = await _notificationRuleRepository.AnyAsync(x =>
|
||||||
|
x.NotificationType == item.NotificationType &&
|
||||||
|
x.RecipientType == item.RecipientType &&
|
||||||
|
x.RecipientId == item.RecipientId &&
|
||||||
|
x.Channel == item.Channel);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
await _notificationRuleRepository.InsertAsync(new NotificationRule
|
||||||
|
{
|
||||||
|
NotificationType = item.NotificationType,
|
||||||
|
RecipientType = item.RecipientType,
|
||||||
|
RecipientId = item.RecipientId,
|
||||||
|
Channel = item.Channel,
|
||||||
|
IsActive = item.IsActive,
|
||||||
|
IsFixed = item.IsFixed,
|
||||||
|
IsCustomized = item.IsCustomized
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.Menus)
|
||||||
|
{
|
||||||
|
var exists = await _menuRepository.AnyAsync(x => x.Code == item.Code);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
await _menuRepository.InsertAsync(new Menu
|
||||||
|
{
|
||||||
|
ParentCode = string.IsNullOrWhiteSpace(item.ParentCode) ? null : item.ParentCode,
|
||||||
|
Code = item.Code,
|
||||||
|
DisplayName = item.DisplayName,
|
||||||
|
Order = item.Order,
|
||||||
|
Url = item.Url,
|
||||||
|
Icon = item.Icon,
|
||||||
|
RequiredPermissionName = item.RequiredPermissionName,
|
||||||
|
IsDisabled = item.IsDisabled
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.PermissionGroupDefinitionRecords)
|
||||||
|
{
|
||||||
|
var exists = await _permissionGroupRepository.AnyAsync(x => x.Name == item.Name);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
await _permissionGroupRepository.InsertAsync(new PermissionGroupDefinitionRecord
|
||||||
|
{
|
||||||
|
Name = item.Name,
|
||||||
|
DisplayName = item.DisplayName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in items.PermissionDefinitionRecords)
|
||||||
|
{
|
||||||
|
var exists = await _permissionRepository.AnyAsync(x => x.Name == item.Name);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
await _permissionRepository.InsertAsync(new PermissionDefinitionRecord
|
||||||
|
{
|
||||||
|
GroupName = item.GroupName,
|
||||||
|
Name = item.Name,
|
||||||
|
ParentName = string.IsNullOrWhiteSpace(item.ParentName) ? null : item.ParentName,
|
||||||
|
DisplayName = item.DisplayName,
|
||||||
|
IsEnabled = item.IsEnabled,
|
||||||
|
MultiTenancySide = item.MultiTenancySide
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -12,10 +12,16 @@ public class SeederDto
|
||||||
{
|
{
|
||||||
public List<Language> Languages { get; set; }
|
public List<Language> Languages { get; set; }
|
||||||
public List<LanguageTextsSeedDto> LanguageTexts { get; set; }
|
public List<LanguageTextsSeedDto> LanguageTexts { get; set; }
|
||||||
public List<PermissionDefinitionRecord> Permissions { get; set; }
|
|
||||||
public List<DataSource> DataSources { get; set; }
|
public List<DataSource> DataSources { get; set; }
|
||||||
public List<SettingDefinition> Settings { get; set; }
|
public List<SettingDefinition> Settings { get; set; }
|
||||||
public List<ChartsSeedDto> Charts { get; set; }
|
public List<ChartsSeedDto> Charts { get; set; }
|
||||||
|
public List<GlobalSearchDto> GlobalSearch { get; set; }
|
||||||
|
public List<BackgroundWorkerDto> BackgroundWorkers { get; set; }
|
||||||
|
public List<NotificationRuleDto> NotificationRules { get; set; }
|
||||||
|
public List<MenuDto> Menus { get; set; }
|
||||||
|
public List<PermissionGroupDefinitionRecordDto> PermissionGroupDefinitionRecords { get; set; }
|
||||||
|
public List<PermissionDefinitionRecord> PermissionDefinitionRecords { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChartsSeedDto
|
public class ChartsSeedDto
|
||||||
|
|
@ -42,4 +48,59 @@ public class LanguageTextsSeedDto
|
||||||
public string Tr { get; set; }
|
public string Tr { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GlobalSearchDto
|
||||||
|
{
|
||||||
|
public string System { get; set; }
|
||||||
|
public string Group { get; set; }
|
||||||
|
public string Term { get; set; }
|
||||||
|
public string Weight { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BackgroundWorkerDto
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Cron { get; set; }
|
||||||
|
public string WorkerType { get; set; }
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
public string DataSourceCode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NotificationRuleDto
|
||||||
|
{
|
||||||
|
public string NotificationType { get; set; }
|
||||||
|
public string RecipientType { get; set; }
|
||||||
|
public string RecipientId { get; set; }
|
||||||
|
public string Channel { get; set; }
|
||||||
|
public bool IsActive { get; set; }
|
||||||
|
public bool IsFixed { get; set; }
|
||||||
|
public bool IsCustomized { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MenuDto
|
||||||
|
{
|
||||||
|
public string ParentCode { get; set; }
|
||||||
|
public string Code { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public int Order { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Icon { get; set; }
|
||||||
|
public string RequiredPermissionName { get; set; }
|
||||||
|
public bool IsDisabled { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PermissionGroupDefinitionRecordDto
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PermissionDefinitionRecordDto
|
||||||
|
{
|
||||||
|
public string GroupName { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string ParentName { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public bool IsEnabled { get; set; }
|
||||||
|
public int MultiTenancySide { get; set; }
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue