mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复无法删除自定权限组的问题
This commit is contained in:
1 parent
f570ef70a0
commit
fa10caaba1
3 files changed
+8
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.38",
|
"version": "2.13.39",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ class DomainRoleHandler extends ManageHandler {
|
|||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
async postDelete({ domainId, roles }) {
|
@param('roles', Types.Array)
|
||||||
|
async postDelete(domainId: string, roles: string[]) {
|
||||||
for (const role of roles) {
|
for (const role of roles) {
|
||||||
if (['root', 'default', 'guest'].includes(role)) {
|
if (['root', 'default', 'guest'].includes(role)) {
|
||||||
throw new ValidationError('role');
|
throw new ValidationError('role');
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export interface Types {
|
|||||||
Date: Type,
|
Date: Type,
|
||||||
Time: Type,
|
Time: Type,
|
||||||
Range: (range: Array<string | number> | Dictionary<any>) => Type,
|
Range: (range: Array<string | number> | Dictionary<any>) => Type,
|
||||||
|
Array: Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Types: Types = {
|
export const Types: Types = {
|
||||||
@@ -130,6 +131,10 @@ export const Types: Types = {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Array: [(v) => {
|
||||||
|
if (v instanceof Array) return v;
|
||||||
|
return [v] || [];
|
||||||
|
}, null],
|
||||||
};
|
};
|
||||||
|
|
||||||
function _buildParam(name: string, source: 'get' | 'post' | 'all' | 'route', ...args: Array<Type | boolean | Validator | Converter>) {
|
function _buildParam(name: string, source: 'get' | 'post' | 'all' | 'route', ...args: Array<Type | boolean | Validator | Converter>) {
|
||||||
|
|||||||
Reference in new issue
Block a user