Starts in:
0 DAY
14 HRS
27 MIN
44 SEC
Starts in:
0 D
14 H
27 M
44 S

Activities of "EngincanV"

we need to display like this

Hi, sorry for the misunderstanding but you can not trigger a modal like in the above photo. (if you want to trigger it, you need to call the method that throws an exception on the js side).

  • You can use the Alerts to show errors on UI.
public async Task <IActionResult> OnPostAsync() 
{
    try 
    {
       //your code
    }
    catch(Exception ex) 
    {
       Alerts.Danger(ex.Message); //for other alert types see https://docs.abp.io/en/abp/4.4/UI/AspNetCore/Page-Alerts#alert-types
    }
    
    return Redirect("/PurchaseOrders");
}

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).

Answer

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".

  • It will return a string array like => ["Role1", "Role2"] (not as stringified. So you can be able to query it.)

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"]' .

  • Yes you are right. I've used .Any instead of .All method of Linq in the previous answer, sorry for the misunderstanding. You can use the following code-snippet.
  • If the current user has one role but you want to check it has multiple roles, isn't it the expected behaviour to return false?
public static class CurrentUserExtensions
{
    public static bool IsInSpecifiedRoles(this ICurrentUser currentUser, string[] roles)
    {
        var userRoles = currentUser.Roles;
        return userRoles.All(userRole => roles.Contains(userRole));
    }
} 
  • If you want to check for just one role use the 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

Answer

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.

  • You can use Roles property of 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.

Showing 641 to 650 of 731 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06