You are not logged in.
Pages: 1
Good Day People,
I have created a dashboard for around 850 users. it is linked with their user profile. Now I have to delete that specific dashboard from all users.
How will I delete the dashboard from the users profile without login in with all 850 users and delete it there?
I have looked at the database structure but not sure where to delete it from. There is so many tables linking to a dashboard.
Offline
Hi stephie22,
you can run a script for this purpose. Here is a script I used for resetting the dashboard of all users, so you can write a similar script:
import net.datenwerke.security.service.usermanager.entities.User;
import net.datenwerke.rs.dashboard.service.dashboard.DashboardService;
import net.datenwerke.rs.dashboard.service.dashboard.entities.DashboardContainer;
import net.datenwerke.rs.dashboard.service.dashboard.entities.DashboardReference;
import net.datenwerke.security.service.usermanager.UserManagerService;
import net.datenwerke.rs.dashboard.service.dashboard.entities.DashboardNode;
import net.datenwerke.security.service.security.SecurityService;
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dadget;
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dashboard;
import net.datenwerke.security.service.security.rights.Read;
import net.datenwerke.rs.utils.entitycloner.EntityClonerService;
UserManagerService userManagerService = GLOBALS.getRsService(UserManagerService.class);
DashboardService dashboardService = GLOBALS.getRsService(DashboardService.class);
SecurityService securityService = GLOBALS.getRsService(SecurityService.class);
EntityClonerService entityCloner = GLOBALS.getRsService(EntityClonerService.class);
/* Reset all imported dashboards for all users. */
for (User user: userManagerService.getAllUsers()) {
DashboardContainer container = dashboardService.getDashboardFor(user);
// we only reset the first dashboard, since this is the default dashboard. It must be a DashboardReference, i.e. imported
if (!container.getDashboards().isEmpty() && container.getDashboards().get(0) instanceof DashboardReference) {
DashboardReference dashboardReference = (DashboardReference)container.getDashboards().get(0)
DashboardNode node = dashboardReference.getDashboardNode();
if(null == node)
throw new IllegalStateException("Corresponding dashboard node not found.");
if(! securityService.checkRights(node, Read.class))
throw new IllegalArgumentException("Insufficient rights to read dashboard");
for(Dadget d : new ArrayList<>(dashboardReference.getDadgets())){
dashboardReference.removeDadget(d);
dashboardService.remove(d);
}
/* copy dashboard */
dashboardReference.setName(node.getName());
dashboardReference.setDescription(node.getDescription());
dashboardReference.setLayout(node.getDashboard().getLayout());
dashboardReference.setSinglePage(node.getDashboard().isSinglePage());
for(Dadget d : node.getDashboard().getDadgets()){
Dadget dClone = entityCloner.cloneEntity(d);
dashboardService.persist(dClone);
dashboardReference.addDadgetPlain(dClone);
}
dashboardService.merge(dashboardReference);
}
}
You can use the container.getDashboards() for getting access to the user dashboards. Then you can iterate this list and delete the needed dashboards. For deleting, you can use dashboardService.remove(dashboard).
Cheers,
Eduardo
Offline
Good Day Eduardo,
Thank you for the response.
From where did you run the script from?
it looks from within visual studio, but I might be wrong?
I just want to know, where I would read it from, so I can make a script
Offline
what can I do if I want to reset the all dashboards for all users? and where would I run the script?
Offline
Hi stephie22,
you can run the script from the reportserver terminal with "exec -c yourscript.groovy". The -c flag is used for commiting your changes. You can open the terminal by CTRL+ALT+T.
Please note that for running scripts you need reportserver enterprise (or the enterprise demo).
More information here:
Getting started with scripting: https://reportserver.net/en/tutorials/t … scripting/
Scripting guide: https://reportserver.net/en/guides/script/main/
Cheers,
Eduardo
Offline
Good Day Eduardo,
So if we are using the community version, you wont be able to use the scripting method to get rid of the dashboards from the user profiles?
Offline
Hi stephie22,
no, scripting is only available in the Enterprise Edition, you can take a look at the differences between these two here: https://reportserver.net/en/pricing/
If you have 850-900 users you may consider acquiring the enterprise edition, since it gives you many powerful features, e.g. scripting.
Alternatively, you can download the enterprise demo, and run your script for deleting the dashboards. Then you can continue using the community edition if you don't need the enterprise edition, since you probably have to delete the dashboards once. After the demo period, your enterprise edition downgrades automatically to a community edition.
Cheers,
Eduardo
Offline
Hi Eduardo,
By downloading the enterprise demo version, that would require resetup of the reportserver then, what about all the users I have created etc?
and there is no way other than using a script to delete the dashboard from the users profile?
Offline
Hi stephie22,
first, you could try with this:
download the binaries and copy the reportserverenterprise.jar file to C:\Bitnami\reportserverenterprise-3.0.2-6\apache-tomcat\webapps\reportserver\WEB-INF\lib
Then restart your tomcat/reportserver. This should upgrade your installation to an enterprise installation.
If this doesn't work, please let me know.
No, deleting the dashboard for 850/900 users can only be done either manually or by scripting.
Cheers,
Eduardo
Offline
will there be a function later on to be able to do stuff like this in community/enterprise, where you can upload/delete dashboard for multiple users at a time?
Offline
Hi stephie22,
no, this is not planned at the moment, since you can achieve this functionality with a simple script. Morover, dashboards are user-specific, and you shouldn't change dashboards of users periodically, since they will probably ask the administrator why their dashboard is gone/has changed. This is more a 1-time-action, and this can be achieved with a script.
Cheers,
Eduardo
Offline
another question that I have, if I have created under Dadget Library, a folder Dealers, and then added the Dealer dashboard under the folder. I then assigned the dashboards to each user. but now, just by looking at the database, there is so many tables which point to this and that, but how will I be able to see which user was added which dashboard? I see theres tables called dashboard_user, dashboard_user_a, dashboard container etc, etc. its a bit confusing to me. but what I need to know is which user, was added which dashboard.
Offline
Hi stephie22,
this, again, can be achieved with a simple script:
pseudocode:
for all users u: for all dashboards d from user u: print u.name, d.name
Trying to understand the DB-schema may be confusing and is not recommended to work directly with it. If you want to know what happens there, you can open the dashboard-tables, copy their contents to excel, then manually add the dashboard to a user, open the tables again, copy them again to excel, and see what changed by comparing them to their previous version. So you can analyze them by taking a look at the IDs added, references, etc.
Cheers,
Eduardo
Offline
Pages: 1