Skip to content

Commit

Permalink
fix(core): change oper access
Browse files Browse the repository at this point in the history
  • Loading branch information
taobataoma committed Jun 11, 2018
1 parent 5ff9b41 commit 201a2e5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions config/env/torrents.js
Expand Up @@ -717,6 +717,7 @@ module.exports = {

adminUserDelete: {name: 'adminUserDelete', enable: true},
adminUserEdit: {name: 'adminUserEdit', enable: true},
adminMakerEdit: {name: 'adminMakerEdit', enable: true},
adminBanAllExaminationUnfinishedUsers: {name: 'adminBanAllExaminationUnfinishedUsers', enable: true},

userPasswordReset: {name: 'userPasswordReset', enable: true},
Expand Down
8 changes: 8 additions & 0 deletions modules/about/server/controllers/makers.server.controller.js
Expand Up @@ -123,6 +123,14 @@ exports.update = function (req, res) {
site_name: appConfig.name
});
}

//create trace log
traceLogCreate(req, traceConfig.action.adminMakerEdit, {
maker: maker._id,
name: req.body.name,
desc: req.body.desc,
upload_access: req.body.upload_access
});
}
});
};
Expand Down
1 change: 0 additions & 1 deletion modules/tickets/client/config/tickets-admin.client.menu.js
Expand Up @@ -12,7 +12,6 @@
menuService.addSubMenuItem('topbar', 'admin', {
title: 'MENU_ADMIN_TICKETS',
state: 'admin.tickets.support.message',
roles: ['admin'],
faIcon: 'fa-volume-control-phone',
faClass: 'text-mt',
position: 70,
Expand Down
Expand Up @@ -20,7 +20,6 @@
menuService.addSubMenuItem('topbar', 'admin', {
title: 'MENU_UPLOADER_ADMIN',
state: 'admin.uploader',
roles: ['admin'],
faIcon: 'fa-cloud-upload',
faClass: 'text-mt',
position: 2
Expand Down
10 changes: 5 additions & 5 deletions modules/users/client/views/admin/view-user.client.view.html
Expand Up @@ -79,7 +79,7 @@
<dt class="h-line">{{ 'STATUS_FIELD.EMAIL' | translate}}:</dt>
<dd class="h-line">{{ vm.user.email }}</dd>

<div ng-if="vm.authentication.user.isAdmin">
<div ng-if="vm.authentication.user.isOper">
<dt class="h-line">{{ 'STATUS_FIELD.PASSKEY' | translate}}:</dt>
<dd class="h-line">
<mark>{{ vm.user.passkey }}</mark>
Expand Down Expand Up @@ -129,7 +129,7 @@
<dd class="h-line">
<span>{{ vm.user.score | number: 2 }}</span> <span score-level-curr="vm.user"></span>

<div class="pull-right" ng-if="vm.authentication.user.isAdmin">
<div class="pull-right" ng-if="vm.authentication.user.isOper">
<button class="btn btn-default btn-xs btn-width-100"
uib-popover-template="vm.setUserScorePopover.templateUrl"
popover-title="{{vm.setUserScorePopover.title | translate}}"
Expand Down Expand Up @@ -164,7 +164,7 @@
<dt class="h-line">{{ 'STATUS_FIELD.LATEST_REFRESH_TIME' | translate}}:</dt>
<dd class="h-line">{{ vm.user.refreshat | date: 'yyyy-MM-dd HH:mm:ss' }}</dd>

<div ng-hide="!vm.authentication.user.isAdmin && vm.user.isAdmin">
<div ng-if="vm.authentication.user.isOper && !vm.user.isAdmin">
<dt class="h-line">{{ 'STATUS_FIELD.CURR_SIGNED_IP' | translate}}:</dt>
<dd class="h-line">{{ vm.user.curr_signed_ip }}</dd>

Expand Down Expand Up @@ -216,7 +216,7 @@
<span class="true_updown text-muted"
ng-if="vm.user.true_uploaded>0">|&emsp;{{ 'STATUS_FIELD.TRUE_UPLOADED' | translate}}:{{ vm.user.true_uploaded | bytes:2 }}</span>

<div class="pull-right" ng-if="vm.authentication.user.isAdmin">
<div class="pull-right" ng-if="vm.authentication.user.isOper">
<button class="btn btn-default btn-xs btn-width-100"
uib-popover-template="vm.setUserUploadedPopover.templateUrl"
popover-title="{{vm.setUserUploadedPopover.title | translate}}"
Expand All @@ -237,7 +237,7 @@
<span class="true_updown text-muted"
ng-if="vm.user.true_downloaded>0">|&emsp;{{ 'STATUS_FIELD.TRUE_DOWNLOADED' | translate}}:{{ vm.user.true_downloaded | bytes:2 }}</span>

<div class="pull-right" ng-if="vm.authentication.user.isAdmin">
<div class="pull-right" ng-if="vm.authentication.user.isOper">
<button class="btn btn-default btn-xs btn-width-100"
uib-popover-template="vm.setUserDownloadedPopover.templateUrl"
popover-title="{{vm.setUserDownloadedPopover.title | translate}}"
Expand Down
4 changes: 3 additions & 1 deletion modules/users/server/controllers/admin.server.controller.js
Expand Up @@ -82,7 +82,9 @@ exports.update = function (req, res) {
user: user._id,
firstName: req.body.firstName,
lastName: req.body.lastName,
roles: req.body.roles
roles: req.body.roles,
upload_access: req.body.upload_access,
remarks: req.body.remarks
});
});
};
Expand Down
2 changes: 1 addition & 1 deletion modules/users/server/policies/admin.server.policy.js
Expand Up @@ -17,7 +17,6 @@ exports.invokeRolesPolicies = function () {
{
roles: ['admin'],
allows: [
{resources: '/api/users/uploaderList', permissions: '*'},
{resources: '/api/users/:userId/role', permissions: '*'},
{resources: '/api/users/:userId/VIPMonths/:months', permissions: '*'},
{resources: '/api/users/:userId/VIPMonths/reset', permissions: '*'},
Expand All @@ -27,6 +26,7 @@ exports.invokeRolesPolicies = function () {
{
roles: ['oper', 'admin'],
allows: [
{resources: '/api/users/uploaderList', permissions: '*'},
{resources: '/api/users', permissions: '*'},
{resources: '/api/users/:userId', permissions: '*'},
{resources: '/api/users/:userId/status', permissions: '*'},
Expand Down

0 comments on commit 201a2e5

Please sign in to comment.