UNPKG

@salesforce/plugin-user

Version:

Commands to interact with Users and Permission Sets

59 lines 2.44 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 { Messages } from '@salesforce/core'; import { arrayWithDeprecation, Flags, loglevel, orgApiVersionFlagWithDeprecations, SfCommand, } from '@salesforce/sf-plugins-core'; import { ensureArray } from '@salesforce/kit'; import { assignPSL, print, resultsToExitCode } from '../../../../baseCommands/user/permsetlicense/assign.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-user', 'permsetlicense.assign'); export class ForceUserPermSetLicenseAssignCommand extends SfCommand { static hidden = true; static summary = messages.getMessage('summary'); static description = messages.getMessage('description'); static examples = messages.getMessages('examples'); static state = 'deprecated'; static deprecationOptions = { to: 'org assign permsetlicense', }; static flags = { name: Flags.string({ char: 'n', summary: messages.getMessage('flags.name.summary'), required: true, aliases: ['perm-set-license', 'psl'], }), 'on-behalf-of': arrayWithDeprecation({ char: 'b', summary: messages.getMessage('flags.onBehalfOf.summary'), aliases: ['onbehalfof'], deprecateAliases: true, }), '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(ForceUserPermSetLicenseAssignCommand); const result = await assignPSL({ conn: flags['target-org'].getConnection(flags['api-version']), pslName: flags.name, usernamesOrAliases: ensureArray(flags['on-behalf-of'] ?? flags['target-org'].getUsername()), }); process.exitCode = resultsToExitCode(result); if (!this.jsonEnabled()) { print(result); } return result; } } //# sourceMappingURL=assign.js.map