mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
remove domain system
This commit is contained in:
1 parent
7fa4a58abe
commit
fc26af30ef
31 files changed
+709
-1242
No files matched your search
+1
-20
@@ -1,6 +1,6 @@
|
||||
const
|
||||
opcount = require('../model/opcount'),
|
||||
{ PermissionError, PrivilegeError } = require('../error');
|
||||
{ PermissionError } = require('../error');
|
||||
|
||||
module.exports = {
|
||||
requirePerm(perm) {
|
||||
@@ -22,25 +22,6 @@ module.exports = {
|
||||
await next();
|
||||
};
|
||||
},
|
||||
requirePriv(priv) {
|
||||
return async (ctx, next) => {
|
||||
for (let i in arguments) {
|
||||
if (arguments[i] instanceof Array) {
|
||||
let p = false;
|
||||
for (let j in arguments)
|
||||
if (ctx.state.user.hasPriv(arguments[i][j])) {
|
||||
p = true;
|
||||
break;
|
||||
}
|
||||
if (!p) throw new PrivilegeError([arguments[i]]);
|
||||
} else {
|
||||
if (ctx.state.user.hasPriv(arguments[i])) continue;
|
||||
else throw new PrivilegeError([arguments[i]]);
|
||||
}
|
||||
}
|
||||
await next();
|
||||
};
|
||||
},
|
||||
limitRate(op, period_secs, max_operations) {
|
||||
return async (ctx, next) => {
|
||||
await opcount.inc(op, ctx.request.ip, period_secs, max_operations);
|
||||
|
||||
Reference in new issue
Block a user