For the list of all supported Decision Insight downloads and releases, see the Downloads page.

Filter dashboard data based on the logged-in user

Once you have added users to Decision Insight, you may want to manage what information a user can or cannot see when viewing a dashboard.  In this page, we will show you how to manage the information that is displayed on a dashboard depending on which user is accessing the dashboard. 

Use case

Consider the situation below:

We are using a Payment monitoring application in which we want to limit the data seen by users.

  • User 1 can see payments sent by senders A and B.
  • User 2 can see only payments sent by sender A.
  • User 3 shouldn’t see payments sent by senders A and B.

The deployment is capable of accessing data by filtering on the connected user thanks to the native User entity. Thus, the deployment is able to filter data by user on entire entities. If you want to filter the data displayed on a dashboard based the logged-in user, here is what you can do: 

  1. Create an additional Sender entity. 
  2. Create a relationship between the User entity and the Sender entity. This enables you to filter and aggregate data by user.
  3. Create the route and mapping required to integrate information in the deployment and link a payment to a particular sender

 Note: It is not currently possible to filter data by user on an attribute level. For example, on a pagelet dashboard, it is not possible to have User 1 see the entire contents of the pagelet and User 2 to see only a subset of it.

Create a Sender entity

First, create an entity that you will link to the User entity. Creating that new entity enables you to filter and aggregate data by user.

  1. On the main menu, click the cog icon > Model & configuration.
  2. On the left menu, click Entities.
  3. Click the New Entity button, then click Create. The create entity screen is displayed.
  4. Give your entity the following characteristics: 
    • NameSender
    • Storagereplicated

Add a key to your entity. First, create an attribute to use as your entity key.

  1. On the left menu, click Attributes.
  2. On the You can also create a dropdown, select Observed attribute.
  3. Give your attribute the following characteristics: 
    • NameID
    • TypeString
  4. Click Done
  5. On the left menu, click Keys.
  6. Click the New Key button.
  7. In the Enter title here text box, give a name to your key. For example, KeySender.
  8. Click the Add Attribute button.
  9. Check the ID option, then click Done, Done, then Save

Link the Sender entity to other entities in your model

Update your existing model to look like the one below. 

Link Sender to User

Create a relation from the Sender entity to the User entity.

  1. From the Entities screen, click the pencil icon for the Sender entity. 
  2. On the left menu, click Attributes
  3. In the You can also create a drop-down, select Observed relation
  4. Give your observed relation attribute the following characteristics:
    • Nameauthorize 
    • Reverse name: senders
    • Target entityUser
  5. Click Done, then click Save

Link Payment to Sender

Create a relation from the Payment entity to the Sender entity.

To do so, add an observed relation with the following characteristics to the Payment entity:

  1. From the Entities screen, click the pencil icon for the Payment entity. 
  2. On the left menu, click Attributes
  3. In the You can also create a drop-down, select Observed relation
  4. Give your observed relation attribute the following characteristics:
    • Name: sender
    • Reverse name: payments
    • Uncheck the Multiple tail option.
    • Target entity: Sender
  5. Click Done, then click Save.

Data integration

Once you've created the required entity, use data integration to specify the dependency between the entities and the user. 

Create payments in your application

Create a resource to link payments to senders

In our example, we're using a resource to populate this relation, but in real-life the payments would come from your data integration system. 

Create a .csv file where each line corresponds to a sender ID and the name of the user who's allowed to see payments from this sender.

  1. On the main menu, click the cog icon > Data integration.
  2. On the left menu, click Resources, then the New Resource button.
  3. Create a resource named payments
  4. In the content text field, enter data that corresponds to the user data filtering you want to create. Each line should contain the ID, amount, and sender. You can use the example below:

    ID,amount,sender
    payment1,100,sender1
    payment2,75,sender1
    payment3,26,sender2
    payment4,54,sender2
  5. Click Save.

When you use your resource in a route later on, please be aware that the name of resources is case-sensitive.

Create the mapping for creating the payments

To create a new createPayments mapping:

  1. On the main menu, click the cog icon > Data integration
  2. On the left menu, click Mappings.
  3. Click the New Mapping button.

Add the following parameters:

  • An ID String parameter 
  • sender String parameter
  • An amount Decimal parameter

Add an instance operation: 

  • EntitySender
  • Default times area: Leave default settings as is
  • Resolution area
    1. On the line for Key, from the drop-down, select the Create an instance... option.
    2. On the line for Value, in the drop-down after Parameter, select ID.
  • Operations area
    1. In the Add an operation drop-down, select Change value of an attribute
    2. Select the sender attribute.
    3. On the line for Value, in the drop-down after Parameter, select sender
    4. In the Add an operation drop-down, select Change value of an attribute
    5. Select the amount attribute.

Your mapping should look like this:

Create a route to create the payments

To create a new routing context:

  1. On the main menu, click the cog icon > Data integration
  2. On the left menu, click Routes
  3. Click the New routing context button.

The following is a route based on our current use case:

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <!--Insert link to your resource -->
        <from uri="tnd-resource:payments"/>
        <unmarshal>
            <csv delimiter="," useMaps="true"/>
        </unmarshal>
        <split>
            <simple>${body}</simple>
            <to uri="tnd-absorption:createPayments"/>
        </split>
    </route>
</routes>

Link senders to the users in your application

Create a resource to link senders to the relevant users

Create a resource to define the user security rights. Create a .csv file where each line corresponds to a sender ID and the name of the user who's allowed to see payments from this sender.

  1. On the main menu, click the cog icon > Data integration.
  2. On the left menu, click Resources, then the New Resource button.
  3. Create a resource named security.

  4. In the content text field, enter data that corresponds to the user data filtering you want to create. Each line should contain the name of a sender, followed by the role ID to which the user is associated.

To integrate your resource to the deployment, create the route and mapping necessary.

Create the mapping

To create a new mapping:

  1. On the main menu, click the cog icon > Data integration
  2. On the left menu, click Mappings.
  3. Click the New Mapping button.

Add the following parameters:

  • A name String parameter 
  • user String parameter

Add an instance operation: 

  • EntitySender
  • Default times area: Leave default settings as is
  • Resolution area
    1. On the line for Key, from the drop-down, select the Create an instance... option.
    2. On the line for Value, in the drop-down after Parameter, select name
  • Operations area
    1. In the Add an operation drop-down, select Change value of an attribute
    2. Select the authorize attribute.
    3. On the line for Value, in the drop-down after Parameter, select user

Create a route

To create a new routing context:

  1. On the main menu, click the cog icon > Data integration
  2. On the left menu, click Routes
  3. Click the New routing context button.

The following is a route based on our current use case:

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <!--Insert link to your resource -->
        <from uri="tnd-resource:security"/>
        <unmarshal>
            <csv delimiter="," useMaps="true"/>
        </unmarshal>
        <split>
            <simple>${body}</simple>
            <to uri="tnd-absorption:security"/>
        </split>
    </route>
</routes>

Model your dashboard

We assume that you already have a dashboard set up with all the pagelets you need. Configure that dashboard that a connected user will only see the data that is relevant to them.

Create a user dashboard parameter

  1. With your dashboard in edit mode, click the Settings button.
  2. Click the New parameter button.
  3. Give your new parameter the following characteristics:
    • NamecurrentUser
    • Entity: User
    • Default value: check the option, and in the drop-down,  select Current User.
    • Mandatory: leave the option checked in. 
    • Input mode (Representation area): Hidden
  4. Click Done.

Modify your existing pagelets

Add User as a global dimension

For any pagelet in your dashboard where you want to filter data based on the connected user, make the following modifications to the pagelet:

  1. Add User as a global dimension to the pagelet.
  2. To edit the dimension click the User global dimension box. 
  3. In the filter by time or instance(s) area, select the instance option. Then, in the drop-downs, select parameter, then currentUser
  4. Click Done.

Add the user/entity relationship as a value

Let's say the pagelet you are modifying is one that lists payments and you want users to see only the payments that are assigned to them:

  1. Click the Payment dimension box.
  2. On the left menu, click Filter
  3. Click the Add filter by relation button.
  4. Select the path that enables you to filter the payment by sender and authorized user. It should look something like this:
  5. Click Save. Your pagelet is now configured to display only the values that the logged in user is allowed to see. 

Related Links