public interface

PermissionValidationService

com.atlassian.stash.user.PermissionValidationService

Class Overview

A utility service for plugin developer to validate that the current user has a specific permission. This service uses the PermissionService to check for a permission and will throw AuthorisationException for any failed permission check.

Summary

Public Methods
void validateAuthenticated()
validate that the user is logged in
void validateForGlobal(Permission permission)
validate that the current user has the specified global permission
void validateForProject(Project project, Permission permission)
validate that the current user has the specified permission for the project
void validateForRepository(Repository repository, Permission permission)
validate that the current user has the specified permission for the repository

Public Methods

public void validateAuthenticated ()

validate that the user is logged in

Throws
AuthorisationException if anonymous

public void validateForGlobal (Permission permission)

validate that the current user has the specified global permission

Parameters
permission the requested permission. Must not be null and isGlobal() must be true
Throws
AuthorisationException if the current user is unauthorized

public void validateForProject (Project project, Permission permission)

validate that the current user has the specified permission for the project

Parameters
project the target project. Must not be null
permission the requested permission. Must not be null and isGlobal() must be false
Throws
AuthorisationException if the current user is unauthorized

public void validateForRepository (Repository repository, Permission permission)

validate that the current user has the specified permission for the repository

Parameters
repository the target repository. Must not be null
permission the requested permission. Must not be null and isGlobal() must be false
Throws
AuthorisationException if the current user is unauthorized