Current Behavior
The option --roles for the command fcli ssc ac create-local-user does not work with the role name. For example:
fcli ssc ac create-local-user --email=john.wick@thecontinental.com --firstname=John --lastname=Wick --password=Change_This_1 --pne --roles=Administrator --username=johnwick
com.fortify.cli.common.rest.unirest.UnexpectedHttpResponseException:
Request: POST https://hostname/ssc/api/v1/localUsers:
Reason: HTTP 400
Body:
message: Invalid role "Administrator" specified.
responseCode: 400
errorCode: -10528
at com.fortify.cli.common.rest.unirest.config.UnirestUnexpectedHttpResponseConfigurer$UnexpectedHttpResponseInterceptor.onResponse(UnirestUnexpectedHttpResponseConfigurer.java:36)
at kong.unirest.CompoundInterceptor.lambda$onResponse$1(CompoundInterceptor.java:48)
at java.base@21.0.2/java.util.ArrayList.forEach(ArrayList.java:1596)
at kong.unirest.CompoundInterceptor.onResponse(CompoundInterceptor.java:48)
at kong.unirest.apache.ApacheClient.request(ApacheClient.java:134)
at kong.unirest.Client.request(Client.java:57)
at kong.unirest.BaseRequest.request(BaseRequest.java:365)
at kong.unirest.BaseRequest.asObject(BaseRequest.java:266)
at com.fortify.cli.ssc.access_control.cli.cmd.SSCUserCreateLocalCommand.getJsonNode(SSCUserCreateLocalCommand.java:72)
at com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCJsonNodeOutputCommand.getJsonNode(AbstractSSCJsonNodeOutputCommand.java:23)
at com.fortify.cli.common.output.cli.cmd.AbstractOutputCommand.getLegacyObjectNodeProducer(AbstractOutputCommand.java:70)
at com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCOutputCommand.getObjectNodeProducer(AbstractSSCOutputCommand.java:49)
at com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCOutputCommand.getObjectNodeProducer(AbstractSSCOutputCommand.java:38)
at com.fortify.cli.common.output.cli.cmd.AbstractOutputCommand.call(AbstractOutputCommand.java:54)
at com.fortify.cli.common.output.cli.cmd.AbstractOutputCommand.call(AbstractOutputCommand.java:45)
at picocli.CommandLine.executeUserObject(CommandLine.java:2118)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2538)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2530)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2492)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2350)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2494)
at com.fortify.cli.common.cli.util.FcliExecutionStrategy.execute(FcliExecutionStrategy.java:61)
at picocli.CommandLine.execute(CommandLine.java:2247)
at com.fortify.cli.app.runner.DefaultFortifyCLIRunner.run(DefaultFortifyCLIRunner.java:89)
at com.fortify.cli.app.FortifyCLI.execute(FortifyCLI.java:42)
at com.fortify.cli.app.FortifyCLI.main(FortifyCLI.java:33)
at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
However, it does work with the role ID.
Expected Behavior
According to the command help message, the option should accept either role name or id.
Steps To Reproduce
Run the following command:
fcli ssc ac create-local-user --email=john.wick@thecontinental.com --firstname=John --lastname=Wick --password=Change_This_1 --pne --roles=Administrator --username=johnwick
Environment
Anything else?
Note that the SSC endpoint POST /localUsers only accepts the role ID.
To fix the issue, either correct the help message (i.e., specify that the --roles option only accepts role IDs) or add functionality to automatically convert the role names to role IDs before hitting the endpoint.
Current Behavior
The option
--rolesfor the commandfcli ssc ac create-local-userdoes not work with the role name. For example:However, it does work with the role ID.
Expected Behavior
According to the command help message, the option should accept either role name or id.
Steps To Reproduce
Run the following command:
fcli ssc ac create-local-user --email=john.wick@thecontinental.com --firstname=John --lastname=Wick --password=Change_This_1 --pne --roles=Administrator --username=johnwickEnvironment
Anything else?
Note that the SSC endpoint
POST /localUsersonly accepts the role ID.To fix the issue, either correct the help message (i.e., specify that the
--rolesoption only accepts role IDs) or add functionality to automatically convert the role names to role IDs before hitting the endpoint.