You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
I am working on a feature that uses policies to authorize requests basing on a user role, an action and a resource.
I have no problem to get the first two, but I am facing issues with getting the resource name, since I only have the full path. Is there any efficient way to get that with any function similar to controller_name from Rails?
The text was updated successfully, but these errors were encountered:
I could extract the resource name from the name of the handler, for example: handlerName: = c.Data()["current_route"].(buffalo.RouteInfo).HandlerName
Lets suppose that handlerName is something like "github.com/company/project/actions.UsersResource.Edit"
And with some regexp stuff I capture the UsersResource string, but this does not convince me at all
With the RouteInfo you have the Handler, maybe using reflect you could get the resource name ?
(I am doing a pr with the resource name in the RouteInfo and I rely on the name of the handler with reflect as they do to have the HandlerName (with suffix List, Delete, Show ...)
Hello! Thanks for replying. I agree with the proposal, it would be great to have the resource and the action names on separate fields, for example ResourceName and ActionName
Hello,
I am working on a feature that uses policies to authorize requests basing on a user role, an action and a resource.
I have no problem to get the first two, but I am facing issues with getting the resource name, since I only have the full path. Is there any efficient way to get that with any function similar to
controller_name
from Rails?The text was updated successfully, but these errors were encountered: