cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
In case when you need to change the owner of multiple dashboards there are few ways:
1) In case all the dashboards are in 1 folder then you can select the folder and export the dashboards.

mceclip0.png

 After what, import the dashboards back under the user to whom you would like to transfer the dashboards. In this case you will need to republish the dashboards to users to whom they were shared before.
2)  Change the user email in the user profile under Admin tab-> Users  - ONLY to a new user. This option will not merge the accounts!
3)Use the script below under Sys.Admin in Web Developers console (F12 in Chrome)
Note, Dashboards and Elasicubes must be shared in advance!
var newOwnersId = "5e5cdc80ecebb629e0c8de85" //New owner, use the REST API to get user ID
$.ajax({
url: '/api/v1/dashboards?fields=oid,owner',
success: function(res) {
console.log(res)
var dashboards = res.filter(function(dash) {
return prism.user._id === dash.owner
})
var dashboardsList = [];
dashboards.forEach(function(dashboard) {
dashboardsList.push(dashboard.oid)
})
if (dashboardsList.length) {
changeOwnership(dashboardsList)
}
}
})
function changeOwnership(dashboardsList) {
var succeed = [];
var failed = []
dashboardsList.forEach(function(dash) {
$.ajax({
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(
{
"ownerId": newOwnersId,
"originalOwnerRule": "edit"
}
),
url: '/api/v1/dashboards/' + dash + '/change_owner?adminAccess=true',
async: false,
success: function(res) {
succeed.push(dash)
},
error: function(res) {
failed.push(dash)
}
})
});
console.log('Dashboard\'s owner was changed successfully for: ');
console.log(succeed);
console.log('Dashboard\'s owner wasn\t changed successfully. Please, try to change owner manually for: ');
console.log(failed);
}
Rate this article:
Comments
pb_si
9 - Travel Pro
9 - Travel Pro

Thanks, a lot of effort to pull this together!

This could work for a 1-off scenario, but I don't think it would be practical in general use 😞

Feels like a something that would be best/easiest addressed in the core product?

fxs7576
9 - Travel Pro
9 - Travel Pro

Hi @intapiuser ,

Really appreciate for sharing this information.

For the changing ownership of the dashboard endpoint, I'm wondering if you know at what point the value of adminAccess should be true.

url: '/api/v1/dashboards/' + dash + '/change_owner?adminAccess=true'

 On some occasions, I received the following message after running that endpoint:

{"error":{"code":101,"message":"Access denied","status":403,"httpMessage":"Forbidden"}} 

 

TriAnthony
Community Team Member
Community Team Member

Hi @fxs7576,

adminAccess=true is needed to access dashboards that are not explicitly shared to the admin user that you are using to call the API. In the case of changing ownership, even if the dashboards are explicitly shared with the admin user, adminAccess=true is still needed to change the ownership of dashboards that the admin user is not the owner of.

Let me know if this is helpful.

-Tri

fxs7576
9 - Travel Pro
9 - Travel Pro

That explains it. Thank @TriAnthony !

Version history
Last update:
‎03-02-2023 08:27 AM
Updated by:
Contributors