Activities of "lalitChougule"

hi @lalitChougule

How can I reproduce your problem?

I am not sure how its happening in my project. May be we can connect and you can have a look.

hi Please share these info.

  • ABP Framework version: vX.X.X
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

ABP Framework version: v3.0.4 UI type: Angular DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): no / yes Exception message and stack trace: N.A Steps to reproduce the issue: N.A

Hi,

I am not able to see security-logs on UI. And even AuditLogs are not visible even after giving permission for same.

Please guide me !!!

Hi @muhammedaltug,

Thanks to answer my queries. I have few more requirement, and few previously unanswered questions and its related to same topic so posting it here itself.

  1. To hide password and username field from user creation form, Can it be done only by replacing the whole component or there is any other way around ? I don't want to replace whole component just for this small change.
  2. Just like what we do on backend i.e. override only particular method of service , can we do same for user.component ? i.e. in angular component ?
  3. Requirement : Once my user is created I want to redirect the user to my custom page.

Can all the above requirements can be done without replacing user.component ? If yes please guide me.

Thanks in advance !!!

Hi,

Why you can't access IIdentityRoleRepository? Can you explain the structure of your project

I think we are trying to access it in Application.Contracts thatz why its not accessible.

My Project structure

Gateway
	MainProject.HttpApi.Host
Microservices
	ProjectA.HttpApi.Host
	ProjectB.HttpApi.Host
	ProjectC.HttpApi.Host -- IdentityServer
	ProjectD.HttpApi.Host
Module
	ProjectA
		scr
			ProjectA.Application
			ProjectA.Application.Contracts
			ProjectA.Domain
			ProjectA.Domain.Shared
			ProjectA.EntityFrameworkCore
			ProjectA.HttpApi
			ProjectA.HttpApiClient
		test
			ProjectA.Application.Tests
			ProjectA.Domain.Tests
			ProjectA.EntityFrameworkCore.Tests
			ProjectA.HttpApiClient.ConsoleTestApp
			ProjectA.TestBase
	ProjectB
		src
			ProjectB.Application
			ProjectB.Application.Contracts
			ProjectB.Domain
			ProjectB.Domain.Shared
			ProjectB.EntityFrameworkCore
			ProjectB.HttpApi
			ProjectB.HttpApiClient
		test
			ProjectB.Application.Tests
			ProjectB.Domain.Tests
			ProjectB.EntityFrameworkCore.Tests
			ProjectB.HttpApiClient.ConsoleTestApp
			ProjectB.TestBase
	ProjectC
		src
			ProjectC.Application
			ProjectC.Application.Contracts
			ProjectC.Domain
			ProjectC.Domain.Shared
			ProjectC.EntityFrameworkCore
			ProjectC.HttpApi
			ProjectC.HttpApiClient
		test
			ProjectC.Application.Tests
			ProjectC.Domain.Tests
			ProjectC.EntityFrameworkCore.Tests
			ProjectC.HttpApiClient.ConsoleTestApp
			ProjectC.TestBase
	ProjectD
		src
			ProjectD.Application
			ProjectD.Application.Contracts
			ProjectD.Domain
			ProjectD.Domain.Shared
			ProjectD.EntityFrameworkCore
			ProjectD.HttpApi
			ProjectD.HttpApiClient
		test
			ProjectD.Application.Tests
			ProjectD.Domain.Tests
			ProjectD.EntityFrameworkCore.Tests
			ProjectD.HttpApiClient.ConsoleTestApp
			ProjectD.TestBase

The code which I am trying to do is in Module of Gateway project.

HI

It depends on where your dynamic permissions are stored. If your application is a monolithic application, you can consider try to inject the repository.

In short, don't call application services, because this will cause an infinite loop.

Ok I got your point. What are the other ways of access roles ? I dont want to access permissions. I want to access all roles.

I am not able to access IIdentityRoleRepository as well as IdentityRoleManager in the above code block.

hi

The application service will try to get all permissions when you call the its method, it will be an infinite loop.

So do not call application service in the Define method.

You can get dynamic permissions through other ways. Async methods are preferred.

Please provide sample code, What are the other ways and what do u mean by Sync methods are preferred ?

  • ABP Framework version: v3.0.4
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace: Unable to cast object of type 'Microsoft.Data.Sqlite.SqliteConnection' to type 'Npgsql.NpgsqlConnection
  • Steps to reproduce the issue: As details below

Hi,

We have created custom repositories for our entities as per https://docs.abp.io/en/abp/latest/Repositories#custom-repositories. In one of our repository we one method which executes postgreSQL function as below :

public async Task<bool> UpdateInvoiceStatusInBulk(InvoiceStatusUpdateBulkDto updateInvoiceList, CancellationToken cancellationToken = default)
        {
            var result = false;
            var data = JsonConvert.SerializeObject(updateInvoiceList);
            await EnsureConnectionOpenAsync(cancellationToken);

            using (var command = CreateCommand("SELECT \"UpdateInvoiceStatus\"(@data)", CommandType.StoredProcedure, new NpgsqlParameter("@data", data)))
            {
               result = (bool)command.ExecuteScalarAsync(cancellationToken).Result;
            }
            
            return result;
        }

Normally this method works fine. But while unit testing for the method which call UpdateInvoiceStatusInBulk method internally gives error i.e. Unable to cast object of type 'Microsoft.Data.Sqlite.SqliteConnection' to type 'Npgsql.NpgsqlConnection This is just because while unit testing we use sqlite db which is provided by framework. I am not able to do testing of the method which internally calls the above method. How do I resolve this issue ?

Hi @maliming

Error Log :

2021-05-27 11:18:46.476 +05:30 [ERR] ValueFactory attempted to access the Value property of this instance.
System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetOrNull(String name)
   at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPolicyAsync(String policyName)
   at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider policyProvider, IEnumerable`1 authorizeData)
   at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
   at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.&lt;Run&gt;b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
   at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
   at Volo.Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
   at SCV.Litmus.Permissions.LitmusPermissionDefinitionProvider.GetRoles() in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\LitmusPermissionDefinitionProvider.cs:line 64
   at SCV.Litmus.Permissions.LitmusPermissionDefinitionProvider.Define(IPermissionDefinitionContext context) in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\LitmusPermissionDefinitionProvider.cs:line 57
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionGroupDefinitions()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionDefinitions()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetPermissions()
   at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPoliciesNamesAsync()
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAuthConfigAsync()
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAsync()
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync()
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

My Code :

public class LitmusPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        protected IServiceProvider _serviceProvider { get; }
        public LitmusPermissionDefinitionProvider(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        public override void Define(IPermissionDefinitionContext context)
        {
            var myGroup = context.AddGroup(LitmusPermissions.GroupName);

            var TestPermissionTestPermission = myGroup.AddPermission("TestRoles");
            var roles = GetRoles();
            foreach (var item in roles)
                TestPermissionTestPermission.AddChild(item);
        }

        private string[] GetRoles()
        {
            var result = AsyncHelper.RunSync(() => _serviceProvider.GetRequiredService<IIdentityRoleAppService>().GetAllListAsync());
            return result.Items.Select(x => x.Name).ToArray();
        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<LitmusResource>(name);
        }
    }

I tried your way, still stuck with same error. If I am doing it wrong way, please provide sample code.

Thanks

Can we use anything other or you can say customised alert message for UserFriendlyException warning box and on UI Information box based on fields for UI validation on user/role pages.:

Can you give more details or screenshots about this?

  • From server side error/warning/information we are using UserFriendlyException, I mean same for everything.Is there any other option available ? Like for informative message we don't wanna show error icon, For success we wanna show green check etc. and is there any way to customize it's height width or position.

  • I don't wanna show Organization Unit (Please refer to my orignal question where I have shared screenshot as well)

In Edit page, my user should not be able to change Roles, I mean I need to disabled all Assignable roles checkboxes.

Please reply to this query as well.

Showing 61 to 70 of 132 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30