- ABP Framework version: v5.3.3
- UI type: Blazor
- DB provider:MongoDB
I have a microservice backend and WPF as client application. I'm using client proxy for fetching data from backend, my concern is sometimes I'm struggling to find the existing ClientProxies and finding the permissions definition for template services.
- Are there a list of predefined clientproxies for me to have a CRUD for administration area like roles,users, audit logs
- Are there a list of predefined constant string variable for policy names? If so what are the right class or property I should call? Is there a list? (I know that you can get policy names from swagger abpappconfiguration)
- IAuthorizationService is always returning false even if the current logged user is admin
[DependsOn(typeof(AdministrationServiceHttpApiClientModule))]
public class AdministrationServiceWpfModule : AbpModule{
...
}
...
var auth = ServiceCollection.GetRequiredService<IAuthorizationService>();
var result = await auth.IsGrantedAsync("AbpIdentity.Users");
//result is always false
14 Answer(s)
-
0
Hi,
It's been more than 24 hours. I also haven't resolve the issue yet. Is there anyone available to assist?
-
0
hi
I'm using client proxy
What is the client type are you using? Static or dynamic?
https://docs.abp.io/en/abp/latest/API/Static-CSharp-API-Clients https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients
-
0
It's dynamic since I'm using administration, identity http client modules that is using
AddHttpClientProxies
. -
0
Are there a list of predefined clientproxies for me to have a CRUD for administration area like roles,users, audit logs
You just need to use the
AppServices
to CRUD.Are there a list of predefined constant string variable for policy names? If so what are the right class or property I should call? Is there a list? (I know that you can get policy names from swagger abpappconfiguration)
No, They are existing in the
XXX.Application.Constract
modules.IAuthorizationService is always returning false even if the current logged user is admin
Can you try to depends on the
AbpAspNetCoreMvcClientModule
? -
0
-
0
-
0
Can you try to depends on the AbpAspNetCoreMvcClientModule?
Gave me exception:
Autofac.Core.DependencyResolutionException: An exception was thrown while activating CMVPoint.AdministrationService.Wpf.ViewModels.UsersViewModel -> Volo.Abp.Authorization.AbpAuthorizationService -> Microsoft.AspNetCore.Authorization.DefaultAuthorizationHandlerProvider -> λ:Microsoft.AspNetCore.Authorization.IAuthorizationHandler[] -> Volo.Abp.Authorization.PermissionRequirementHandler -> Volo.Abp.AspNetCore.Mvc.Client.RemotePermissionChecker -> Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient' can be invoked with the available services and parameters: Cannot resolve parameter 'Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor' of constructor 'Void .ctor(Volo.Abp.Caching.IDistributedCache`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto], Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy, Volo.Abp.Users.ICurrentUser, Microsoft.AspNetCore.Http.IHttpContextAccessor)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) --- End of inner exception stack trace ---
-
0
hi
I realize you don't need to check permissions in WPF, The
AppService
will check permissions automatically.Also no longer need the
AbpAspNetCoreMvcClientModule
You only need to use the app services to call the method.
-
0
In our case we need to check the permission because we are hiding some controls/navigations if the current user is not granted from a specific policy.
-
0
You can use the
IAbpApplicationConfigurationAppService
and get theApplicationConfigurationDto
Permissions and other info will exist in the DTO,
-
0
What module should I add to depends on?
-
0
-
0
Hi, I did but I got this exception:
Autofac.Core.DependencyResolutionException: An exception was thrown while activating CMVPoint.AdministrationService.Wpf.ViewModels.UsersViewModel. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'CMVPoint.AdministrationService.Wpf.ViewModels.UsersViewModel' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService abpConfig' of constructor 'Void .ctor(CMVPoint.Shared.Wpf.AccessTokenManager, Microsoft.Extensions.Logging.ILogger`1[CMVPoint.AdministrationService.Wpf.ViewModels.UsersViewModel], Volo.Abp.EventBus.Local.ILocalEventBus, Volo.Abp.PermissionManagement.ClientProxies.PermissionsClientProxy, Volo.Abp.Identity.ClientProxies.IdentityUserClientProxy, Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy, Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) --- End of inner exception stack trace ---
-
0