
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Manage user roles. Each user's role is stored as a bit in an integer column of database. Also provides user ability to have one role and some roles.
Add this line to your application's Gemfile:
gem 'bitroleable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bitroleable
Add a column which will store role/roles as integer:
add_column :user, :roles, :integer, null: false
And then tell a model that you use this gem functionality:
# app/models/user.rb
class User < ActiveRecord::Base
roleable :roles, [:user, :moderator, :admin], multi: true
end
For now it has only one option:
multi
(boolean) - when it equals true
an entity could have many roles, otherwise only one roleuser = User.first
user.admin! # => user becomes an admin
user.admin? # => true
user.role?(:admin) # => true
user.user? # => false
user.role # => [:admin]
user.role = [:user, :moderator]
user.role # => [:user, :moderator]
user.save!
User.where_role(:admin).count # => 0
User.where_role(:user).count # => 1
User.where_role(:moderator).count # => 1
User.roles_list # => [:user, :moderator, :admin]
User.role?(:user) # => true
User.role?(:fake) # => false
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that bitroleable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.