aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/cli.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/cli.ts')
-rw-r--r--server/tools/cli.ts10
1 files changed, 4 insertions, 6 deletions
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'
3import { join } from 'path' 3import { join } from 'path'
4import { createLogger, format, transports } from 'winston' 4import { createLogger, format, transports } from 'winston'
5import { assignCommands, ServerInfo } from '@shared/extra-utils' 5import { assignCommands, ServerInfo } from '@shared/extra-utils'
6import { getMyUserInformation } from '@shared/extra-utils/users/users' 6import { UserRole } from '@shared/models'
7import { User, UserRole } from '@shared/models'
8import { VideoPrivacy } from '../../shared/models/videos' 7import { VideoPrivacy } from '../../shared/models/videos'
9import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' 8import { getAppNumber, isTestInstance, root } from '../helpers/core-utils'
10 9
@@ -16,16 +15,15 @@ const config = require('application-config')(configName)
16const version = require('../../../package.json').version 15const version = require('../../../package.json').version
17 16
18async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { 17async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) {
19 const accessToken = await server.loginCommand.getAccessToken(username, password) 18 const token = await server.loginCommand.getAccessToken(username, password)
20 const resMe = await getMyUserInformation(server.url, accessToken) 19 const me = await server.usersCommand.getMyUserInformation({ token })
21 const me: User = resMe.body
22 20
23 if (me.role !== UserRole.ADMINISTRATOR) { 21 if (me.role !== UserRole.ADMINISTRATOR) {
24 console.error('You must be an administrator.') 22 console.error('You must be an administrator.')
25 process.exit(-1) 23 process.exit(-1)
26 } 24 }
27 25
28 return accessToken 26 return token
29} 27}
30 28
31interface Settings { 29interface Settings {