Questions tagged [pundit]

Pundit provides a set of helpers that guide Ruby programmer in leveraging regular Ruby classes and object oriented design patterns to build a simple, robust and scaleable authorization system.

439 questions
0
votes
1 answer

How configure pundit to display items belonging to a parent bond

My use case is, if the user have role :agency, he can see clients. But I have to use the link between the client's and agency to verify this. Take a look bellow to see my code: class Agency < ApplicationRecord has_many :agency_clients has_many…
Bruno Wego
  • 2,099
  • 3
  • 21
  • 38
0
votes
1 answer

Rails 5: permission for user to create record through permission table with Pundit

In my app I have Permission table, which stores all the logic what User can do. With Pundit I want to allow User to create new Campaign if Permission table allows. User can access Campaigns and create new, if Permission table contains this…
matiss
  • 747
  • 15
  • 36
0
votes
1 answer

Admin privileges in Pundit with nested resources and how to handle the index action

I'm new to pundit and trying to come up with the best approach for handling nested resources for the index action. I found a similar question however it doesn't deal with admin privileges and I'm just not sure if my solution feels quite right. Let's…
Dom
  • 160
  • 2
  • 10
0
votes
1 answer

Is it possible to create a functionality about user registration with Pudit or Devise on Rails?

I already used Pudit and Devise for registration and authorization via the web interface. But I want to support via REST interface too. Is it possible to use Pudit or Devise for doing that. For example, sending this JSON for creating a new user { …
JeeDee
  • 23
  • 1
  • 3
0
votes
1 answer

Undefined method `to_criteria' with Rails 4.2.7, Pundit, Mongoid and RailsAdmin

I have a Rails 4.2.7 app with rails_admin (0.8.1), pundit (1.1.0) and mongoid (5.1.4) I created Campaign scaffold and added authorize @campaign to set_campaign in CampaignController. when I browse to…
0
votes
0 answers

Rails 4 - 2 word model names

I'm using rails 4 with pundit and with statesman. In each case, my pundit policy and my statesman model files don't work where the model name attached to them has two words. For example, I have a model called organisation_request.rb I have setup a…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

Rails 4 - Update User Role Permissions

I am having rails 4 application with user, role, permissions implemented using Pundit gem. I have 3 models user, role, roles_users as I have many_to_many relation between user and role. I want to edit the user roles. class User …
Sachin Kadam
  • 265
  • 2
  • 12
0
votes
2 answers

Rails 4 - Pundit - create policy

I'm trying to figure out how to use pundit in my Rails 4 app. I have a profile view in which I want to display a link to create a new project, subject to pundit authorisation. I have tried each of the following formulations: <%# if…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

Rails - Pundit - resolve method not operating correctly

I am trying to figure out how to use pundit with my rails 4 app. I have an article policy and an article index view. In the article policy, I have a resolve method which has scopes for different types of users. def resolve if user == @user.id …
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
2 answers

Rails - Pundit with scopes

I am trying to figure out how to write pundit permissions in my Rails 4 app. I have an article model, with an article policy. The article policy has: class ArticlePolicy < ApplicationPolicy attr_reader :user, :scope def initialize(user,…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

RailsAdmin not working with Pundit - Pundit::AuthorizationNotPerformedError at / RailsAdmin::MainController

I'm using Devise and Pundit gems in a Ruby on Rails application. I'm trying to implement RailsAdmin in order to set up a simple admin interface for my non-tech team members, on the URL 'myapp.com/admin', but going to this URL raises the following…
Quentin
  • 57
  • 7
0
votes
2 answers

Rails Rolify with Pundit

The guidance in this post shows how to use rolify with pundit authorisations. I'm trying to figure out how to this in my Rails app. What's confusing me about the answer in the linked post is that the index action checks for :admin, where the show…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

UserPolicy for Index

I am trying to create a policy so that only admins can acces a page. I've already managed to get pundit to work in another controller, but for some reason this policy wont work. I've created a controller: users_controller.rb which is as follows: def…
Jorn
  • 26
  • 3
0
votes
1 answer

Pundit Policy : Wikis not showing up for collaborators

I want different types of wikis to appear on the index view depending on the role of the user. The policy for admin and standard / guest users work as it should but when it comes to premium users and collaborations it gets a little messy. In my app…
Miguel Angel Quintana
  • 1,371
  • 2
  • 9
  • 12
0
votes
1 answer

Pundit :: wrong number of arguments (1 for 0)

I am getting this error when i am trying to authorize through pundit and authenticate through Devise. ArgumentError - wrong number of arguments (1 for 0): pundit (1.1.0) lib/pundit.rb:194:in `authorize' …
Raj Singh
  • 11
  • 3