Can DA limit field by user?

Consider a member table that has fields like
id email password

I want to grant all fields access to those who have session with same id field value

if it is not, i want to grant only email field.

is this possible only by relativity server and business rule scripting?

and lastly, if i make an java web app with da client for java, what is the best practice to generate json representation of datatable?
i want to return a json string to my api request regarding the DA query results.

Thank you in advance

Hello

Let’s start with easier part:

You’d need to set the Relativity Domain’s Data Stramer Type to JSON and to access the Relativity Server via JSON endpoint (the default Relativity access address is http://localhost:7099/bin and JSON can be accessed at http://localhost:7099/json )

This is a bit more complex.

You’ll need to use some Business Scripting.

Split the table in question into two - one with all fields (user will be able to select one and only one line from that Schema table) and another one with fields available for all users.

The idea is to auto-filter out the 1st table so user will be able to select only the line containing his info.

Add a global script handler for the Schema that looks like

// Called before a request for data is sent
function beforeGetData(names, requestInfos)
{
    // Disallow any DA SQL requests
    if (requestInfos[0].sql)
    {
      fail('DA SQL is not allowed');
    }
    
    // Add checks for name here
    requestInfos[0].whereBuilder = WhereBuilder.createBinary(WhereBuilder.createField('Name'), WhereBuilder.createConstant(session['Relativity.UserName']), 'Equal');
}

session[‘Relativity.UserName’] here is the name user used to log on into the Relativity Server. It is automatically filled during the logon process.

Note - this code is oversimplified. You’ll need to go over entire requestInfos array and perform check for the sql field and then set the filter only if the target table name matches to one you need to filter (in the code above filter is added w/o that check).

Regards