Beta is an access control library that uses a Redis whitelist to control authorization. It relies upon the
Rails.env variable to check against its list of environments to trigger on.
gem install beta or add
gem 'beta' to your Gemfile.
Then, add an initializer in your Rails application to configure Beta:
Beta.config do |config|
redis = $redis
uid = 'mlg_id'
namespace = 'awesome-app'
redirect_url = 'http://majorleaguegaming.com'
environments = [:production]
Finally, Beta requires the existence of a
current_user which responds to the attribute specified in the
uid configuration key used in both the
include Beta::AccesHelpers to ApplicationController, you get access to the following methods:
whitelist- Used as a before_filter to ensure the
is_whitelisted?(user)checks to see if the given user is on the list.
is_whitelisted?to tell you if the current user is special.