UNPKG

@salesforce/plugin-user

Version:

Commands to interact with Users and Permission Sets

64 lines 2.57 kB
/* * Copyright (c) 2020, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { arrayWithDeprecation, Flags, loglevel, orgApiVersionFlagWithDeprecations } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { ensureArray } from '@salesforce/kit'; import { UserPasswordGenerateBaseCommand } from '../../../../baseCommands/user/password/generate.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-user', 'password.generate'); export class ForceUserPasswordGenerateCommand extends UserPasswordGenerateBaseCommand { static summary = messages.getMessage('summary'); static description = messages.getMessage('description'); static examples = messages.getMessages('examples'); static state = 'deprecated'; static deprecationOptions = { to: 'org generate password', }; static hidden = true; static flags = { 'on-behalf-of': arrayWithDeprecation({ aliases: ['onbehalfof'], deprecateAliases: true, char: 'o', summary: messages.getMessage('flags.onBehalfOf.summary'), }), length: Flags.integer({ char: 'l', summary: messages.getMessage('flags.length.summary'), min: 8, max: 1000, default: 13, }), // the higher the value, the stronger the password complexity: Flags.integer({ char: 'c', summary: messages.getMessage('flags.complexity.summary'), min: 0, max: 5, default: 5, }), 'target-org': Flags.requiredOrg({ char: 'u', summary: messages.getMessage('flags.target-org.summary'), aliases: ['targetusername'], deprecateAliases: true, required: true, }), 'api-version': orgApiVersionFlagWithDeprecations, loglevel, }; async run() { const { flags } = await this.parse(ForceUserPasswordGenerateCommand); return this.generate({ usernames: ensureArray(flags['on-behalf-of'] ?? flags['target-org'].getUsername()), length: flags.length, complexity: flags.complexity, conn: flags['target-org'].getConnection(flags['api-version']), }); } } //# sourceMappingURL=generate.js.map