diff options
Diffstat (limited to 'server/tools')
-rw-r--r-- | server/tools/cli.ts | 10 |
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' | |||
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { createLogger, format, transports } from 'winston' | 4 | import { createLogger, format, transports } from 'winston' |
5 | import { assignCommands, ServerInfo } from '@shared/extra-utils' | 5 | import { assignCommands, ServerInfo } from '@shared/extra-utils' |
6 | import { getMyUserInformation } from '@shared/extra-utils/users/users' | 6 | import { UserRole } from '@shared/models' |
7 | import { User, UserRole } from '@shared/models' | ||
8 | import { VideoPrivacy } from '../../shared/models/videos' | 7 | import { VideoPrivacy } from '../../shared/models/videos' |
9 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' | 8 | import { getAppNumber, isTestInstance, root } from '../helpers/core-utils' |
10 | 9 | ||
@@ -16,16 +15,15 @@ const config = require('application-config')(configName) | |||
16 | const version = require('../../../package.json').version | 15 | const version = require('../../../package.json').version |
17 | 16 | ||
18 | async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) { | 17 | async 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 | ||
31 | interface Settings { | 29 | interface Settings { |