Interface AuthorityHolder

    • Method Detail

      • isPermissionGrantedGlobally

        boolean isPermissionGrantedGlobally​(@NotNull
                                            Permission permission)
        Returns true if specified permission granted globally (i.e. not associated with any particular object)
        Parameters:
        permission - permission to check
        Returns:
        true or false
      • getGlobalPermissions

        @NotNull
        Permissions getGlobalPermissions()
        Returns all granted non-project related permissions and all project-related permissions granted globally
        Returns:
        see above
      • getProjectsPermissions

        @NotNull
        java.util.Map<java.lang.String,​Permissions> getProjectsPermissions()
        Returns map of project-related permissions that were granted for a particular project. Project internal id is used as the key.
        Returns:
        map of project permissions
      • getAllPermissions

        @NotNull
        default com.intellij.openapi.util.Pair<Permissions,​java.util.Map<java.lang.String,​Permissions>> getAllPermissions()
        Returns both global and project permissions at once.
        Returns:
        a pair of global and project permissions.
        Since:
        2022.10
      • isPermissionGrantedForProject

        boolean isPermissionGrantedForProject​(@NotNull
                                              java.lang.String projectId,
                                              @NotNull
                                              Permission permission)
        Returns true if permission is granted for a project, i.e. the result is true if there is a project related permission granted globally or for specified project
        Parameters:
        projectId - project internal id
        permission - permission to check
        Returns:
        see above
      • isPermissionGrantedForAnyProject

        boolean isPermissionGrantedForAnyProject​(@NotNull
                                                 Permission permission)
        Returns true if specified permission is granted for at least one project
        Parameters:
        permission - permission to check
        Returns:
        see above
      • isPermissionGrantedForAnyOfProjects

        boolean isPermissionGrantedForAnyOfProjects​(@NotNull
                                                    java.util.Collection<java.lang.String> projectIds,
                                                    @NotNull
                                                    Permission permission)
        Returns true if specified permission is granted for at least one project from the given collection
        Parameters:
        permission - permission to check
        Returns:
        see above
      • getPermissionsGrantedForProject

        @NotNull
        Permissions getPermissionsGrantedForProject​(@NotNull
                                                    java.lang.String projectId)
        Returns all permissions granted for particular project. These include permissions granted specifically for the specified project and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Parameters:
        projectId - project internal id
        Returns:
        all granted permissions for particular project
      • getPermissionsGrantedForAllProjects

        @NotNull
        Permissions getPermissionsGrantedForAllProjects​(@NotNull
                                                        java.util.Collection<java.lang.String> projectIds)
        Returns all permissions granted for all projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Parameters:
        projectIds - collection of project internal ids
        Returns:
        all granted permissions for all projects
      • getPermissionsGrantedForAnyOfProjects

        @NotNull
        Permissions getPermissionsGrantedForAnyOfProjects​(@NotNull
                                                          java.util.Collection<java.lang.String> projectIds)
        Returns union of permissions granted for projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Parameters:
        projectIds - collection of project internal ids
        Returns:
        all granted permissions for all projects
        Since:
        2017.2
      • getAssociatedUser

        @Nullable
        User getAssociatedUser()
        Returns the user object associated with the principal.
        Returns:
        may be null if the authority holder is not a user.
      • hasAllPermissionsOf

        boolean hasAllPermissionsOf​(@NotNull
                                    AuthorityHolder authorityHolder)
        Returns true if this authority holder has all permissions of another authority holder.
        Parameters:
        authorityHolder -
        Returns:
        see above
        Since:
        2022.10