...
...
Symptoms:
The dashboard “dashboard” for active user <user> does not exist. For the solution presented, I cannot modify the dashboard to clear the error as it does not exist
Cause:
The CMJ user does not have share permissions to access this dashboard.
Resolution 1:
...
Use the following Groovy script to make only a dashboard with specified ID on the system be accessible to the "jira-administrators" group:
Code Block | ||||
---|---|---|---|---|
| ||||
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.portal.PortalPageManager
import com.atlassian.jira.sharing.SharePermission
import com.atlassian.jira.sharing.SharePermissionImpl
import com.atlassian.jira.sharing.SharedEntity.SharePermissions
import com.atlassian.jira.sharing.type.ShareType.Name
import com.atlassian.jira.util.collect.EnclosedIterable.Functions;
def makeDashboardAccessibleToAdmin(long dashboardId) {
PortalPageManager ppm = ComponentAccessor.getComponent(PortalPageManager.class);
PortalPage portalPage = ppm.getPortalPageById(dashboardId);
Set<SharePermission> permissionsSet = new HashSet<SharePermission>(
portalPage.getPermissions().getPermissionSet()
);
permissionsSet.add(new SharePermissionImpl(null, Name.GROUP, "jira-administrators", null));
ppm.update(PortalPage.portalPage(portalPage).permissions(new SharePermissions(permissionsSet)).build());
}
makeDashboardAccessibleToAdmin(DASHBOARDIDHERE); |
Resolution 2:
You can use this groovy script to make all dashboards global: View file
NB! makeAllDashboardsGlobal returns the ids of all changed dashboards. This list can be used to revert the changes, so save it!
Code Block | ||||
---|---|---|---|---|
| ||||
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.portal.PortalPageManager
import com.atlassian.jira.sharing.SharePermission
import com.atlassian.jira.sharing.SharePermissionImpl
import com.atlassian.jira.sharing.SharedEntity.SharePermissions
import com.atlassian.jira.sharing.type.ShareType.Name
import com.atlassian.jira.util.collect.EnclosedIterable.Functions;
def makeAllDashboardsGlobal() {
def changedIds = [];
PortalPageManager ppm = ComponentAccessor.getComponent(PortalPageManager.class);
for(PortalPage portalPage in Functions.toList(ppm.getAll())) {
Set<SharePermission> permissionsSet = new HashSet<SharePermission>(
portalPage.getPermissions().getPermissionSet()
);
// check if already global
if (!permissionsSet.any { it.getType() == Name.GLOBAL } ) {
changedIds.add(portalPage.getId());
permissionsSet.add(new SharePermissionImpl(Name.GLOBAL, null, null));
ppm.update(PortalPage.portalPage(portalPage).permissions(new SharePermissions(permissionsSet)).build());
}
}
return changedIds;
}
makeAllDashboardsGlobal(); |
You can revert the changes and remove the global permissions with this script.
Code Block | ||||
---|---|---|---|---|
| ||||
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.portal.PortalPage
import com.atlassian.jira.portal.PortalPageManager
import com.atlassian.jira.sharing.SharePermission
import com.atlassian.jira.sharing.SharePermissionImpl
import com.atlassian.jira.sharing.SharedEntity.SharePermissions
import com.atlassian.jira.sharing.type.ShareType.Name
import com.atlassian.jira.util.collect.EnclosedIterable.Functions;
def removeDashboardGlobalPermission(long dashboardId) {
PortalPageManager ppm = ComponentAccessor.getComponent(PortalPageManager.class);
PortalPage portalPage = ppm.getPortalPageById(dashboardId);
Set<SharePermission> permissionsSet = new HashSet<SharePermission>(
portalPage.getPermissions().getPermissionSet());
permissionsSet.removeAll { it.getType() == Name.GLOBAL };
ppm.update(PortalPage.portalPage(portalPage).permissions(new SharePermissions(permissionsSet)).build());
}
def removeDashboardGlobalPermission(List ids) {
for (id in ids) {
removeDashboardGlobalPermission((long)id);
}
}
// Insert actual dashboard ids here!
def ids = [10100, 10101];
removeDashboardGlobalPermission(ids); |