Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-5241

The cache from a project with the Restricting Issue Type behaviour doesn't appear to clear when changing Project using the Create Issue page

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 6.23.0
    • Fix Version/s: 6.26.0
    • Component/s: None
    • Labels:
    • Sprint:
      SR4J Sprint 98
    • Critical Points:
      1

      Description

      If you try using the Restricting Available Issue Types behaviour and switch projects to a project which does not have the behaviour configuration, the Behaviour still works.

      Note: This only occurs when creating an issue using the CreateIssue page and not in the Create Issue popup.

      Steps to Reproduce

      1. Please create a new Behaviour and Map a project to it.
      2. Use the Behaviour Initialiser and paste the code below:-
        import com.atlassian.jira.component.ComponentAccessor
        import com.atlassian.jira.security.roles.ProjectRoleManager
        import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
        
        def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
        def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects
        
        def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
        def issueTypeField = getFieldById(ISSUE_TYPE)
        
        def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
        def availableIssueTypes = []
        
        if ("Developers" in remoteUsersRoles) {
            availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Bug", "Task"] })
        }
        
        if ("Administrators" in remoteUsersRoles) {
            availableIssueTypes.addAll(allIssueTypes.findAll())
        }
        
        issueTypeField.setFieldOptions(availableIssueTypes)
        
      1. Make sure that you have the Administrators and Developers role configured. Else, use alternative roles and modify the code accordingly.
      2. Go to the project that is mapped to the behaviour and add users to that role accordingly.
      3. Login to Jira as a user who is in the Developer group.
      4. Use the CreateIssue page e.g.http://localhost:9092/secure/CreateIssue!default.jspa to create an issue as shown in the image below:-
      5. If the project currently selected on the page does not have the behaviour configuration, it will show all the issue types.
      6. Next, change to a project which has the behaviour configuration and select the issue type. As expected, the issue type will be filtered according to the Behaviour.
      7. Now switch back again to a project that doesn't use the Behaviour and select the issue type.

      Current Behaviour

      When switching between projects that have and do not have the Issue Type Restriction behaviour configuration, the issue type options do not change. It still appears to displays the same restricted issue type list.

      Expected Behaviour

      When the Project is changed and if the project does not have the Issue Type Restriction behaviour, it is expected that all the issue types from the project should be visible.

      Workaround

      For the moment, use the Create issue pop-up to create a new issue and not CreateIssue!default.jspa page. When using the pop-up, if the project is changed, the cache is cleared.

      Additional Info

      Attached is a test video test1.mp4

        Attachments

        1. image1.png
          image1.png
          52 kB
        2. test1.mp4
          3.93 MB

          Activity

            People

            Assignee:
            jechlin Jamie Echlin
            Reporter:
            rkumar Ram Kumar Aravindakshan
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: