Orchard Themed Attribute outside controllers

前端 未结 1 1059
再見小時候
再見小時候 2021-01-24 05:40

I have a service which will override the content of the response body.
is it possible to use themed within the method which override the content ?

[Themed]         


        
相关标签:
1条回答
  • 2021-01-24 06:27

    No, i don't think this will work as the Themed attribute is intended for decorating a controller only.

    Also i don't think you follow the right approach for denying access. The event handler should not override the response body (seperation of concerns and it most likely won't work anyway). The IAuthorizationServiceEventHandler should check permissions and return whether access is granted or not. What`s happening when a permission is granted or not granted is normally a concern of other code parts. I would go this route:

    1. implement proper permission checks (IAuthorizer, IAuthorizationService) in all modules with a fallback on failure to whatever is suitable e.g. redirecting to a forbidden error page
    2. add an IAuthorizationServiceEventHandler to implement the checks accordingly
    0 讨论(0)
提交回复
热议问题