Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SIL - Run Script as ADMIN (or any other) User

Christiam Hernandez November 19, 2018

How can I run scripts as an ADMIN user instead of current user?

 

This concern is pretty important and typical when you are an admin and want to create and manage statistics from issues, eg: post functions that calculate values.

Since ScriptRunner has this option in every script, looks like SIL for Cloud always acts on behalf of the current user, so when the active user has no editing permissions the script will do nothing.

I think this could be enough reason to give up SIL and go for ScriptRunner since there is no way to work with permission schemes

 

2 answers

1 accepted

0 votes
Answer accepted
Christiam Hernandez November 20, 2018

As @Alexey Matveev mentioned in the comments, the only way to execute a Script as a specific user is through Listeners which it will take an enormous work on validation and verification of conditions

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2018

Hello,

You can use the runAs method:

https://confluence.cprime.io/display/SIL/runAs

Christiam Hernandez November 19, 2018

I'm Sorry Alexey, but it's in Jira CLOUD and the checker gives me errors:

Captura de pantalla 2018-11-20 a la(s) 1.44.13 a. m..png

Christiam Hernandez November 19, 2018
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 19, 2018

That is right, This method is not available for Cloud. I asked cPrime about it. I will let you know when I get an answer.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 20, 2018

You can run a listener under a different user. If you could use your code in a listener, then you could run this script under an admin.

Christiam Hernandez November 20, 2018

This is a huge drawback because it takes away the special thing i loved about SIL and power scripts which is the modularization and reusability of code ... with the suggested answer i would have to have a HUGE script verifying which kind of event ocurred (field changed, transition, etc.), check whether is the correct transition or not and then switch-case the piece of code i need to execute depending on the previous conditions.

I don't see this trully worths the effort right now, so i'll give up SIL and continue with ScriptRunner, maybe in the future i'll give the chance again to SIL when its development has been taken further.

Suggest an answer

Log in or Sign up to answer