Base solution for your next web application
Open Closed

Only get permissions from MyAuthorizationProvider #7867


User avatar
0
fupanda created

I implemented my own PermissionChecker, which works fine. I also implemented my own AuthorizationProvider, which works also fine. The only thing is that the PermissionManager.GetAllPermissions() always returns permissions from all AuthorizationProviders. That's because of the following line of code in the initialize of the PermissionManager

foreach (var providerType in _authorizationConfiguration.Providers)

In most cases I want all permissions to be loaded, but not always. How can I get permissions from one AuthorizationProvider without changing code in PermissionManager? Or even better, how could I control this with a parameter?


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    The current design is difficult to achieve your needs. You can try to remove the existing AuthorizationProvider

    //Adding authorization providers
    Configuration.Authorization.Providers.Clear();
    Configuration.Authorization.Providers.Add<MyAuthorizationProvider>();
    
  • User Avatar
    0
    fupanda created

    This won't work for me, because sometimes I want the whole list and sometimes the seperate list

  • User Avatar
    0
    maliming created
    Support Team

    If it doesn't change the design and code of the framework, it seems impossible to achieve.

    If you think this is necessary, we can discuss it in the aspnetboilerplate. https://github.com/aspnetboilerplate/aspnetboilerplate/issues/new

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.

  • User Avatar
    0
    fupanda created

    Perhaps for other developers who run into the same thing, I was able to solve it with the properties paramter when defining the permissions in AppAuthorizationProvider, see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1943