Name: caseflow-commons
Owner: Department of Veterans Affairs
Description: Shared resources for VA Caseflow applications
Created: 2016-09-20 18:46:29.0
Updated: 2018-05-09 15:11:49.0
Pushed: 2018-05-09 15:11:48.0
Homepage: null
Size: 354
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/caseflow
. To experiment with that code, run bin/console
for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Add this line to your application's Gemfile:
'caseflow'
And then execute:
$ bundle
Or install it yourself as:
$ gem install caseflow
TODO: Write usage instructions here
After checking out the repo, run bin/setup
to install dependencies. Then, run bundle exec rake
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/department-of-veterans-affairs/caseflow-commons.
To enable and disable features using rails c
. Example usage:
ers
1 = User.new(regional_office: "RO03")
2 = User.new(regional_office: "RO04")
able for everyone
ureToggle.enable!(:apple)
rue
ureToggle.enabled?(:apple, user1)
rue
able for a list of regional offices
ureToggle.enable!(:apple, regional_offices: ["RO03", "RO08"])
rue
d more regional offices to the same feature
ureToggle.enable!(:apple, regional_offices: ["RO03", "RO09"])
rue
ew the details
ureToggle.details_for(:apple)
:regional_offices => ["RO03", "RO08", "RO09"] }
eck if the feature is enabled for a given user
ureToggle.enabled?(:apple, user1)
rue
ureToggle.enabled?(:apple, user2)
alse
sable a few regional offices
ureToggle.disable!(:apple, regional_offices: ["RO03", "RO09"])
rue
ureToggle.details_for(:apple)
:regional_offices =>["RO08"] }
st all toggle features
ureToggle.features
:apple]
Functions module is used to grant and deny user permissions/roles. Example usage:
d a role to the list of users and overwrite the list before
ution: Empty array will remove all users who were granted the function.
tions.grant!("Reader", users: ["CSS_ID_1", "CSS_ID_2"])
rue
ny a role
tions.deny!("Reader", users: ["CSS_ID_1"])
rue
thod to check if a given function is granted for a user
ctions.granted?("Reader", "CSS_ID_1")
alse
thod to check if a given function is denied to a user
ctions.denied?("Reader", "CSS_ID_1")
rue
turns a hash result for a given function
tions.details_for("Reader")
:granted=>["CSS_ID_2"], :denied=>["CSS_ID_1"]}
turns a hash result for all functions with granted and denied users
tions.list_all
"Reader"=>{:granted=>["CSS_ID_2"], :denied=>["CSS_ID_1"]}}