Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

The availability of the users personal data may be impacted by the recent changes by Atlassian in order to meet GDPR compliance. See the following for more information:

  • This routine is available starting with katl-commons 2.0.6.
  • This routine is available for Jira server and cloud deployment options.
    Info
    titleAvailability
    Table plus
    applyColStyleToCelltrue
    heading0
    columnTypess,s,s,s
    multiplefalse
    columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
    enableSortingfalse

    Syntax

    isUserInRole(user,project, role)

    Package

    Alias

    Pkg Usage

    Description

    Excerpt
    hiddentrue
    Returns "true" if the user has a certain role on the specified project.

    This routine exists starting with Power Scripts for Jira 2.0.6. Before that, you have to get the roles of the user on the project, then check if the necessary role is in the returned list.

    ...

    Returns "true" if the user has a certain role on the specified project.

    Parameters

    Table plus
    applyColStyleToCelltrue
    columnTypess,s,s,s
    heading0
    multiplefalse
    enableSortingfalse

    Parameter name

    Type

    Required

    Description

    User

    String

    Yes

    Username or userkey of the user in question.

    Project key

    String

    Yes

    Key of the selected project.

    Role name

    String

    Yes

    Name of the role that is verified.

    Return

    ...

    Type

    boolBoolean

    Returns "true" if the user has the role on a project and "false" otherwise.

    Example

    Example 1 (Server)

    Code Block
    return isUserInRole("mike", "PRJ", "Developers");
    

    Example 2  (both cloud and server versions)

    Code Block
    return isUserInRole(currentUser(), "PRJ", "Developers");
    

    Example 3  (Cloud)

    Code Block
    return isUserInRole("557058:b540463d-d7fb-43a9-b440-85e1cdbb201e", "PRJ", "Developers");
    

    ...

    Note

    ...

    The look-up is first made after the userkey, then after the username

    ...

    .

    See also

    Filter by label (Content by label)
    showLabelsfalse
    max25
    showSpacefalse
    cqllabel = "jirauser_security_routine" and space = currentSpace ( )
    labelsjiraarray_security_routineroutines