Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-21257

Add "authcontext" to Velocity-Context when rendering dashboard.vm

    XMLWordPrintable

Details

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      In the documentation for JIRA you will find a hint how customize the interface depending on the groups a user belongs to.

      Actually this does not work for the dashboard-plugin when rendering dashboard.vm as the context does not know about "authcontext". I would like to see this as default context element there, too.

      Use Case:

      We needed this as workaround for JRA-2364Hide Time Tracking estimates from certain users (e.g. customers) as we had to prevent that customers can add gadgets with time tracking information. Our solution was to set maxGadgets to "0" for them and only allow them to use preconfigured dashboards:

      #if (!$authcontext.user.inGroup('${showtimetracking.groupname}'))
        #set($maxGadgets = 0)
      #end
      

      Where showtimetracking.groupname is set on compilation through resource filtering.

      Workaround:

      As described in Confluence:

      • Add a dependency to the dashboard-plugin-POM:
        <dependency>
          <groupId>com.atlassian.jira</groupId>
          <artifactId>atlassian-jira</artifactId>
          <version>4.X.X</version>
          <scope>provided</scope>
        </dependency>
        
      • Change DashboardView.java to provide the authcontext:
        context.put("authcontext", ComponentManager.getInstance().getJiraAuthenticationContext());
        

      This does the job... but for some reason the UnitTests won't run anymore. I had to disable them with -DskipTests.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              2f5ffb0094a7 Mark Michaelis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: