Adaptavist Only Allow From Groups

Created by Jamie Echlin
package com.onresolve.stash.groovy.test.listeners.STASH_3850_block_personal

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.stash.event.RepositoryCreationRequestedEvent
import com.atlassian.stash.project.ProjectType
import com.atlassian.stash.user.UserService

// only allow from groups,
def userService = ComponentLocator.getComponent(UserService.class)

def event = event as RepositoryCreationRequestedEvent
def project = event.repository.project

if (project.type == ProjectType.PERSONAL) {
    if (! userService.isUserInGroup(event.getUser(), "personal-project-creators")) {
        event.cancel("You don't have permissions to create a personal repository.")

Comments (0)


You can clone a snippet to your computer for local editing. Learn more.