I’m wondering the best/simplest way to give a user “super_admin” access using the Pundit gem — or, what’s the simplest way to give a user access to all controller actions across the site?
I realize I can edit the policy file for each controller, then add something like
def delete? user.is_super_admin? end
…to each and every action, in each and every controller. But is there a single place where I could define this?
I’ve taken a look at the application policy, which all of my other controller policies inherit from, but I believe these actions are all overridden in my controllers anyway so I don’t think I could define it there.
I’m sure others have needed to implement this feature? What’s the simplest way? Thanks!
Related Posts:
- 400 Bad Request – request header or cookie too large
- Why Puma listen on ‘tcp://localhost:3000’ instead of ‘http://localhost:3000’
- Explain what " means
- Why does Ruby on Rails use http://0.0.0.0:3000 instead of http://localhost:3000?
- ActionController::InvalidAuthenticityToken
- bundle install returns “Could not locate Gemfile”
- ActionController::InvalidAuthenticityToken
- Rails: Why “sudo” command is not recognized?
- Rails: Can’t verify CSRF token authenticity when making a POST request
- undefined method `each’ for nil:NilClass… why?
- Bundler: You must use Bundler 2 or greater with this lockfile
- undefined method `each’ for nil:NilClass… why?
- How to tell if homebrew is installed on Mac OS X
- What is the difference between Rails.cache.clear and rake tmp:cache:clear?
- Unable to install gem – Failed to build gem native extension – cannot load such file — mkmf (LoadError)
- Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
- Cannot load such file — bcrypt_ext
- How do I remove Permission denied @ rb_sysopen – Gem install error?
- Can’t find the ‘libpq-fe.h header when trying to install pg gem
- warning: constant ::Fixnum is deprecated When generating new model
- could not connect to server: No such file or directory (PG::ConnectionBad)
- PG::ConnectionBad: fe_sendauth: no password supplied
- curl : (1) Protocol https not supported or disabled in libcurl
- couldn’t find file ‘jquery’ with type ‘application/javascript’
- Passing parameters in rails redirect_to
- Getting: “Migrations are pending; run ‘bin/rake db:migrate RAILS_ENV=development’ to resolve this issue.” after cloning and migrating the project
- How to find out which rails version an existing rails application is built on?
- RubyMine Unit tests – Test Framework quit unexpectedly
- bcrypt LoadError: Cannot load such file
- Uninitialized constant “Controller Name”
- How do I format datetime in rails?
- heroku open – no app specified
- Difference between rake db:migrate db:reset and db:schema:load
- TypeError: no implicit conversion of Symbol into Integer
- Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets
- How to stop (and restart) the Rails Server?
- Migrations are pending; run ‘bin/rake db:migrate RAILS_ENV=development’ to resolve this issue
- Authentication versus Authorization
- Advanced AREL or just Rails Query for has_many through search by association
- How to define the basic HTTP authentication using cURL correctly?
- How to define the basic HTTP authentication using cURL correctly?
- AngularJS- Login and Authentication in each route and controller
- Rails 5 ActionController::InvalidAuthenticityToken error
- what does ? ? mean in ruby
- Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails
- Parsing XML with Ruby
- Email validation in Ruby on Rails?
- extconf failed, exit code 1 error when installing [Ruby on Rails] 5 on OS X Yosemite 10.10.5
- Rails 4 RoutingError: No Route Matches
- PG::ConnectionBad – could not connect to server: Connection refused
- Rails syntax error : unexpected keyword_ensure, expecting end-of-input
- Devise lockable – How to unlock account using unlock_in
- Ruby: What is the easiest way to remove the first element from an array?
- Ruby String to Date Conversion
- “Error installing rails” because “extconf.rb failed” on Ubuntu 18.04
- An unhandled lowlevel error occurred. The application logs may have details
- Uncaught ReferenceError: React is not defined
- Rails button_to vs. HTML Button Tag
- GROUP BY and COUNT using ActiveRecord
- Purge or recreate a Ruby on Rails database
- Uploading a file in Rails
- Generate model in Rails using user_id:integer vs user:references
- An error occurred while installing json (1.8.1), and Bundler cannot continue – Rails
- Nginx error: client intended to send too large body
- where is devise implementation of “authenticate_user!” method?
- What is the difference between “rake db:seed” and rake db:fixtures:load”
- How do I parse JSON with Ruby on Rails? [duplicate]
- What is the purpose of having a token in cookies?
- How does ifttt.com authenticate a supplied WordPress account
- how can i embed wordpress backend in iframe
- How to force Authentication on REST API for Password protected page using custom table and fetch() without Plugin
- Why does this check to see if user is authorized to edit a post fail for all but super admins?
- WordPress Authentication Middleware
- Check user logged in from outside of WP folder
- Authentication with internal WP_REST_Request and rest_do_request()
- Custom login doesn’t work properly
- Authenticating user for custom post type [closed]
- Restrict user role Author from viewing comments in admin interface
- WordPress Users authentication with Java Application
- WordPress REST Api: update user
- How to Restrict Access to all wp-admin pages for subscriber users
- Requiring Authentication for Parts of WordPress Site
- How to display archive page posts based on author_id
- Require authorization for access to RSS feeds, but leave posts public
- IIS Authorization Rules breaks WP REST-API and results in fail in Site Health
- How do I edit disclaimer/contact information?
- Password Protected Page + Showing Different Page If Not Authenticated/Authorized
- Usage of wp_send_json_success and wp_redirect at the same time
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Authenticate + Authorize WP REST API request before built-in WP JSON Schema Payload Validation?
- How to force or redirect to SSL in nginx?
- What is the difference between authentication and authorization?
- How can I enforce user to use Application password to generate JWT token? [closed]