#1 2024-09-23 14:14:51

arnole
Member
Registered: 2024-07-01

Is it possible to limit report display for guests?

Hello,

We have created some reports variants with parameters, and these variants are imported in some teamspaces.
When a teamspace guest opens one of these variants, he has access to some tabs that I don't want for him.
He can access to "parameters" and that's okay, but he can use "computed columns", "pre-filter", "configure list" and I don't want him to use it.
Is there a way to limit these functions for theses users?
I have see that I can "config protect" the report, but with that, he can't use "parameters", and that's a problem.

Furthermore, he has access to "Excel-export" and that's okay, but he can use "send to" and I don't want that, so same question for that.

Thanks in advance
Arnaud

Offline

#2 2024-10-08 12:41:47

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Is it possible to limit report display for guests?

Hi Arnaud,

there is currently no way to achieve this out-of-the-box. You can try with scripting in a similar way as we prohibit some things in the DEMO system:

prohibitcreatedashboard.groovy

import net.datenwerke.rs.utils.eventbus.EventBus
import net.datenwerke.rs.utils.eventbus.EventHandler
import net.datenwerke.security.service.eventlogger.jpa.PersistEntityEvent
import net.datenwerke.security.service.eventlogger.jpa.MergeEntityEvent
import net.datenwerke.security.service.eventlogger.jpa.RemoveEntityEvent
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dashboard
import net.datenwerke.rs.scripting.service.scripting.scriptservices.Deregistrar
import net.datenwerke.rs.dashboard.service.dashboard.entities.Dadget

EventBus eventBus = GLOBALS.getInstance(EventBus)

def handler = [
			handle: {e -> throw new RuntimeException('Editing the dashboard is prohibited. Please press F5 to refresh.')}
		] as EventHandler

def deregister = [
  deregister: { o -> 
	eventBus.detachObjectEventHandler(PersistEntityEvent, Dashboard, handler)
	eventBus.detachObjectEventHandler(MergeEntityEvent, Dashboard, handler)
	eventBus.detachObjectEventHandler(RemoveEntityEvent, Dashboard, handler)
    
    eventBus.detachObjectEventHandler(RemoveEntityEvent, Dadget, handler)
    eventBus.detachObjectEventHandler(MergeEntityEvent, Dadget, handler)
    eventBus.detachObjectEventHandler(RemoveEntityEvent, Dadget, handler)
  }
] as Deregistrar


GLOBALS.services.callbackRegistry.forceRegisterCallback(
		"prohibitDashboardPersist", handler, deregister);

eventBus.attachObjectEventHandler(PersistEntityEvent.class, Dashboard.class, handler);  
eventBus.attachObjectEventHandler(MergeEntityEvent.class, Dashboard.class, handler);
eventBus.attachObjectEventHandler(RemoveEntityEvent.class, Dashboard.class, handler);  

eventBus.attachObjectEventHandler(RemoveEntityEvent, Dadget, handler)
eventBus.attachObjectEventHandler(MergeEntityEvent, Dadget, handler)
eventBus.attachObjectEventHandler(RemoveEntityEvent, Dadget, handler)


prohibiteditreport.groovy

import net.datenwerke.rs.utils.eventbus.EventBus
import net.datenwerke.rs.utils.eventbus.EventHandler
import net.datenwerke.security.service.eventlogger.jpa.PersistEntityEvent
import net.datenwerke.security.service.eventlogger.jpa.MergeEntityEvent
import net.datenwerke.security.service.eventlogger.jpa.RemoveEntityEvent
import net.datenwerke.rs.core.service.reportmanager.entities.reports.Report
import net.datenwerke.rs.scripting.service.scripting.scriptservices.Deregistrar
import net.datenwerke.security.service.authenticator.AuthenticatorService

def authenticatorService = GLOBALS.getInstance(AuthenticatorService)
EventBus eventBus = GLOBALS.getInstance(EventBus)

def handler = [
			handle: {e -> 
              der user = authenticatorService.currentUser
              if (!user.superUser)
              	throw new RuntimeException("Editing reports is prohibited in the demo system.")}
		] as EventHandler;

def deregister = [
  deregister: { o -> 
	eventBus.detachObjectEventHandler(PersistEntityEvent.class, Report.class, handler);  
	eventBus.detachObjectEventHandler(MergeEntityEvent.class, Report.class, handler);  	
	eventBus.detachObjectEventHandler(RemoveEntityEvent.class, Report.class, handler);
  }
  ] as Deregistrar;


GLOBALS.services.callbackRegistry.forceRegisterCallback(
		"prohibitEditReport", handler, deregister);

eventBus.attachObjectEventHandler(PersistEntityEvent.class, Report.class, handler);  
eventBus.attachObjectEventHandler(MergeEntityEvent.class, Report.class, handler);
eventBus.attachObjectEventHandler(RemoveEntityEvent.class, Report.class, handler);  	

Regards,
Eduardo

Offline

Board footer

Powered by FluxBB