0.0
No commit activity in last 3 years
No release in over 3 years
Authorization Grant Front on Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 0
 Project Readme

GrantFront

Gem Version Build Status

Policies grant of role for authorization on Rails.

Installation

Add this line to your application's Gemfile:

gem 'grant-front'

And then execute:

$ bundle

Usage

Rack

Add this line to your config/routes.rb:

mount GrantFront::Engine, at: '/rails/info/policies'

Draw by selecting the policy:

example

Rake

Draw by rake command:

$ rake grant_front:draw

### User

||foo|bar|baz|
|:-|:-:|:-:|:-:|
|create|o|o|o|
|update|o|o||
|destroy||o|o|

Policy Example

Install the Pundit, and to the generate:

$ rails generate pundit:install
$ rails generate pundit:policy user

Include GrantFront line to your policies/application_policy.rb:

class ApplicationPolicy
  include GrantFront
  attr_reader :user, :record

  def initialize(user, record)
    @user = user
    @record = record
  end
end

Add grant line to your policies/user_policy.rb:

class UserPolicy < ApplicationPolicy
  def create?
    grant :foo, :bar, :baz
  end

  def update?
    grant :foo, :bar
  end

  def destroy?
    grant :bar, :baz
  end
end

License

  • MIT