mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
domain: permission: filter out placeholder bit
This commit is contained in:
1 file changed
+5
-2
@@ -224,7 +224,10 @@ class DomainPermissionHandler extends ManageHandler {
|
|||||||
: (typeof list === 'object' && list)
|
: (typeof list === 'object' && list)
|
||||||
? Object.values(list) : [list];
|
? Object.values(list) : [list];
|
||||||
roles[role] = 0n;
|
roles[role] = 0n;
|
||||||
for (const r of perms) roles[role] |= 1n << BigInt(r);
|
for (const r of perms) {
|
||||||
|
if (+r === 1000) continue; // skip placeholder value
|
||||||
|
roles[role] |= 1n << BigInt(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
domain.setRoles(domainId, roles),
|
domain.setRoles(domainId, roles),
|
||||||
@@ -391,7 +394,7 @@ class DomainJoinHandler extends Handler {
|
|||||||
const groups = await user.listGroup(target);
|
const groups = await user.listGroup(target);
|
||||||
const entry = groups.find((i) => i.name === this.joinSettings.group);
|
const entry = groups.find((i) => i.name === this.joinSettings.group);
|
||||||
if (!entry) throw new ValidationError('group');
|
if (!entry) throw new ValidationError('group');
|
||||||
await user.updateGroup(target, entry.name, entry.uids.concat(this.user._id));
|
await user.updateGroup(target, entry.name, [...entry.uids, this.user._id]);
|
||||||
}
|
}
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
domain.setUserInDomain(target, this.user._id, {
|
domain.setUserInDomain(target, this.user._id, {
|
||||||
|
|||||||
Reference in new issue
Block a user