Relax admin automated account registration
Some checks failed
Lint / pnpm_install (pull_request) Successful in 1m59s
Publish Docker image / Build (pull_request) Successful in 5m0s
Test (backend) / unit (20.16.0) (pull_request) Successful in 7m43s
Lint / lint (backend) (pull_request) Successful in 2m16s
Lint / lint (frontend) (pull_request) Successful in 2m13s
Lint / lint (frontend-embed) (pull_request) Successful in 2m12s
Lint / lint (frontend-shared) (pull_request) Successful in 2m13s
Test (backend) / e2e (20.16.0) (pull_request) Successful in 11m48s
Lint / lint (misskey-js) (pull_request) Failing after 1m2s
Lint / lint (misskey-bubble-game) (pull_request) Successful in 2m22s
Lint / lint (sw) (pull_request) Successful in 2m30s
Lint / lint (misskey-reversi) (pull_request) Successful in 2m46s
Lint / typecheck (backend) (pull_request) Successful in 2m19s
Lint / typecheck (misskey-js) (pull_request) Successful in 2m0s
Lint / typecheck (sw) (pull_request) Successful in 1m58s
Test (production install and build) / production (20.16.0) (pull_request) Failing after 14m9s

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-11-14 02:50:44 -06:00
parent 7748ab5dd0
commit 8b92e89ca1
No known key found for this signature in database

View file

@ -15,6 +15,7 @@ import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { ApiError } from '@/server/api/error.js'; import { ApiError } from '@/server/api/error.js';
import { Packed } from '@/misc/json-schema.js'; import { Packed } from '@/misc/json-schema.js';
import { RoleService } from '@/core/RoleService.js';
export const meta = { export const meta = {
tags: ['admin'], tags: ['admin'],
@ -65,6 +66,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.usersRepository) @Inject(DI.usersRepository)
private usersRepository: UsersRepository, private usersRepository: UsersRepository,
private roleService: RoleService,
private userEntityService: UserEntityService, private userEntityService: UserEntityService,
private signupService: SignupService, private signupService: SignupService,
private instanceActorService: InstanceActorService, private instanceActorService: InstanceActorService,
@ -85,8 +87,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// 初期パスワードが設定されていないのに初期パスワードが入力された場合 // 初期パスワードが設定されていないのに初期パスワードが入力された場合
throw new ApiError(meta.errors.wrongInitialPassword); throw new ApiError(meta.errors.wrongInitialPassword);
} }
} else if ((realUsers && !me?.isRoot) || token !== null) { } else if (!(me?.isRoot) && !await this.roleService.isAdministrator(me)) {
// 初回セットアップではなく、管理者でない場合 or 外部トークンを使用している場合 // 管理者でない場合
throw new ApiError(meta.errors.accessDenied); throw new ApiError(meta.errors.accessDenied);
} }