【发布时间】:2022-03-08 14:34:30
【问题描述】:
我们为 94 个地区提供了 5 份自定义报告。一项功能授予对这些自定义报告的访问权限。
问题是每个区不应该看到另一个区的报告结果。
目前,唯一的选择是创建 5 * 94 = 470 个自定义报告,为每个区授予一组 5 个。但是,当需要更新报告时,这很麻烦。 TaskDefinitions (Reports) 创建TaskResult 对象(报告的结果)。此外,对于 TaskResult 对象,还会创建一个 JasperReport 对象。打开任务结果时,TaskResult/JasperResult 对象都不会“重新执行”BeanShell。
有没有办法只有 5 个报告并确定结果范围,以便只有该地区的用户才能看到它们?
我有一个示例说明如何根据下面的代码实现这一点,该代码将查看运行报告的人的范围。它只会返回与运行报告的身份在同一范围内的身份
// Retrieve Scope of Executor then filter all Identities on that Scope only
import org.apache.commons.logging.Log;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.Scope;
Identity identity = context.getObjectByName(Identity.class, arguments.get("launcher"));
if (identity != null) {
String scopeName = identity.getAssignedScope().getDisplayableName();
List roleFilters = new ArrayList();
if (scopeName!= null) {
roleFilters.add(Filter.eq("identity.assignedScope.name", scopeName));
}
if (!roleFilters.isEmpty()) {
queryOptions.addFilter(Filter.or(roleFilters));
}
} else {
// When Saving with Preview or Execute the Launcher is empty so all results would be shown.
// This filter will prevent that (creates empty report, it works when executed from the My Reports
queryOptions.addFilter(Filter.eq("identity.name", "xxx"));
}
return queryOptions;
上面代码示例的问题:
这将为 A 组创建报告,但 B 组和 C 组也可以查看它。
因此,最终目标是制作一份任何人都可以运行的报告,但无论涉及哪个用户组(范围),都只能看到与该范围关联的数据。因此,即使 A 组运行,B 组也只能查看 B 组。
【问题讨论】:
-
欢迎来到 Stack Overflow!访问help center,使用tour 了解内容和How to Ask。这个问题似乎比 Stackoverflow 更属于超级用户
-
这很可能需要程序干预,并且如果无法通过开箱即用的功能获得,可能会采用插件的形式 - 有了这些额外的信息,你会仍然指向超级用户论坛?
标签: java jasper-reports beanshell sailpoint