/gating_app

(In Progress) Rails app and api that allows the user to activate capabilities (application features) for clients individually, do limited rollouts of new capabilities, and charge clients for selected capabilities.

Primary LanguageCSS

Objective

The Gating API is an isolated service that enables any of our applications to check what capabilities should be enabled or disabled for a given application. This allows us to activate capabilities for clients individually, do limited rollouts of new capabilities, and charge clients for selected capabilities.

Usage

You can visit the app at gating.herokuapp.com. You can also clone the app and use the seed data provided to get up and running. You can log in as an admin online or on your local with username: user1@gmail.com and password: password

At a high level, what’s complete?

The Admin interfaces for CRUDing Users, Capabilities and Organizations. The ability to assign Capabilities to Organizations. Tables for storing capability values.

At a high level, what’s still missing?

There is no GUI for setting the default value of a capability. There are no organization-specific values for a capability.

There are no expiry notifications.

The third API endpoint is missing. The JSON returned by the first two API endpoints is not organization-specific. The JSON does not return capability values.

Features

(COMPLETE) User Management

  • (COMPLETE) All Users have:

    • (COMPLETE) An Email

    • (COMPLETE) An API Key

  • (COMPLETE) There is basic user registration and authentication

  • (COMPLETE) A user can either be a regular User or Admin

  • (COMPLETE) Admins are able to assign / unassign roles to other users

  • (COMPLETE) All users view their personal API key

Note: Non-admins can view their personal API key by clicking Account Details. Note: On Heroku, you can log in as an admin with username: user1@gmail.com and password: password. This can work on your local too, just run rake db:seed.

Capability Management

  • All Capabilities have:

    • (COMPLETE) A key (i.e. “advanced_search”)

    • A default value (i.e. false)

    • (COMPLETE) A type of Boolean, Numeric or String

    • (COMPLETE) A User who is the Owner

  • (COMPLETE) All Capabilities may have:

    • (COMPLETE) An expiration date

    • (COMPLETE) A note (i.e. “When enabled, allow access to the new search API”)

  • (COMPLETE) Admins are able to CRUD Capabilities

Note: Capabilities can have a a default value but this is not working in the GUI. Note: Click View on a Capability to add a note.

Capability Expiration Notification

  • If a Capability has expired its Owner receives a daily email letting them know

Organization Management

  • (COMPLETE) All Organizations have:

    • (COMPLETE) A full name (i.e. “Amherst College”)

    • (COMPLETE) A slug (i.e. “amherst”)

  • Users are a part of an Organization; Admins are not a part of any Organization

  • (COMPLETE) Admins are able to create new Organizations

  • (COMPLETE)An Organization can have zero or more Capabilities assigned to it

  • (COMPLETE)An Admin can assign Capabilities to an Organization

  • Users are able to view all the Capabilities assigned to only their Organization

Note: Need organization to reset when a user is promoted to Admin. Try adding org to the promotion form. You could change the value via the template. Also check whether adding to the form make the helper method in the controller work. Is it possible to do this in the models? What’s best practice?

Gating API

The Gating API will be called by applications in order to determine which capabilities to expose to the end user. All responses will have a proper HTTP status code and the body (if any) will be in JSON.

  • Get Capabilities for an Organization

This endpoint returns the entire list of Capabilities, any that are assigned to the Organization should have the set value, all others should have the default value.

Request

GET /organizations/:id/capabilities
GET /organizations/amherst/capabilities

Response

[
  { “key”: “value”},
  ...
]

[
  { “advanced_search”: true},
  { “advanced_search_results_cache_ttl”: 650000 },
  { “advanced_search_url”: “https://api.evertrue.com/adv_search” }
]
  • Get a Capability for an Organization

This endpoint returns a single Capability for the Organization, if it is assigned to the Organization then set the value otherwise return the default. If the key does not correspond to any Capabilities, then return a 404.

Request

GET /organizations/:id/capabilities/:key
GET /organizations/amherst/capabilities/advanced_search

Response

{ “key”: “value”}

{ “advanced_search”: true}
  • Get a List of Capabilities for an Organization

This endpoint returns a list of Capabilities for the Organization, any that are assigned to the Organization should have the set value, all others should have the default value. If a key does not exist, return its value as null.

Request

GET /organizations/:id/capabilities?keys[]=x&keys[]=y&keys[]=z
GET/organizations/amherst/capabilities?keys[]=advanced_search&keys[]=advanced_search_url&keys[]=does­not­exist

Response

[
  { “key”: “value”},
  ...
]

[
  { “advanced_search”: true},
  { “advanced_search_url”: “https://api.evertrue.com/adv_search” },
  { “does­not­exist”: null }
]