Hi
I have added below code for BB script Event handler to restrict user to not to select READ and Write permission to BB projects - default permission.
Below script works good for Write permission(not allowing WRITE permission), but it is allowing READ permission, even though i have this condition in the script.
But i want admin user to give and add users to User access and Group access.
I want to restrict only Default permission - not to allow READ and WRITE permission to the project.
Events selected for Event handler
Events: ProjectPermissionModificationRequestedEvent,ProjectPermissionModifiedEvent
Repositories/Projects (1) :All
import com.atlassian.bitbucket.event.project.ProjectModificationRequestedEvent
import com.atlassian.bitbucket.event.permission.ProjectPermissionModificationRequestedEvent
import com.atlassian.bitbucket.permission.Permission
def event = event as ProjectPermissionModificationRequestedEvent
def project = event.project
def permission = event.permission
// Add projects allowed to be public here
def publicProjects = ["test project"]
if ((permission == Permission.PROJECT_READ || permission == Permission.PROJECT_WRITE) && !(project.key in publicProjects)) {
event.cancel(" Read or Write permission is forbidden for project: $event.project.name")
}Thanks for your help in advance and appreciate it.