Вопрос

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