mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(api): enforce single-role MFA, fix reindex and NCMEC scans (#2080)
This commit is contained in:
1 parent
8d21c97d08
commit
82941c08c9
4 files changed
+72
-16
No files matched your search
@@ -74,9 +74,10 @@ export class GuildMemberValidationService {
|
||||
userId: UserID;
|
||||
targetId: UserID;
|
||||
roleId: RoleID;
|
||||
hasPermission: (permission: bigint) => Promise<boolean>;
|
||||
canManageRoles: (targetUserId: UserID, targetRoleId: RoleID) => Promise<boolean>;
|
||||
}): Promise<void> {
|
||||
const {guildData, guildId, userId, targetId, roleId, canManageRoles} = params;
|
||||
const {guildData, guildId, userId, targetId, roleId, hasPermission, canManageRoles} = params;
|
||||
ensureNotEveryoneRole(roleId, guildId, 'role_id');
|
||||
if (guildData && guildData.owner_id === userId.toString()) {
|
||||
const role = await this.guildRepository.getRole(roleId, guildId);
|
||||
@@ -84,6 +85,9 @@ export class GuildMemberValidationService {
|
||||
throw new UnknownGuildRoleError();
|
||||
}
|
||||
} else {
|
||||
if (!(await hasPermission(Permissions.MANAGE_ROLES))) {
|
||||
throw new MissingPermissionsError();
|
||||
}
|
||||
if (!(await canManageRoles(targetId, roleId))) {
|
||||
throw new MissingPermissionsError();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user