department-of-veterans-affairs/caseflow-commons

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Caseflow

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

Installation

Add this line to your application's Gemfile:

'caseflow'

And then execute:

$ bundle

Or install it yourself as:

$ gem install caseflow
Usage

TODO: Write usage instructions here

Development

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/department-of-veterans-affairs/caseflow-commons.

Feature Toggle

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

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"]}}

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.