aptible / dashboard.aptible.com

DEPRECATED - Ember.js dashboard for the Aptible PaaS
https://dashboard.aptible.com
MIT License
81 stars 35 forks source link

Refactor permissions checks (authorization) into single service #712

Closed skylar-anderson closed 8 years ago

skylar-anderson commented 8 years ago

The goal of this PR was to make it easier to detect the current user's status in the context of their organization. Previously, this logic was scattered across many routes and components. aptible-ability offered some relief, but didn't work great outside of a template context. aptible-ability also required passing down user context models (organization, roles, etc) down to low-level components that shouldn't care about these otherwise.

This PR centralizes the users entire context (and how they relate to all of their organizations) into a single authorization context service. This sits on top of all authenticated routes and eagerly loads all resources required to make decisions about what UI a user should or shouldn't see. Removing the async nature of loading all of these resources significantly reduces the complexity of many of our routes.

The service is injected to all routes, controllers, and components so signature bloat on any component that needs context in order to render should be greatly reduced. (I fixed many of them, but there are probably more)

In addition to the authorization service refactor, this PR also adds a new "trainee dashboard" which shows the current users training history along with links to download their organizations latest policy manual. See image at bottom of this PR.

Also included in this refactor

fixes #680 fixed #664

New "My Gridiron Status" page:

screenshot 2016-09-02 11 23 51

cc @gib

skylar-anderson commented 8 years ago

Some quick follow ups to this PR that I'd like to tackle soon:

skylar-anderson commented 8 years ago

Forgot to mention -- with most resources now eagerly loaded (and duplicate requests squashed), Dashboard feels way fast again.

gib commented 8 years ago

Amazing! :bow: Thank you @sandersonet!!

skylar-anderson commented 8 years ago

Updated to add an application loading route + removed the activated-item component entirely.

gib commented 8 years ago

Nice!