diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php
index e427e4d1c..b0537542a 100755
--- a/app/Http/Controllers/Api/FileController.php
+++ b/app/Http/Controllers/Api/FileController.php
@@ -1014,6 +1014,28 @@ class FileController extends AbstractController
}
$user = User::auth();
+ if ($user->isTemp()) {
+ return Base::retError('无法打包下载');
+ }
+ $setting = Base::setting('fileSetting');
+ switch ($setting['permission_pack_type']) {
+ case 'admin':
+ if (!$user->isAdmin()) {
+ return Base::retError('此功能仅管理员可用');
+ }
+ break;
+ case 'appointAllow':
+ if (!in_array($user->userid, $setting['permission_pack_userids'])) {
+ return Base::retError('此功能仅指定用户可用');
+ }
+ break;
+ case 'appointProhibit':
+ if (in_array($user->userid, $setting['permission_pack_userids'])) {
+ return Base::retError('此功能已禁止使用');
+ }
+ break;
+ }
+
$ids = Request::input('ids');
$fileName = Request::input('name');
$fileName = preg_replace("/[\/\\\:\*\?\"\<\>\|]/", "", $fileName);
diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php
index 9e75afb8a..dc922381b 100755
--- a/app/Http/Controllers/Api/SystemController.php
+++ b/app/Http/Controllers/Api/SystemController.php
@@ -605,6 +605,46 @@ class SystemController extends AbstractController
return Base::retSuccess('success', $setting ?: json_decode('{}'));
}
+ /**
+ * @api {get} api/system/setting/file 07. 文件设置(限管理员)
+ *
+ * @apiVersion 1.0.0
+ * @apiGroup system
+ * @apiName setting__file
+ *
+ * @apiParam {String} type
+ * - get: 获取(默认)
+ * - save: 保存设置(参数:['permission_pack_type', 'permission_pack_userids'])
+ * @apiSuccess {Number} ret 返回状态码(1正确、0错误)
+ * @apiSuccess {String} msg 返回信息(错误描述)
+ * @apiSuccess {Object} data 返回数据
+ */
+ public function setting__file()
+ {
+ User::auth('admin');
+ //
+ $type = trim(Request::input('type'));
+ if ($type == 'save') {
+ if (env("SYSTEM_SETTING") == 'disabled') {
+ return Base::retError('当前环境禁止修改');
+ }
+ $all = Base::newTrim(Request::input());
+ foreach ($all as $key => $value) {
+ if (!in_array($key, [
+ 'permission_pack_type',
+ 'permission_pack_userids'
+ ])) {
+ unset($all[$key]);
+ }
+ }
+ $setting = Base::setting('fileSetting', Base::newTrim($all));
+ } else {
+ $setting = Base::setting('fileSetting');
+ }
+ //
+ return Base::retSuccess('success', $setting ?: json_decode('{}'));
+ }
+
/**
* @api {get} api/system/demo 08. 获取演示帐号
*
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index 0eb9264b7..1fad0529f 100644
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -43,8 +43,14 @@ class Setting extends AbstractModel
return $value;
}
$value = Base::json2array($value);
- if ($this->name === 'system') {
- $value['system_alias'] = $value['system_alias'] ?: env('APP_NAME');
+ switch ($this->name) {
+ case 'system':
+ $value['system_alias'] = $value['system_alias'] ?: env('APP_NAME');
+ break;
+ case 'fileSetting':
+ $value['permission_pack_type'] = $value['permission_pack_type'] ?: 'all';
+ $value['permission_pack_userids'] = is_array($value['permission_pack_userids']) ? $value['permission_pack_userids'] : [];
+ break;
}
return $value;
}
diff --git a/resources/assets/js/pages/manage/setting/components/SystemFileSetting.vue b/resources/assets/js/pages/manage/setting/components/SystemFileSetting.vue
new file mode 100644
index 000000000..4bcde4af7
--- /dev/null
+++ b/resources/assets/js/pages/manage/setting/components/SystemFileSetting.vue
@@ -0,0 +1,97 @@
+
+