Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Updated routes and a logic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trainerbill committed Jul 24, 2015
1 parent fb71619 commit 03a4042
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
16 changes: 7 additions & 9 deletions modules/articles/client/config/articles.client.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,27 @@ angular.module('articles').config(['$stateProvider',
state('articles', {
abstract: true,
url: '/articles',
template: '<ui-view/>'
template: '<ui-view/>',
data: {
roles: ['user']
}
}).
state('articles.list', {
url: '',
templateUrl: 'modules/articles/views/list-articles.client.view.html'

}).
state('articles.create', {
url: '/create',
templateUrl: 'modules/articles/views/create-article.client.view.html',
data: {
roles: ['admin']
}
templateUrl: 'modules/articles/views/create-article.client.view.html'
}).
state('articles.view', {
url: '/:articleId',
templateUrl: 'modules/articles/views/view-article.client.view.html'
}).
state('articles.edit', {
url: '/:articleId/edit',
templateUrl: 'modules/articles/views/edit-article.client.view.html',
data: {
roles: ['user']
}
templateUrl: 'modules/articles/views/edit-article.client.view.html'
});
}
]);
5 changes: 4 additions & 1 deletion modules/chat/client/config/chat.client.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ angular.module('chat').config(['$stateProvider',
$stateProvider.
state('chat', {
url: '/chat',
templateUrl: 'modules/chat/views/chat.client.view.html'
templateUrl: 'modules/chat/views/chat.client.view.html',
data: {
roles: ['user']
}
});
}
]);
2 changes: 1 addition & 1 deletion modules/core/client/app/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(function($roo
if (toState.data && toState.data.roles && toState.data.roles.length > 0) {
var allowed = false;
toState.data.roles.forEach(function (role) {
if (Authentication.user.roles.indexOf(role) !== -1) {
if (Authentication.user.roles !== undefined && Authentication.user.roles.indexOf(role) !== -1) {
allowed = true;
}
});
Expand Down
2 changes: 1 addition & 1 deletion modules/users/client/config/users.client.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('users').config(['$stateProvider',
url: '/settings',
templateUrl: 'modules/users/views/settings/settings.client.view.html',
data: {
forbiddenRoles: ['guest']
roles: ['user']
}
}).
state('settings.profile', {
Expand Down

0 comments on commit 03a4042

Please sign in to comment.