Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Default permissions for resources #14

Open
kyleellman opened this issue May 11, 2012 · 0 comments
Open

Default permissions for resources #14

kyleellman opened this issue May 11, 2012 · 0 comments

Comments

@kyleellman
Copy link

I find myself doing this 90% of the time:

resources :model_name do
  reading do
    allow :everyone
  end
  writing do
    allow :user do
      object.id && object.user == user
    end
  end
end

Is there a way to define defaults for the reading and writing blocks and simply override them in a resource?

This way, one could do something like this:

# Use default permissions
resources :public_posts

# Only allow a user to read their own notes (for example)
resources :private_notes do
  reading do
    allow :user do
      object.id && object.user == user
    end
  end
end

Anyone have any ideas?

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant