Rails Operations
Manage your users' operations (permissions to execute some actions) in your
Ruby on Rails application.
Requirements
Prior to installing, please make sure these gems can be installed on your
system:
If you wish to run this gem locally, the following gems are also to consider:
- bootstrap (v4.1+)
- jquery-rails (v4.3+)
- jquery-ui-rails (v6.0+)
- bootstrap4-kaminari-views
- sqlite3 (v1.3.6+)
- sass-rails (v5.0+)
- select2-rails
- web-console
Installation
Add this line to your application's Gemfile:
gem 'operations'
And then execute:
$ bundle
Or install it yourself as:
$ gem install operations
Usage
Here are the most relevant API entries from this Gem:
Operations.operations_list
Operations.from_string(name)
Operations.allows?(user, name)
Operations.user_roles
operation = Operations::Operation.new do |operation|
operation.name = 'my_operation'
operation.scope = :admin
end
operation = Operations::Operation.new{name: :my_operation, scope: :admin}
allowed_users = operation.users
is_valid = operation.is_valid?
"bf9[..]a248".to_operation
"{\"name\":\"my_operation\",\"scope\":\"admin\"}".to_operation
Contributing
Do you wish to contribute? It's simple! All you need to do is:
- Fork this project
- Work your magic
- RUN TESTS
- Don't forget to synchronize with the master branch!
- Push to your fork
- Make a pull request!
License
The gem is available as open source under the terms of the MIT License.