hi i have multi modules project each module has his own permissions and seeder so i want when creating new tenant create two roles by default with specific permissions
i achieved creating roles but permissions no i get the code which give them all permissions
var multiTenancySide = CurrentTenant.GetMultiTenancySide();
var allPermissionNames = (await PermissionDefinitionManager.GetPermissionsAsync())
.Where(p => p.MultiTenancySide.HasFlag(multiTenancySide))
.Select(p => p.Name)
.ToArray();
i created new array and put my permissions within it ===> not work i get all permission then filter them ===> not work here is my code
using Horizon.CoreSetting;
using Horizon.EInvoice;
using Horizon.HRMS1;
using Horizon.Inventory;
using Horizon.MainAccounting;
using Horizon.POS;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using System;
using System.Linq;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
namespace Horizon.HorizonERP.ERP
{
public class ERPDataSeedContributor : IDataSeedContributor, ITransientDependency
{
protected IGuidGenerator GuidGenerator { get; }
protected IIdentityRoleRepository RoleRepository { get; }
protected IIdentityUserRepository UserRepository { get; }
protected ILookupNormalizer LookupNormalizer { get; }
protected IdentityUserManager UserManager { get; }
protected IdentityRoleManager RoleManager { get; }
protected ICurrentTenant CurrentTenant { get; }
protected IOptions<IdentityOptions> IdentityOptions { get; }
protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
protected IPermissionDataSeeder PermissionDataSeeder { get; }
private readonly InventoryDataSeederContributor _inventoryDataSeederContributor;
private readonly POSDataSeederContributor _POsDataSeederContributor;
public ERPDataSeedContributor(
InventoryDataSeederContributor inventoryDataSeederContributor
IGuidGenerator guidGenerator,
IIdentityRoleRepository roleRepository,
IIdentityUserRepository userRepository,
ILookupNormalizer lookupNormalizer,
IdentityUserManager userManager,
IdentityRoleManager roleManager,
ICurrentTenant currentTenant,
IOptions<IdentityOptions> identityOptions,
IPermissionDefinitionManager permissionDefinitionManager,
IPermissionDataSeeder permissionDataSeeder)
{
GuidGenerator = guidGenerator;
RoleRepository = roleRepository;
UserRepository = userRepository;
LookupNormalizer = lookupNormalizer;
UserManager = userManager;
RoleManager = roleManager;
CurrentTenant = currentTenant;
IdentityOptions = identityOptions;
PermissionDefinitionManager = permissionDefinitionManager;
PermissionDataSeeder = permissionDataSeeder;
_inventoryDataSeederContributor = inventoryDataSeederContributor;
_POsDataSeederContributor = pOsDataSeederContributor;
}
[UnitOfWork]
public async Task SeedAsync(DataSeedContext context)
{
await _inventoryDataSeederContributor.SeedAsync(context);
await _POsDataSeederContributor.SeedAsync(context);
var tenantId = context.TenantId;
using (CurrentTenant.Change(tenantId))
{
await IdentityOptions.SetAsync();
// "Accounting" and "Cashier" roles
const string accRoleName = "Accounting";
const string cashRoleName = "Cashier";
var accRoleNameRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(accRoleName));
if (accRoleNameRole == null)
{
accRoleNameRole = new Volo.Abp.Identity.IdentityRole(GuidGenerator.Create(), accRoleName, tenantId)
{
IsPublic = true
};
(await RoleManager.CreateAsync(accRoleNameRole)).CheckErrors();
}
var cashRoleNameRole = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName(cashRoleName));
if (cashRoleNameRole == null)
{
cashRoleNameRole = new Volo.Abp.Identity.IdentityRole(GuidGenerator.Create(), cashRoleName, tenantId)
{
IsPublic = true
};
(await RoleManager.CreateAsync(cashRoleNameRole)).CheckErrors();
}
//var user = await UserRepository.FindAsync(tenantId.Value);//your user id
//(await UserManager.AddToRoleAsync(user, accRoleName)).CheckErrors();
//(await UserManager.AddToRoleAsync(user, cashRoleName)).CheckErrors();
var multiTenancySide = CurrentTenant.GetMultiTenancySide();
var allPermissionNames = (await PermissionDefinitionManager.GetPermissionsAsync())
.Where(p => p.MultiTenancySide.HasFlag(multiTenancySide))
.Select(p => p.Name)
.ToArray();
var accPermissions = new[]
{
"AccountIntegrations.Create",
"AccountIntegrations.Edit",
"AccountIntegrations.Delete",
};
await PermissionDataSeeder.SeedAsync(
RolePermissionValueProvider.ProviderName,
accRoleName,
accPermissions,
context?.TenantId
//allPermissionNames,
);
var cashPermissions = new[]
{
"BasketReturn.Create"
};
await PermissionDataSeeder.SeedAsync(
RolePermissionValueProvider.ProviderName,
cashRoleName,
cashPermissions,
context?.TenantId
//allPermissionNames,
);
}
}
}
}
thank you it works appreciate your efforts
import { Environment } from '@abp/ng.core';
const baseUrl = 'http://posmini.devtest.sale-erp.com';
const oAuthConfig = { issuer: 'https://devtest.sale-erp.com/', redirectUri: baseUrl, clientId: 'HorizonERP_App', responseType: 'code', scope: 'offline_access HorizonERP', requireHttps: true, };
export const environment = { production: true, application: { baseUrl, name: 'HorizonERP', }, oAuthConfig, apis: { default: { url: 'https://devtest.sale-erp.com', rootNamespace: 'HorizonERP', }, AbpAccountPublic: { url: oAuthConfig.issuer, rootNamespace: 'AbpAccountPublic', }, } } as Environment;
Hi all steps and all configurations that make angular work is in images i mentioned is there a steps i miss ?
hi can you check this video
https://files.fm/u/95cg4yru4z
hi is there another place should i change the title my be within backend project or specific configuration should i do? any thing i miss to solve this issue ? as you saw in the screens so what should i do?
hi i have multi module project 1- i created module (core) , (items) 2- created core => company page with logic , items => product page with logic 3- now i have already bult-in tenant page i want to transfer these pages to tenant page to be in one model so i faced this error i mentioned before tenant page can not read any properties from another modules
finally i want to create wizard component like this (if you can share code of it) https://x.leptontheme.com/side-menu/custom-pages/wizard-horizontal
but each steps of them hold page from another module how to do that