How to restrict the records based on Users?

Sovan
Tera Contributor

Hi,

Greetings of the day!

 

We want to restrict our table records based on users.

Example: User 'XYZ' should see only the records which contain function as 'ABC'.

 

Solution which already applied:

We have created query BR and adding the GPID from the system property. However this should not be scalable because every time when user needs to be added we need to open the BR and property to add those users.

 

Can you please help with other scalable solution to achieve this?

 

Thanks in advance!

10 REPLIES 10

Bert_c1
Kilo Patron

Hi Sovan,

 

I suggest you post the BR logic and the table(s) it is defined for, and specify what a "GPID" is. folks here can then assist.

Below is the BR logic:

1) Created before query BR for table "GBS Role" table (custom)

2) Logic is :

 

if (gs.hasRole("admin")) {
//These users will have access to all roles irrespective of capabilities

} else {
var query_str = '';

//get the users GPID from the property pep.infra.usersGPID

var users = gs.getProperty("x_inpe_gbs_inf.pep.infra.usersGPID").split(",");


//Rules for Functions
if (gs.getUserName() == users[0] || gs.getUserName() == users[1]) { 

query_str = query_str + 'rolefunction=12e47c7a9778e5903bf132471153af3b'; 
}

current.addQuery(query_str);
}

I would replace the business rule with ACL, that would be the right place for restricting access to records.

How we can add the users if we use ACL? We need to create roles for that right.