문제

I know that I can do this to demand both authorizations (AND):

    [AdminAuthorize, OtherAuthorize]
    public ActionResult MyAction(MyModel model)
    {
        ...
    }

...but how do I specify an OR combination (so that at least one of the autorizations is required to pass)? I guess I could go with writing my own Authorization attribute, but can I avoid this? A [AdminAuthorize || OtherAuthorize] would be handy.

도움이 되었습니까?

해결책

One way to go around this is to generate a base controller with protected methods and no autorization attributes and let two other authorized classes inherit it and call its protected actions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top