Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

event handler for ProjectPermissionModificationRequestedEvent

prayag singh February 25, 2019

I want to implement event handler for ProjectPermissionModificationRequestedEvent, for that I need to compare event.newValue with the string "PROJECT_ADMIN" or other project related permissions.

I have tried 

if(event.newValue == "PROJECT_ADMIN")
{
do something
}
else
{
event.cancel("custom msg")
}

 

But this is not as expected, like even if the value of event.newValue is PROJECT_ADMIN (as printed through log.warn() ) if block doesn't get executed.

Kindly someone suggest the method to achieve the same.

Thanks.

2 answers

1 accepted

0 votes
Answer accepted
Joanna Choules
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.
February 27, 2019

Hi Prayag,

I think the reason this is not working as expected is because event.newValue is not a String, but rather a Permission. To check its value you will therefore need to do something like the following:

import com.atlassian.bitbucket.permission.Permission

if (event.newValue == Permission.PROJECT_ADMIN) { /* etc. */ }

Hope this helps!

Joanna Choules, Adaptavist Product Support

0 votes
prayag singh February 27, 2019

Thanks @Joanna Choules ,I will use that.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events