Open jaybo opened 4 years ago
Having the same problem
I checked my database and notice that Role is set as an Integer, so when a user is created instead of registering role as either Admin or User it sets it as 0 or 1
I think that's because Enum on default registers its Values as Int
Still trying to find a workover though
I'm finding that any API which uses:
[Authorize(Role.Admin)]
never gets called, due to Authorization failure even for Admin defined users. I'm guessing this is because there is a class called AuthorizeAttribute which is located in the Helpers folder but is never invoked. So, for GetAll() in AccountsControler.cs I tried replacing:
with:
So now, the custom AuthorizeAttribute does get called, but Authorization still fails since the account isn't yet inserted into the HttpContext, so the role can't be confirmed.
How was this ever supposed to work?