prevent deletion or suspension of system accounts
This commit is contained in:
parent
934e007698
commit
a790fef261
9 changed files with 72 additions and 3 deletions
|
|
@ -13,6 +13,7 @@ import { GlobalEventService } from '@/core/GlobalEventService.js';
|
|||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { isSystemAccount } from '@/misc/is-system-account.js';
|
||||
|
||||
@Injectable()
|
||||
export class DeleteAccountService {
|
||||
|
|
@ -38,6 +39,7 @@ export class DeleteAccountService {
|
|||
}, moderator?: MiUser): Promise<void> {
|
||||
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });
|
||||
if (_user.isRoot) throw new Error('cannot delete a root account');
|
||||
if (isSystemAccount(_user)) throw new Error('cannot delete a system account');
|
||||
|
||||
if (moderator != null) {
|
||||
this.moderationLogService.log(moderator, 'deleteAccount', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue