Activities of "lalitChougule"

  • 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:
2021-05-14 14:14:46.482 +05:30 [ERR] One or more errors occurred. (ValueFactory attempted to access the Value property of this instance.)
System.AggregateException: One or more errors occurred. (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)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at SCV.Litmus.Permissions.AccessPermissionDefinitionProvider.GetRoles() in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\AccessPermissionDefinitionProvider.cs:line 35
   at SCV.Litmus.Permissions.AccessPermissionDefinitionProvider.Define(IPermissionDefinitionContext context) in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\AccessPermissionDefinitionProvider.cs:line 25
   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.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;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.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  • Steps to reproduce the issue: As below

I was trying to get dynamic value in PermissionDefinitionProvider below is the source code :

public class AccessPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        private readonly ISomeAppService _someAppService;

        public AccessPermissionDefinitionProvider(ISomeAppService someAppService)
        {
            _someAppService = someAppService;
        }
        
        public override void Define(IPermissionDefinitionContext context)
        {
            var myGroup = context.AddGroup("XYZAccessControl", L("Permission:XYZAccessControl"));
            var somePermission = myGroup.AddPermission("XYZBased", L("Permission:XYZ"));
            var fetchedData = GetData();
            foreach (var item in fetchedData)
            {
                somePermission.AddChild(item);
            }

        }

        private string[] GetData()
        {
            var data = _someAppService.GetSomeData().Result; //Just because await throws error here.
            return data.select(x=> x.someValue).Distinct().ToArray();
        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create&lt;XYZResource&gt;(name);
        }
    }

I cannot run the project as the above error is shown.

REQUIREMENT :

  1. I want to show dyanmic created values in PermissionManagement screen which are created on the go.I cannot explain the whole use case here but assume that these selected permission are to be used only and only at backend.
  2. While I tried returning GetData() with hardcode value it work's as per my expectation but the count is not increased/decreased once I select the permission from the permission tree. Not able to find how it works.

Please provide correct approach to achieve this, If I am doing it in a wrong way. I need to achieve this as this is the mandatory requirement for my project.

  • 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 have a requirement where my user should be prompted or redirected to change password screen after every 90 days. How can this be achieved ?

There should be FakeCurrentPrincipalAccessor.cs file in your TestBase project, we use it to mock user.

Also for data seeding, please check this documentation: https://docs.abp.io/en/abp/latest/Testing#the-seed-data

I got it GetPrincipal() method, but it has main admin. How do I use it in my case. I need to create more than 3-4 Unit test where each method have different login user with different case.

[Fact]
public async CheckForUser_1()
{
    using(user_1 logged in)
    {
        //my code
    }
}

[Fact]
public async CheckForUser_2()
{
    using(user_2 logged in)
    {
        //my code
    }
}

[Fact]
public async CheckForUser_3()
{
    using(user_3 logged in)
    {
        //my code
    }
}

[Fact]
public async CheckForUser_4()
{
    using(user_4 logged in)
    {
        //my code
    }
}

So where I have used using(user_1 logged in ) how can I use the method you mentioned ?

Hi @cotur,

I will try that. Please provide me solution for my second point as well.

User cases :

I have 2 users (user_1 and user_2), when I log with user_1 and create another user I check if my user is created by user_1 then I have some different action/code to be executed, and if my user_2 login I have to perform different action/code.This is just an example, but I hope u got my point.

Basic Requirement in Unit Test

I need to know how to I write test case where my user_1 is logged in and where my user_2 is logged in. And how do I seed IdentityUser i.e. AbpUsers table in test env with user_1 and user_2 details because as what I have learned there are more than one tables are involved as below:

  1. AbpUsers
  2. AbpUserRoles
  3. AbpRoles

etc etc How to I seed the above tables with my data.

Thanks

Hi @alper,

Thanks for the response.

I implemented your second approach, I customized code for the mentioned methods. It was just a POC for now, but in near future I have to develop full functionality. For now it's kinda configured via appsetting.json approach like if RoleA log's in he ill be able to see user's only under RoleA or which ever role the user is associated with. I want to make it more dynamic.

appsetting.json

"UserAccessControl": {
    "FetchUsersByClaims": [
      "SupplierAdmin"
    ],
    "UserCreationWithClaims": [
      "SupplierAdmin"
    ],
    "FetchUsersByRoles": {
      "admin": "AnchorAdmin",
      "AnchorAdmin": "SellerAdmin",
      "SupplierAdmin": "Supplier",
      "SellerAdmin": "Seller"
    },
    "CannotEditUserWithRoles": {
      "AnchorAdmin": "AnchorAdmin"
    },
    "CannotDeleteUserWithRoles": {
      "AnchorAdmin": "AnchorAdmin,SupplierAdmin"
    }
  }

Here as u see my config file in UserAccessControl a section called FetchUsersByRoles, here I have mentioned which If my logged in use if of role admin he can only get users of role AnchorAdmin.Likewise other sections.

This is where my config file have control, I want to give this control to my Admin user. I want to generate a screen and allow Admin himself to have a control over this.And in future we add new roles to our system, we can have control over them as well.

If you can simply proved any better approach to manage this requirement will be very helpfull.

  • 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 have do some code change in IdentityUserAppService, IdentityRoleAppService and ProfileAppService by overridding few methods. Now I want to do Unit Testing of the overridden methods, How do I do it ? Difficulty facing while writing Unit Testing :

  1. While overridding I haven't created any Interface for my OverriddenAppService class, So in constructor if I user this code block _userAppService = GetRequiredService<IIdentityUserAppService>(); this means I am refering to IIdentityUserAppService Methods not my overridden methods right ?
  2. I have created few custom stuff i.e. if my role say some AnchorAdmin roles logges in user can see only user with same Roles etc. etc. The main problem is how do I seed my testing db with the user details I am playing around with, and then how do I log in with different users to fetch customized data.

In short In my code block I have to fake my login with a particular user as my method have this kind code : For example as below :

public virtual async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
    var user = new IdentityUser(
            GuidGenerator.Create(),
            input.UserName,
            input.Email,
            CurrentTenant.Id
        );

    if (logged in with user : xyz@abc.com) //then only I have to map extra properties other wise I dont have to map it
    {
         input.MapExtraPropertiesTo(user);
    }

    (await UserManager.CreateAsync(user, input.Password)).CheckErrors();
    await UpdateUserByInput(user, input);

    await CurrentUnitOfWork.SaveChangesAsync();

    return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
}

So in order to test this kind of code I have to create a session where my xyz@abc.com user is logged in, then and then only I can check my code block right ?

Please help !!!

There are few other new requirements including the above requirements as below :

  • The table in which we get user details in Administrator -> Identity -> User screen, currently we can see Action , UserName , EmailAddress and PhoneNumber. I want Action, UserName, RoleName of User, EmailAddress.
  • In the permission tree can we disable any permission check box as per roles, for example I have a role called Supplier and SupplierAdmin, So while my SupplierAdmin is creating any user of role Supplier he should be able to see all permission but few check box should be disabled, so that he cannot check that checkbox even if he wants to.
  • In User/Role table action button can we have any option called view where my user can see same page as edit page but all the fields should be disabled, user cannot edit or save anything.
  • While Creating any user we get password option, Is there any way where we hide that passowrd field and set default password for created user and when the user log's in for first time he should be asked to change the password.
  • 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.
  • In Edit page, my user should not be able to change Roles, I mean I need to disabled all Assignable roles checkboxes.

If these are not in abp features please let me know how to achieve this. Please try to answer all the above points and if possible please provide some details or sample code.

Thanks

  • 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

REQUIREMENT #1 I want don't want to show options like Claims, Set Password for my logged user in User tab, similarly for Roles. I have control over Edit and Delete from permission options itself, but I want for other options as well. Please refer to the screenshot for more understanding


REQUIREMENT #2 I dont want to show Organization Units from Create/Edit User as shown below :

How do I do it ?

  • 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

REQUIREMENT

  1. Under a tenant I have few group of users like Anchor, Supplier, Buyer
  2. Each of them should have Admin user like AnchorAdmin, SupplierAdmin, BuyerAdmin
  3. Each of them should be able to create user only for their own group, say SupplierAdmin can create multiple users as Supplier but all the newly created user should not be able to create users, they will not have those rights, same applies for each group
  4. When an admin of a specific group log's in and go to administrator screen he should be able to see the users only within his group i.e AnchorAdmin should be able to see only AnchorUser not other group's user.
  5. GroupAdmin should have the controll over all the permission and role management stuff.
  6. All groups should have complete isolation in terms of not able to see other groups user, permissions , roles etc. etc.
  7. Hierarchy should be as below :
    1. Tenant
      1. Group i.e. (Anchor, Supplier, Buyer)
        1. Admin i.e. (AnchorAdmin, SupplierAdmin, BuyerAdmin)
          1. User_1 i.e. Normal user with only specific set of rights
          2. User_2

I refered to this link https://docs.abp.io/en/abp/3.1/Modules/Organization-Units But not sure how to use it in this specific requirement. Even if there is any other feature of abp which will help me to achieve this functionality can help. Please provide few detail points or examples or docs where I can get complete understanding related to my requirement.

Thanks!!!

Hi @lalitChougule,

Please see the component replacement document. If you have any questions after reading the doc, please ask in detail.

Hi @Mehmet ,

I just want to change the css of the buttons and few colors here and there, for that too I need to replace whole component ?

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