feat(torrents): add access limit to maker group settings of torrent uploader

This commit is contained in:
OldHawk
2018-04-24 12:01:53 +08:00
parent a1806b0a29
commit ab3d7ac2bb
9 changed files with 34 additions and 13 deletions

View File

@@ -211,18 +211,27 @@ module.exports = {
},
/**
* @adminAccess
* @access
*
* setting ip access for menu of admin center
* setting ip access for site menu
*
* @limit: set whether to limit ip to access admin center
* @limitedIp: list all allow ip to access admin center, otherwise can not to access
* If you limited some vpn ip to access it, please add the vpn ip into the @limitedIp array
* If no limited ip, set the @limit to false
* @admin: setting of access for admin center
* @limit: set whether to limit ip to access admin center
* @limitedIp: list all allow ip to access admin center, otherwise can not to access
* If you limited some vpn ip to access it, please add the vpn ip into the @limitedIp array
* If no limited ip, set the @limit to false
* @upload: setting of access for torrents uploader
* @limitToMakerGroup: setting whether limit the access to maker group for torrents uploader
* if false, everyone can upload torrent
*/
adminAccess: {
limit: false,
limitedIp: ['127.0.0.1']
access: {
admin: {
limit: false,
limitedIp: ['127.0.0.1']
},
upload: {
limitToMakerGroup: false
}
},
/**

View File

@@ -39,6 +39,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.groupTorrentType = localStorageService.get('maker_last_selected_type') || 'movie';
vm.searchTags = [];
@@ -84,6 +85,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.user
});

View File

@@ -40,9 +40,9 @@
}
} else {
if (toState.name.startsWith('admin.')) {
var adminAccessConfig = MeanTorrentConfig.meanTorrentConfig.adminAccess;
var accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
if (adminAccessConfig.limit) {
if (accessConfig.admin.limit) {
if ($rootScope.ipIdentify) {
$rootScope.ipIdentify = false;
return;
@@ -50,7 +50,7 @@
event.preventDefault();
UsersService.getMyIp(function (res) {
if (Authentication.user && !adminAccessConfig.limitedIp.includes(res.ip)) {
if (Authentication.user && !accessConfig.admin.limitedIp.includes(res.ip)) {
$state.transitionTo('access-deny');
} else {
$rootScope.ipIdentify = true;

View File

@@ -91,7 +91,7 @@ function getSafeMeanTorrentConfig(req, cfg) {
//ignore adminAccess config items for normal users
if (req.user && !req.user.isOper) {
newCfg.adminAccess = undefined;
newCfg.access.admin = undefined;
}
return newCfg;

View File

@@ -34,6 +34,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentType = MeanTorrentConfig.meanTorrentConfig.torrentType;
@@ -114,6 +115,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.user
});

View File

@@ -30,6 +30,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.authentication = Authentication;
vm.getPopoverMsg = PasswordValidator.getPopoverMsg;
@@ -92,6 +93,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.authentication.user
});

View File

@@ -30,6 +30,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.lang = getStorageLangService.getLang();
vm.user = Authentication.user;
@@ -85,6 +86,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.user
});

View File

@@ -34,6 +34,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.lang = getStorageLangService.getLang();
@@ -72,6 +73,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.user
});

View File

@@ -36,6 +36,7 @@
vm.passwordConfig = MeanTorrentConfig.meanTorrentConfig.password;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.chatConfig = MeanTorrentConfig.meanTorrentConfig.chat;
vm.accessConfig = MeanTorrentConfig.meanTorrentConfig.access;
vm.torrentType = MeanTorrentConfig.meanTorrentConfig.torrentType;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
@@ -82,6 +83,7 @@
passwordConfig: vm.passwordConfig,
examinationConfig: vm.examinationConfig,
chatConfig: vm.chatConfig,
accessConfig: vm.accessConfig,
user: vm.user
});