...
When adding a site to CLI, you provide an Atlassian account credentials or username for running commands. Normally all commands run as this user but sometimes you may want to run a command as another user. Some Jira APIs doesn’t allow a to specify a user for an action but some APIs allow a user to be specified. For example when adding a ‘Vote’ for an issue, you can’t specify which user voting so it always uses the user you have specified when adding the site. But when adding a ‘Watcher’ for an issue, API allows you to specify a user as watcher so you can make another user watch the issue other than the user you specify when configuring the site. Very similarly you can’t specify a user when adding a comment to an issue or when logging work to an issue.
For Cloud there is nothing we can do about it. For Server and DC you can mitigate this by specifying ‘runAs’ parameter to any command. Of course this requires ‘Jira Administrators’ global permission.'Jira Administrators' or 'Jira System Administrator' global permission.
Code Block | ||
---|---|---|
| ||
yarn jira issue:vote TEST-7 //adds a vote for the user specified when configuring site (usually admin)
yarn jira issue:vote TEST-7 --runAs=walterwhite //ads a vote for the user walterwhite |