From 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Jul 2021 14:23:01 +0200 Subject: Introduce user command --- server/tools/cli.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'server/tools/cli.ts') diff --git a/server/tools/cli.ts b/server/tools/cli.ts index 3e0e03b97..17c2e8c74 100644 --- a/server/tools/cli.ts +++ b/server/tools/cli.ts @@ -3,8 +3,7 @@ import { Netrc } from 'netrc-parser' import { join } from 'path' import { createLogger, format, transports } from 'winston' import { assignCommands, ServerInfo } from '@shared/extra-utils' -import { getMyUserInformation } from '@shared/extra-utils/users/users' -import { User, UserRole } from '@shared/models' +import { UserRole } from '@shared/models' import { VideoPrivacy } from '../../shared/models/videos' import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' @@ -16,16 +15,15 @@ const config = require('application-config')(configName) const version = require('../../../package.json').version async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { - const accessToken = await server.loginCommand.getAccessToken(username, password) - const resMe = await getMyUserInformation(server.url, accessToken) - const me: User = resMe.body + const token = await server.loginCommand.getAccessToken(username, password) + const me = await server.usersCommand.getMyUserInformation({ token }) if (me.role !== UserRole.ADMINISTRATOR) { console.error('You must be an administrator.') process.exit(-1) } - return accessToken + return token } interface Settings { -- cgit v1.2.3