Hi guys,
This way I can list all the dashboards and all report from reportserver.
GLOBALS.getEntitiesByType(Dashboard.class).each{
Dashboard dashboard = it;
def dashbordName=dashboard.getName();
GLOBALS.getEntitiesByType(Report.class).each{
Report report = it
def reportName = report.getName();
}
}
Is there any way to get the dashboards (and its dadgets) owned by an user?
Rodion
2
Hello Guilherme,
here is the code you need for your issue.
If you have still problems or an another question please feel free and ask.
Best regards,
Rodion
import net.datenwerke.security.service.usermanager.entities.User;
import net.datenwerke.security.service.authenticator.AuthenticatorService;
import net.datenwerke.rs.dashboard.service.dashboard.entities.DashboardContainer;
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dashboard;
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dadget;
import net.datenwerke.rs.dashboard.service.dashboard.DashboardService;
import java.util.List;
AuthenticatorService authenticatorService = GLOBALS.getInstance(AuthenticatorService.class);
def dashboardService = GLOBALS.getInstance(DashboardService.class);
User user = authenticatorService.getCurrentUser();
DashboardContainer dc = dashboardService.getDashboardFor(user);
List<Dashboard> dashes = dc.getDashboards();
for(Dashboard dash : dashes) {
tout.println(dash.getName() + " : " + dash.getId());
for(Dadget dadget : dash.getDadgets() ) {
tout.println(dadget.getId() + " : " + dadget.toString());
}
}
Thank you very much. Worked perfectly