Interface InternalProjectPermissionHelper

All Known Implementing Classes:
DefaultInternalProjectPermissionHelper

public interface InternalProjectPermissionHelper
This helper gathers logic required to switch between two ways of checking permissions to projects. It is required to enable different behaviour when com.atlassian.jira.JiraFeatureFlagRegistrar#HIDE_PROJECTS_WITH_SOME_ISSUES_BROWSE_PERMISSION flag is toggled. If it is enabled projects should be hidden for user with access to only some or no issues.
  • Method Details

    • canUserBrowseProject

      boolean canUserBrowseProject(Project project, ApplicationUser user)
      Checks if the user can see the projects.
      Parameters:
      project - Project to check for 'BROWSE_PROJECTS'.
      user - User to check the permissions for.
      Returns:
      If the user can access the project.
    • hasPermission

      boolean hasPermission(ProjectPermissionKey permissionKey, Project project, ApplicationUser user)
      Permission checker method that differentiates the behaviour only for 'BROWSE_PROJECTS'. Other permissions are unaffected by the flag.
      Parameters:
      permissionKey - Permission that's being checked.
      project - Project against which the permission is tested.
      user - User to check the permissions for.
      Returns:
      If the user can access the project.
    • getBrowsableProjects

      Collection<Project> getBrowsableProjects(ApplicationUser user)
      Gets the list of projects that should be visible for the user based on 'BROWSE_PROJECTS' permission checks. Differentiating based on the FF.
      Parameters:
      user - User to check the permissions for.
      Returns:
      Collection of projects visible to the user.
    • getBrowsableProjectsForProjectAction

      ServiceOutcome<List<Project>> getBrowsableProjectsForProjectAction(ApplicationUser user)
      Gets the list of projects that should be visible for the user based on ProjectAction. Differentiating based on the FF.
      Parameters:
      user - User to check the permissions for.
      Returns:
      Collection of projects visible to the user.
    • getBrowsableProjectsInCategory

      Collection<Project> getBrowsableProjectsInCategory(ApplicationUser user, ProjectCategory projectCategory)
      Gets the list of projects from a given category that should be visible for the user based on 'BROWSE_PROJECTS' permission checks. Differentiating based on the FF.
      Parameters:
      user - User to check the permissions for.
      projectCategory - Category to get the projects from.
      Returns:
      Collection of projects visible to the user.
    • getBrowsableProjectHistory

      List<Project> getBrowsableProjectHistory(ApplicationUser user)
      Gets the history of projects that should be visible for the user based on 'BROWSE_PROJECTS' permission checks. Differentiating based on the FF.
      Parameters:
      user - User to check the permissions for.
      Returns:
      Collection of projects visible to the user.