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
This should have a separate class that defines what a user can do.
It can get a little hard because we have to do this asynchronous,
but something like this should be possible:
classAbilities@initialize: (user) -># register an ability for the user on articles@can"article", (done) ->user.getForums().all (err, forums) ->forumIds= (forum.get("id") for forum in forums)
conditions=forumId: forumIds
# this registers additional conditions the scope has to contain to secure that the user can only edit "articles", that are in a forum the user has access to.done err, conditions
The controllers should be able to implement a cancan mixin, that hooks via @beforeAction filters into the flow of dispatching a request and can limit the scope that way.
Relevant pieces to instrument in the controller are:
@findResource
`@findParent``
@scoped
The text was updated successfully, but these errors were encountered:
Salad should introduce Rails-like CanCan abilities: https://github.com/ryanb/cancan
This should have a separate class that defines what a user can do.
It can get a little hard because we have to do this asynchronous,
but something like this should be possible:
The controllers should be able to implement a cancan mixin, that hooks via
@beforeAction
filters into the flow of dispatching a request and can limit the scope that way.Relevant pieces to instrument in the controller are:
@findResource
@scoped
The text was updated successfully, but these errors were encountered: