Skip to content

Commit

Permalink
feat(about): add switch toggle for operlist command to user or oper
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Jun 2, 2018
1 parent 64d70ee commit 102b85f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions config/env/torrents.js
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,17 @@ module.exports = {
*/
userRoles: ['user', 'oper', 'admin'],

/**
* @state
*
* setting roles for state access
*
* @operList: roles for state: about.operlist
*/
state: {
operList: ['user', 'oper', 'admin']
},

/**
* @clientBlackList
*
Expand Down
8 changes: 5 additions & 3 deletions modules/about/client/config/about.client.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
.module('about.routes')
.config(routeConfig);

routeConfig.$inject = ['$stateProvider'];
routeConfig.$inject = ['$stateProvider', 'MeanTorrentConfigProvider'];

function routeConfig($stateProvider, MeanTorrentConfigProvider) {
var stateConfig = MeanTorrentConfigProvider.meanTorrentConfig().state;

function routeConfig($stateProvider) {
$stateProvider
.state('about', {
abstract: true,
Expand Down Expand Up @@ -151,7 +153,7 @@
url: '/operlist',
templateUrl: '/modules/about/client/views/operlist.client.view.html',
data: {
roles: ['user', 'oper', 'admin'],
roles: stateConfig.operList,
pageTitle: 'PAGETITLE.OPERLIST'
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Authentication service for user variables

angular
.module('torrents.services')
.module('core')
.provider('MeanTorrentConfig', MeanTorrentConfig);

//MeanTorrentConfig.$inject = ['$window'];
Expand Down
1 change: 1 addition & 0 deletions modules/users/server/policies/admin.server.policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ exports.invokeRolesPolicies = function () {
{
roles: ['user'],
allows: [
{resources: '/api/users', permissions: ['get']},
{resources: '/api/users/:userId', permissions: ['get']},
{resources: '/api/users/:userId/uptotal', permissions: ['get']},
{resources: '/api/users/:userId/followers', permissions: ['get']},
Expand Down

0 comments on commit 102b85f

Please sign in to comment.