Questions tagged [authority-gem]

The Authority gem provides an ORM-neutral authorization layer for Rails and other Ruby applications.

The Authority gem provides an ORM-neutral authorization layer for Rails and other Ruby applications.

Authority differs from other authorization gems in that:

  • It allows defining authorizations using classes and normal inheritance mechanisms
  • It is completely decoupled from authentication
  • It is completely decoupled from the database or ORM

More info and examples can be found in the README: https://github.com/nathanl/authority

6 questions
3
votes
1 answer

Can Authority Ruby Gem be used with logged out users?

I get the following error: undefined method `can_read?' for nil:NilClass ..when trying to access a product page with a logged-out user. At the moment I have class ProductAuthorizer < ApplicationAuthorizer def self.readable_by?(user) true …
Abram
  • 39,950
  • 26
  • 134
  • 184
1
vote
1 answer

Rails Authority gem, trouble with 'show' action

It's the first time I'm using this gem and it's driving me crazy with something as simple as authorize the showaction only for the resource owner. I tried different ways, configuring the controller mapping and actions, but always get the…
CV-Gate
  • 1,162
  • 1
  • 10
  • 19
0
votes
1 answer

Rails authority apparent inconsistency

I am using the gems authority and rolify to manage user permissions on a set of subjects. Each subject can be seen by a user only if the user has the :admin role for that subject. Code in the view: <% if (current_user.has_role? :admin, @subject)…
bsky
  • 19,326
  • 49
  • 155
  • 270
0
votes
1 answer

Authority gem gives 'undefined method'

I'm getting undefined method 'authorize_actions_for' in the controller when using rails-api with the Authority gem. Any ideas what I need to include? Here's my code: Gemfile: ... gem 'authority', '~> 2.9.0' gem 'rails-api', '~>…
Richard
  • 3,839
  • 5
  • 28
  • 34
0
votes
1 answer

Error when deploying the `authority` gem with capistrano

I'm deploying a rails4 app from a dev machine to a server. This deployment has been working smoothly. I have added authorisation to my application using the authority gem. When I run ./bin/cap deploy I now get the error in the unicorn log that is…
0
votes
1 answer

Integrating inherited_resources and authority

I'm currently trying to integrate inherited_resources and authority into my Rails app. I'm a little bit stuck as to the best place to check the ability to do a controller action based on the resource. This code is given as an example in authority: …
Brendon Muir
  • 4,540
  • 2
  • 33
  • 55