JIRA 7 bug Broken portlets can be fixed individually by editing them and setting However only the dashboard owner can do this, and it's not exactly intuitive. This page describes an ugly, painful process whereby a luckless JIRA administrator can identify broken portlets, log in as each affected user and fix them. It requires root access to the JIRA installation, and the ability to run SQL against the JIRA database. |
Each gadget has key:value parameters stored in the database. The 'fix' process described above results in the portlet gaining a few parameters, notably operation = cumulative
:
Since there's more than operation = cumulative
being added, this doesn't look like something we can fix by hand with SQL. We'll have to go through JIRA.
In the JIRA database:
portalpage
table stores users dashboardportletconfiguration
table stores individual portlets on dashboardsgadgetuserpreference
table stores portlet configuration detailsThe bug affects portlet that have a user preference of isCumulative = true
but don't have the preference operation = cumulative
. So we could identify affected dashboards with the SQL (mysql CONCAT
function used to join strings):
SELECT concat('https://jira.example.com/secure/Dashboard.jspa?selectPageId=', portalpage.id) FROM portalpage JOIN portletconfiguration ON portalpage.id=portletconfiguration.portalpage JOIN gadgetuserpreference ON portletconfiguration.id=gadgetuserpreference.portletconfiguration WHERE gadgetuserpreference.userprefkey='isCumulative' AND gadgetuserpreference.userprefvalue='true' AND NOT EXISTS (SELECT * FROM gadgetuserpreference g WHERE g.portletconfiguration=portletconfiguration.id AND userprefkey='operation' AND userprefvalue='cumulative') ; |
This gives one a list of URLs of problematic dashboards:
... | https://jira.example.com/secure/Dashboard.jspa?selectPageId=10050 | | https://jira.example.com/secure/Dashboard.jspa?selectPageId=10086 | | https://jira.example.com/secure/Dashboard.jspa?selectPageId=10087 | | https://jira.example.com/secure/Dashboard.jspa?selectPageId=10131 | ... |
That's all very well, but a) my JIRA username doesn't have access to see private dashboards, b) only the creator can edit a portlet to fix it.
To be able to fix the broken portlets we've identified, we need to be able to temporarily assume the identity of users.
To do so:
/opt/atlassian/jira/atlassian-jira/
directoryX-JIRA-Userswitcher
HTTP header with your password, when user.jsp
(with any parameters) is requested:user.jsp
in Chrome (https://jira.example.com/user.jsp in this example). You should see the message No such user: null
user=...
paramter. For instance to become admin
, hit https://jira.example.com/user.jsp?user=adminlastPage
parameter to have user.jsp
redirect you somewhere. E.g. https://jira.example.com/user.jsp?user=admin&lastPage=/secure/Dashboard.jspaWe now have the means to log in as a user, view the broken dashboard and fix it.
Here is a variant of the SQL from step 1 which prints a user.jsp
URL:
SELECT distinct concat('https://jira.example.com/user.jsp?lastPage=/secure/Dashboard.jspa?selectPageId=', portalpage.id, '&user=', app_user.lower_user_name) FROM gadgetuserpreference g JOIN portletconfiguration p ON g.PORTLETCONFIGURATION = p.ID JOIN portalpage on p.portalpage=portalpage.id JOIN cwd_user ON portalpage.username=cwd_user.user_name JOIN app_user ON cwd_user.user_name=app_user.user_key WHERE p.GADGET_XML like '%createdvsresolved-gadget.xml' AND g.USERPREFKEY='isCumulative' AND g.USERPREFVALUE='true' AND NOT EXISTS (select * from gadgetuserpreference WHERE portletconfiguration=p.ID AND USERPREFKEY='operation' AND USERPREFVALUE='cumulative'); |
For each URL:
Collection Operation
from 'count' to 'Cumulative':You can re-run the SQL query, whose results should get shorter after each gadget is fixed.
Log out (of whichever user you last became) and back in as yourself.
Finally, uninstall user.jsp
, as it represents a cross-site-scripting attack vector to yourself.