Example scripts
To homepage
Bitbucket

Prevent Project Administrators from changing the Project Key
App in script

ScriptRunner For Bitbucket
by Adaptavist
Compatibility

Bitbucket (6.0 - 7.17)

ScriptRunner For Bitbucket (7.10.0)
Language |
groovy
import com.atlassian.bitbucket.event.project.ProjectModificationRequestedEvent
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.sal.api.user.UserManager
import com.atlassian.sal.api.user.UserKey
def userManager = ComponentLocator.getComponent(UserManager)
def currentEvent = event as ProjectModificationRequestedEvent
if (!userManager.isAdmin(new UserKey(currentEvent.user.name)) && currentEvent.isKeyChanged()) {
currentEvent.cancel("You do not have the correct permissions to change the Project Key.")
}Having an issue with this script?
Report it here