Report data visibility based on role, restriction should only apply to reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 07:29 PM
Hi Experts,
I have report on project_table, the report data visibility should be based on group user is memberof but the restriction should be only on reports.
ex: if iam member of project_asia_group i should see the reports data only based project.mep.region = asia;
below is the business rule,
(function executeBeforeQuery(current, previous /*null when async*/) {
// Assuming the field representing the region is 'account.mep.region'
var userRegions = [];
// Check user's group membership and add corresponding regions to the array
if (gs.getUser().isMemberOf('project_asia_group')) {// Asia Group
userRegions.push('asia_sys_id'); // Asia
}
if (gs.getUser().isMemberOf('project_emea_group')) {// EMEA Group
userRegions.push('emea_sys_id'); // Europe
}
if (gs.getUser().isMemberOf('project_americas_group')) {//Americas Group
userRegions.push('Americas_sys_id'); // Americas
}
// Add a filter condition based on the user's regions to the query
if (userRegions.length > 0) {
current.addQuery('active', true);
current.addQuery('project.mep.region', 'IN', userRegions);
}
})(current, previous);
Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 07:40 PM
Hi @raja_5
in a before query Business Rule you cannot differentiate between viewing data via reports or not.
The proposed solution with "report_view" ACLs by @Ethan Davies will also not help you as in these type of ACLs you only can add roles but no scripts.
My recommendation is to build specialized reports for each of the scenarios and share these reports with the target audience accordingly.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 08:12 PM
Correctly noted that you cannot script for report_view ACLs, I have updated by original response.