const token = await server.login.getAccessToken(username, password)
const me = await server.users.getMyInfo({ token })
- if (me.role !== UserRole.ADMINISTRATOR) {
+ if (me.role.id !== UserRole.ADMINISTRATOR) {
console.error('You must be an administrator.')
process.exit(-1)
}
): { url: string, username: string, password: string } {
const options = program.opts()
- function exitIfNoOptions (options: string[], errorPrefix: string = '') {
+ function exitIfNoOptions (optionNames: string[], errorPrefix: string = '') {
let exit = false
- for (const key of options) {
+ for (const key of optionNames) {
if (!options[key]) {
if (exit === false && errorPrefix) console.error(errorPrefix)