Fixes #8387: Redirect users back to 403 page if no current organization.

This functionality used to exist thanks to server side code that intercepted
pages. When Bastion was split and the logic that loads SPA pages updated the
server side check could no longer be relied on. This adds this logic to the
client side code and limits itself to declared pages as to not interrupt other
potential plugin pages.
The reason for this list is the case where another plugin defines routes
that don't require an organization.
On Dec 5, 2014 8:48 AM, "Walden Raines" <notifications@github.com> wrote:

> In
> engines/bastion_katello/app/assets/javascripts/bastion_katello/check-current-organization.run.js:
>
> > +     * @description
> > +     *   Handles checking if a given feature is enabled. Provides this functionality on
> > +     *   the root scope and also checks routes to send the user to a 403.
> > +     */
> > +    function CheckCurrentOrganization($rootScope, $window, CurrentOrganization) {
> > +        var fencedPages = [
> > +            'products',
> > +            'activation-keys',
> > +            'environments',
> > +            'subscriptions',
> > +            'gpg-keys',
> > +            'sync-plans',
> > +            'content-views',
> > +            'errata',
> > +            'content-hosts',
> > +            'host-collections'
>
> I wonder if there is a way to access the state and see it exists rather
> than creating yet another list of our top level pages. This will make the
> third list of top level pages (the other two are the routes themselves and
> the engine declaration
> <https://github.com/Katello/katello/blob/master/engines/bastion_katello/lib/bastion_katello/engine.rb#L22>
> .
>
> It looks like ui-router v 0.3 will include a $stateNotFound event
> <https://github.com/angular-ui/ui-router/wiki#user-content-state-change-events>
> which could help.
>
> I am not a fan of having to remember to update three different lists
> whenever I add a new top level page. If it is not possible to do away with
> this list then we definitely need updates to the documentation to call this
> out as something that must be added.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Katello/katello/pull/4847/files#r21372264>.
>