locked
Authorization inside controller RRS feed

  • Question

  • User-81839486 posted

    Hey, I want to create system were if user is Admin then on page are shown every row from database, otherwise only related to current user. I need sth like this 

    if ((await AuthorizationService.AuthorizeAsync(User, "UserIsAdmin")).Succeeded)
    {
    select * from database and show
    }else{

    select * from database where UserId = currentUser

    }

    but Authorizationservice.Authorize async can only be used in async method. Can I do sth similiar with sync method?

    Saturday, August 22, 2020 1:19 PM

All replies