Hi, can you share the OnPost method of your CreateModal.cshtml file?
Hi @Shoba24, I think you need to use the UserFriendlyException
(https://docs.abp.io/en/abp/4.4/Exception-Handling#user-friendly-exception).
Hi @kresimirm,
If my current user is in two roles "Role1" and "Role2" currentUser.Roles will return string[] that contains one record with stringified '["Role1","Role2"]' so I will have to split or deserialize that string to check if user is in "Role1".
Furthermore, if user is just in one role currentUser.Roles will retrurn "RoleName" as simple string record so your code wont work again becasue it will compare "Role1" with '["Role1","Role2"]' .
.Any
instead of .All
method of Linq in the previous answer, sorry for the misunderstanding. You can use the following code-snippet.public static class CurrentUserExtensions
{
public static bool IsInSpecifiedRoles(this ICurrentUser currentUser, string[] roles)
{
var userRoles = currentUser.Roles;
return userRoles.All(userRole => roles.Contains(userRole));
}
}
IsInRole
method of ICurrentUser
, Otherwise you can use the above code-snippet to check the current user has the all roles that you've specified or not. Or you can implement your own logic for other use-cases.Hi @Neozzz, I will send you the steps to be done via email as soon as possible. If the last changes resolved your problem you can close this question. I will inform you via email.
Hi @Spospisil, you need to override LogoReverseUrl
in YourProjectBrandingProvider
on your *.Web layer.
[Dependency(ReplaceServices = true)]
public class YourProjectBrandingProvider : DefaultBrandingProvider
{
public override string AppName => "YourProjectName";
public override string LogoReverseUrl => "/images/logo/abp-purple.png"; //override LogoReverseUrl
}
I've added an image under wwwroot/images/logo named abp-purple.png. And I've also cleared the cache to see the result.
There are some restrictions to implement impersonation for Blazor WASM.
Related issue: https://github.com/abpframework/abp/issues/9997
Hi @kresimirm, There can be more than one value for Role claim (AbpClaimTypes.Role
).
A claims identity can have multiple claims with the same ClaimType.
AbpClaimTypes.Role
in our situation.
ICurrentUser
interface to get all distinct role names. And then you can create an extension method to query the user is in multiple roles or not like below.public static class CurrentUserExtensions
{
public static bool IsInSpecifiedRoles(this ICurrentUser currentUser, string[] roles)
{
var userRoles = currentUser.Roles;
return userRoles.All(userRole => roles.Contains(userRole));
}
}
I can see you've released 4.4.3. Could you tell me whether this version contains impersonation feature for Angular?
Hi @rafal.woznicki, I'm sorry this feature is not included in 4.4.3. because the PR is still under review.
Hi @Neozz, I've made one small change to the code and create a PR. Please examine it, it should be fixed now.
Can you share the relevant logs?