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.
There should be
FakeCurrentPrincipalAccessor.cs
file in yourTestBase
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:
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.
There are few other new requirements including the above requirements as below :
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
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 ?
Hi @liangshiwei
AbpClaimTypes Config and Mapping was missing from InvoiceModule. After comparing it with ProfileModule I found this issue.
Its working fine now. Finally closing this issue :)
Thanks !!!
@liangshiwei
Sorry to reopen this issue, In my InvoiceManagement module, I am getting all the permission true in my PermissionGrantRepository output, But still I am getting Authorization error.
I have already done all the check's which I could possibly do.
- My all db's are connected to same env i.e. dev
- MultiTenancy is enabled
- Redis is working fine
One thing I noticed though i.e.In InvoiceManagement module I have made a class MyPermissionStore : PermissionStore
, Even if I have the breakpoint here my debugger never stop's here.
And In log.txt I am not able to find any cache log where my pn:R,pk:Supplier,n:InvoiceManagement.xxx
For Role supplier, I can find data in Redis.Studio but not able to find in log's
@liangshiwei
Sorry to reopen this issue, In my InvoiceManagement module, I am getting all the permission true in my PermissionGrantRepository output, But still I am getting Authorization error.
I have already done all the check's which I could possibly do.
Hi,
I remember you don't want to user redis, however, we can make a meeting tomorrow
As I said before, We want to close this issue in the given timeline so we have to implement whatever solution available. Thanks for the meeting though. I will drop you a mail tomorrow.
Thanks again.