Multi-tenant reports is an Omniscope Evo feature that allows to create a tailored experience for different visitors such as a restricted subset of records according to the user credentials. A guide on how to setup multi tenant report can be found in this article.


As part of setting up multi tenant report you will need to provide the configuration to the report via a report input with some well structured data. This article will describe the format of this data, and the semantics of each field, as well as the mechanism which the report variant is chosen.


The configuration input is read a sequence of "report variant". Each report variant is a collection of conditions and effects.


For example consider the case where, for users members of the group sales and accounting we the report want to only show records where the field department is equals to sales. In this case  the group of the authenticated user being equal to  sales and accounting is the condition whereas the application of the filter group = sales for the report records is the effect.


In order to apply a report variant all conditions must be satisfied. If all conditions are satisfied then all effects will be applied.


A condition field which is not present, or left blank will be considered as a satisfied condition.


N.B. Not every field described below has to be present in the configuration, but fields that are not valid configuration fields are not allowed. Missing conditions will be considered always satisfied.


Multi Tenant configuration format


Conditions:


  • GROUP This column is a condition on the group of the report visitor. It will match if the value of the cell is the same as the name of the group the authenticated user is a member of. It can be left empty meaning any group (or even no group).

  • USER This column is a condition on the user name. It will match if the value of the cell is the same as the name of the user. It can be left empty meaning any user


Effects


  • FILTER The filter column is an effect that will filter . This can be useful to power the report using only some of the records in input (e.g., only those records where the field department is equal to sales).
    If left empty, or the field is not present in the configuration, then no filtering will take place (showing all the records in the report).
    Filters can be represented using two formats namely Simple and JSON.  Each format can be used to represent a filter for all report inputs, or for a specific input (for example apply the filter department = sales for the first input of the report, but the filter country = UK for the third input). You cannot mix the two filter formats within the same cell (but you can use different formats in different records).

    N.B. Filters can only be applied to report input data sources and not to derived data sources.

    Simple filter format This represent the filter as a pair <fieldName> = <value>. <fieldName> needs to be an existing field in the report data source . This format only supports text fields.

    If a single filter is represented, then it will take effects on all the inputs.

    If your report has multiple inputs and you want to specify a different filter for each input, then you can comma separate multiple entries associated to each input.
    For example the value: department = sales, , country = UK is interpreted as department = sales for the first report input, no filter for the second report input, and country = UK for the third input. Note how there is no filter for the second input, and as such the filter for the second input has been left empty ", ,".

    JSON format: This is a more advanced format for cases where the Simple format is not powerful enough. This format will allow you to define filters on all fields types, combination of filters, as well as operators other than equal.
    You can find more details about this format in the Query Apis section In the view designer tutorials, and we there are some examples of filters represented in this format can be found at the bottom of this article.
    If different filters should be applied for different inputs, a json array can be used (again the position in the array will be identify the report input the filter should be applied to).


Miscellaneous


  • NOTES A free note field that can be used as a documentation to describe the report variant. It has no effect in terms of report customisation. 




How Omniscope decides which report variant to apply


Omniscope will look at the multi tenant configuration records, and will try to match the user credentials, against each record. 


For example when the user sally member of the sales and accounting group wants to visualise the report, omniscope will look for a record where the USER column conditions (if any) is satisfied for the user sally the GROUP condition is satisfied for the value sales and conditions. The following records will all match those conditions



So, how does Omniscope determine which scenario to apply when sally accesses the report ? The answer is the first variant that matches all the conditions: Omniscope will scan each variant from top to bottom looking for a match. When a matching variant is found, it will stop looking, and will apply the the effects to the report. In this case, the filter department = sales will be applied to every report input.


If no match is found, than the user will not be able to access the report, and he/she will be asked to provide a different set of credentials


Some examples of Filter using the Json Format


Records where the field department is equal to sales


{

    "type": "FIELD_VALUE",

    "inputField": "department",

    "operator": "EQUALS_IGNORE_CASE",

    "value": "sales"

}



Records where the field department is equal to sales and country is  UK 


{

    "type": "AND",

    "filters": [

        {

            "type": "FIELD_VALUE",

            "inputField": "department",

            "operator": "EQUALS_IGNORE_CASE",

            "value": "sales"

        },

        {

            "type": "FIELD_VALUE",

            "inputField": "country",

            "operator": "EQUALS_IGNORE_CASE",

            "value": "UK"

        }

    ]

}


Records where the field department is equal to sales or years seniority is greater than 3


{

    "type": "OR",

    "filters": [

        {

            "type": "FIELD_VALUE",

            "inputField": "department",

            "operator": "EQUALS_IGNORE_CASE",

            "value": "sales"

        },

        {

            "type": "FIELD_VALUE",

            "inputField": "years seniority",

            "operator": ">",

            "value": 3

        }

    ]

}


Records where department is sales for the first input, and filter all the records from third second input


[

    {

        "type": "FIELD_VALUE",

        "inputField": "department",

        "value": "sales"

    },

    ,

    {

        "type": "OR",

        "filters": []

    }

]


Some examples of multi tenant variant definition


user
groupfilternotes
jane

do not filter any source for user jane

it

[{

        "type": "AND",

        "filters": [{

                "type": "FIELD_VALUE",

                "inputField": "department",

                "operator": "EQUALS_IGNORE_CASE",

                "value": "technology"

            }, {

                "type": "FIELD_VALUE",

                "inputField": "years seniority",

                "operator": ">",

                "value": 3

            }

        ]

    }, {

        "type": "FIELD_VALUE",

        "inputField": "Outage_Region",

        "operator": "EQUALS_IGNORE_CASE",

        "value": "Europe"

    }

]


For members of group it, for the first input show records where department is technology and years seniority is greater than 3,

For the second input, show only records where Outage_Region is Europe
markmarketingdepartment = marketing,For the user mark from and group marketing, show only the records where department is marketing from the first input, and all the records from the second input
maryaccounting[,

{

        "type": "FIELD_VALUE",

        "inputField": "Incident_Duration",

        "operator": ">",

        "value": 100

    }

]
For the user mary of the accounting team, show all the records from the first input, and the records where Incident_Duration is greater than 100 on the second input

accounting[,

{

        "type": "FIELD_VALUE",

        "inputField": "Incident_Duration",

        "operator": ">",

        "value": 200

    }

]
Everybody other member of the accounting team, can sell all the records from the first input, and where Incident_Duration > 200 from the second input