mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-28 01:00:59 +01:00
feat(torrents): add access limit to maker group settings of torrent uploader
This commit is contained in:
27
config/env/torrents.js
vendored
27
config/env/torrents.js
vendored
@@ -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
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user