Low commit activity in last 3 years
No release in over a year
UI extension for ez-permissions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.1.0
~> 0.0.6
>= 5.0.1
>= 5.2
 Project Readme

Ez::Permissions::UI

Configuration

Configuration interface allows you to change default behavior

Ez::Permissions.configure do |config|
  # Use permissions UI capabilities
  require 'ez/permissions/ui'

  # Define your base UI controller and routes
  config.ui_base_controller = 'ApplicationController'
  config.ui_base_routes = '/permissions'

  # Add custom code to Ez::Permissions::RolesController
  config.ui_roles_controller_context = proc do
    before_action :authorize_user!
    before_action do
      Ez::Permissions::API.authorize!(current_user, :manage, :permissions)
    end
  end

  # Add custom code to Ez::Permissions::PermissionsController
  config.ui_permissions_controller_context = proc do
    before_action :authorize_user!
    before_action do
      Ez::Permissions::API.authorize!(current_user, :manage, :permissions)
    end
  end

  # By default actions ordered by name  as create > read > update > delete
  config.ui_actions_ordering = %w[list create read update delete]

  # Permissions UI ships with default generated CSS classes.
  # You always can inspect them in the browser and override
  config.ui_custom_css_map = {
    'ez-permissions-roles-container' => 'you custom css classes here'
  }
end

UI routes

In your routes.rb

Rails.application.routes.draw do
  namespace :admin do
    ez_permissions_ui_routes
  end
end

TODO

  • Cached permissions. If single UI has multiple checks for one user - we can cache it!
  • Not all permissions should be manageable through UI, like roles and permissions.

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.