Permalink
Browse files

fix(ValueConverters): bring back old authFilter version since new one…

… can't be auto bundled
  • Loading branch information...
doktordirk committed Jun 4, 2016
1 parent fc9713a commit a66394dcbc22836fff4acd475699659d705c6109
Showing with 24 additions and 14 deletions.
  1. +0 −1 src/aurelia-authentication.js
  2. +4 −12 src/authFilterValueConverter.js
  3. +19 −0 src/authenticatedFilterValueConverter.js
  4. +1 −1 src/baseConfig.js
@@ -9,7 +9,6 @@ import {FetchConfig} from './fetchClientConfig';
import * as LogManager from 'aurelia-logging';
// import to ensure value-converters get bundled
import './authFilterValueConverter';
import './authenticatedValueConverter';
/**
* Configure the plugin.
@@ -1,19 +1,11 @@
import {inject} from 'aurelia-dependency-injection';
import {AuthService} from './authService';
@inject(AuthService)
export class AuthFilterValueConverter {
constructor(authService) {
this.authService = authService;
}
/**
* route toView predictator on route.config.auth === (parameter || authService.isAuthenticated())
* route toView predictator on route.config.auth === isAuthenticated
* @param {RouteConfig} routes the routes array to convert
* @param {[Boolean]} [isAuthenticated] optional isAuthenticated value. default: this.authService.authenticated
* @param {Boolean} isAuthenticated authentication status
* @return {Boolean} show/hide element
*/
toView(routes, isAuthenticated = this.authService.authenticated) {
return routes.filter(route => route.config.auth === isAuthenticated);
toView(routes, isAuthenticated) {
return routes.filter(route => typeof route.config.auth !== 'boolean' || route.config.auth === isAuthenticated);
}
}
@@ -0,0 +1,19 @@
import {inject} from 'aurelia-dependency-injection';
import {AuthService} from './aurelia-authentication';
@inject(AuthService)
export class AuthenticatedFilterValueConverter {
constructor(authService) {
this.authService = authService;
}
/**
* route toView predictator on route.config.auth === (parameter || authService.isAuthenticated())
* @param {RouteConfig} routes the routes array to convert
* @param {[Boolean]} [isAuthenticated] optional isAuthenticated value. default: this.authService.authenticated
* @return {Boolean} show/hide element
*/
toView(routes, isAuthenticated = this.authService.authenticated) {
return routes.filter(route => typeof route.config.auth !== 'boolean' || route.config.auth === isAuthenticated);
}
}
@@ -143,7 +143,7 @@ export class BaseConfig {
storageKey = 'aurelia_authentication';
// List of value-converters to make global
globalValueConverters = ['authFilterValueConverter', 'authenticatedValueConverter'];
globalValueConverters = ['authFilterValueConverter', 'authenticatedFilterValueConverter', 'authenticatedValueConverter'];
//OAuth provider specific related configuration
// ============================================

0 comments on commit a66394d

Please sign in to comment.