質問

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