mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: domainjoin: check domain existance
This commit is contained in:
1 file changed
+2
-1
@@ -5,7 +5,7 @@ import Schema from 'schemastery';
|
|||||||
import type { Context } from '../context';
|
import type { Context } from '../context';
|
||||||
import {
|
import {
|
||||||
CannotDeleteSystemDomainError, DomainJoinAlreadyMemberError, DomainJoinForbiddenError, ForbiddenError,
|
CannotDeleteSystemDomainError, DomainJoinAlreadyMemberError, DomainJoinForbiddenError, ForbiddenError,
|
||||||
InvalidJoinInvitationCodeError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
|
InvalidJoinInvitationCodeError, NotFoundError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
|
||||||
} from '../error';
|
} from '../error';
|
||||||
import type { DomainDoc } from '../interface';
|
import type { DomainDoc } from '../interface';
|
||||||
import avatar from '../lib/avatar';
|
import avatar from '../lib/avatar';
|
||||||
@@ -344,6 +344,7 @@ class DomainJoinHandler extends Handler {
|
|||||||
domain.get(target),
|
domain.get(target),
|
||||||
domain.collUser.findOne({ domainId: target, uid: this.user._id }),
|
domain.collUser.findOne({ domainId: target, uid: this.user._id }),
|
||||||
]);
|
]);
|
||||||
|
if (!ddoc) throw new NotFoundError(target);
|
||||||
const assignedRole = this.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)
|
const assignedRole = this.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)
|
||||||
? 'root'
|
? 'root'
|
||||||
: dudoc?.role || 'default';
|
: dudoc?.role || 'default';
|
||||||
|
|||||||
Reference in new issue
Block a user