Open Closed

Permissions in Settings Component Contributor #6713


User avatar
0
mariovh created
  • ABP Framework version: v7.0.0
  • UI Type:Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi, I need to restrict the acces in each tenant to a setting value in settings management. Im trying to make a SettingComponentGroup, only visible for a settings admin user, wich could be a role created for this purpose. Following your example:

`

  public class BookStoreSettingPageContributor : ISettingPageContributor{
public Task ConfigureAsync(SettingPageCreationContext context)
{
    context.Groups.Add(
        new SettingPageGroup(
            "Volo.Abp.MySettingGroup",
            "MySettingGroup",
            typeof(MySettingGroupViewComponent),
            order : 1
        )
    );  return Task.CompletedTask;
}

public Task<bool> CheckPermissionsAsync(SettingPageCreationContext context)
{
    // You can check the permissions here
    return Task.FromResult(true);
}

} `

How i can in CheckPermissionsAsync, make "MySettingGroup" only visible for an specific role? Wich is the correct way to do it?

Thank you


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to get ICurrentUser from SettingPageCreationContext and check the roles.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09