Activities of "Sturla"

Ok I have been looking at this and mabe creating a role and asigning it to the user when he is created is the correct way about doing this.

Here is a working sample for others to follow.

Its still unclear if I should be using IDistributedEventHandler<EntityCreatedEventData<IdentityUser>> or IDistributedEventHandler<EntityCreatedEto<UserEto>>. Seemy question here.

public class RegisteredUserHandler : IDistributedEventHandler<EntityCreatedEventData<IdentityUser>>, ITransientDependency
    {
        private readonly IPermissionManager permissionManager;
        private readonly IdentityUserManager identityUserManager;

        public RegisteredUserHandler(IPermissionManager permissionManager,IdentityUserManager identityUserManager)
        {
            this.permissionManager = permissionManager;
            this.identityUserManager = identityUserManager;
        }

        [UnitOfWork]
        public async Task HandleEventAsync(EntityCreatedEventData<IdentityUser> eventData)
        {            
            // Add the permission to the role
            await permissionManager.SetForRoleAsync("OrdinaryClientRole", "MyPermission.Client", true);
            
            // Add the user to the role. 
            await identityUserManager.AddToRoleAsync(eventData.Entity, "OrdinaryClientRole");
        }
    }`

I will seed the role and add the permissions in one go like shown here.

You are misunderstanding this.

I´m trying to have different menu for a user that is not a Tenant and not Host.

I´m the host and Tenants can register with my system and add content that ordinary users can enjoy (for payment to me that I then monthly dish out to Tentans). The ordinary users need to be able to view collection of content from all the tenants in the system.

Did that explain it?

Hi again!

I did a MVP and settled on a multi-tenancy option but I didn't go into every detail and need some help with this comment

Clients can be normal IdentityUser (AbpUser). They can access products without any issues.

What I need to know is how do I separate the Client (ordinary user) from Tenant/Host? How can I show clients their menu items that are totally different from the Tentan ones? I have been having this discussion on github but remembered that I had asked this question and gotten this comment and now beleve the question belongs here.

This is (I hope) the last puzzle to get my Beta out the door so I hope you can point me in the right direction with this.

p.s I have a separate Identity Servar and have added the Account source module so I can modify it.

Ok thanks to extra pair of eyes from Liangshiwei we spotted nuget package that needed to be replaced by source.

I reccomend that this documentation

"In this case, you typically add the source code of the module to your solution and replace package references by local project references. ABP CLI automates this process for you."

should be updated to

"In this case, you typically add the source code of the module to your solution and replace every package reference in the solution with its corresponding local project references. ABP CLI automates this process for you."

Also this part "ABP CLI automates this process for you." is not correct... the CLI only adds nuget package to (in my case) Volo.Abp.Account.* and adds some properties. It does not add the references to the source code. This part of the CLI could be much much more powerful and would probably save lot of wasted time.

Btw I created a PR to the docs

I whent over this 2x to day and re-read everything I could get my hands (and tried various other things just for sport) with the same result.

I sent you email and would like assistance with this, thank you.

Sorry stil morning here.. wasn´t going to close this so reopening it!

Thank you for the answer but I should maybe have skipped the part of getting the source and running the command because I have the exact same problem with clicking the "Replace packages with source code" button.

So my questions are

  • Should that button just work without me having to do anything else?
  • Should I be able to change code in the login screen (code that is now under the folder modules/Volo.Account.Pro) and it just shows up or do I have to add references to that code?
  • Has this been tested to work with separate identiyserver (where I'm getting my error)

Sorry if I was unclear in my previous question.

I´m trying out the module system by changing source code for the Account module (the login screen).

But I get when running the project I get the following error for the IdentityServer

Here is what I´m doing

  1. run abp add-module Volo.Account.Pro that adds nuget package references to 4 projects (Application,Contracts,Blazor,IdentityServer) and an [DependsOn(typeof(AbpAccountPublicWebModule))] to their respected *Module.cs classes.
  2. I replace the nuget references and add the respected project references of the source code (that is downloaded and added to the solution), at least not adding the source doesn't either reflect my changes.
  3. Run the solution and get the error

So I'm I missing somthing (and is it in the documentation?) or is something broken?

ABP Framework version: v4.3.2 (Suite 4.3.3) UI type: Blazor DB provider: EF Core Identity Server Separated: yes

p.s For others I will probably just follow "Customization Overriding Components" and "How to customize the login page of an ABP Blazor application" to customize the login window since the docs reccoment "If you want to make huge changes or add major features on a pre-built module, but the available extension points are not enough, you can consider to directly work the source code of the depended module" but I'm doing a small change at this time but will probably in the future.

e.s Changes done with "How to customize the login page of an ABP Blazor application" are not reflected in the login screen most likely because I have a separate identiyserver. So now I really need assistance with this!

Stacktrace [09:43:56 FTL] .IdentityServer terminated unexpectedly! System.IO.FileNotFoundException: Could not load file or assembly 'Volo.Abp.Account.Pro.Public.Web, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Volo.Abp.Account.Pro.Public.Web, Version=4.3.2.0, Culture=neutral, PublicKeyToken=null' at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit) at Volo.Abp.Modularity.AbpModuleHelper.FindDependedModuleTypes(Type moduleType) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesResursively(List1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.AddModuleAndDependenciesResursively(List1 moduleTypes, Type moduleType, ILogger logger, Int32 depth) at Volo.Abp.Modularity.AbpModuleHelper.FindAllModuleTypes(Type startupModuleType, ILogger logger) at Volo.Abp.Modularity.ModuleLoader.FillModules(List1 modules, IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.GetDescriptors(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.Modularity.ModuleLoader.LoadModules(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) at Volo.Abp.AbpApplicationBase.LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) at Volo.Abp.AbpApplicationBase..ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action1 optionsAction) at .Startup.ConfigureServices(IServiceCollection services) in C:\Dev...\aspnet-core\src.IdentityServer\Startup.cs:line 10 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at .Program.Main(String[] args) in C:\Dev...\aspnet-core\src.IdentityServer\Program.cs:line 31

C:\Dev...\aspnet-core\src.IdentityServer\bin\Debug\net5.0.IdentityServer.exe (process 13924) exited with code 1.

Ok it works now. The email was checked with permissions but some combination of loging into the main admin and checking the tenant user loggin of and into the tenant it self and restart made this all click. I really tried this all yesterday as well... strange.... but oh well...closing this

Hi

Since this ticket is closed I´m forced to create a new one.

I have the exact problem with Blazor WASM 4.3.2, that the content on the Settings page is missing when logged in as tenant, but the suggested fix in the above ticket doesn´t solve it.

The following code doesn´t seem to do anything when placed (anywhere) in the Define() method in the PermissionDefinitionProvider class

var setting = context.GetPermissionOrNull(SettingManagementPermissions.Emailing);
setting.MultiTenancySide = MultiTenancySides.Both;

Am I missing something?

Here you can see the Settings menu item but totally empty page.

Showing 181 to 190 of 203 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11