Using User Attributes in AML

By using User Attribute in AML, you can mask the data you don't want your users to see, or manipulate how the values will be returned based on User Attribute setup of the current logged in users.

Please follow our examples below to understand more how it works:

Hide user emails if Viewers and Explorers dont't belong to Executive or Regional Manager teams

Use-case

You only want to display sensitive info such as user emails to the Viewers/Explorers who are in Executive or Regional Manager teams.

In this example, you will have Data Model users as below

Data Model  `users`

How-to

There are 3 main steps

  1. Create User Attribute Level and assign approriate level (Executive, Regional Manager, Staff, etc.) to each user
  2. Create custom field email_censored which only allows users who have Level assigned with Executive or Regional Manager to view, hide the original email field
  3. Test your setup

1. Setup User Attributes

You need to create User Attribute level and set an appropriate level for each user.

CEO User Attributes

Staff User Attributes

2. Create email_censored field

In Data Model users, create a new field email_censored which only allows the logged-in users to see the email if 'Executive' or 'Regional Manager' matches one of the values in their User Attribute level. Then hide or delete the original admin_email field, so Explorers or Viewers won't be able to access it.

case(
when:
or(
in('Executive', H.current_user.level),
in('Regional Manager', H.current_user.level)
),
then: ecommerce_users.email,
else: '--- ๐Ÿ˜Ž CENSORED ๐Ÿ˜Ž ---'
)

3. Test

Finally, test your setup in your datasets and dashboards using View and Edit as feature.

CEO's view

Normal staff's view

Display field values based on User Attributes

Use-case

Default GMV is in USD, for users who are in Singapore you want to show GMV in SGD, and for users who are in Vietnam you want to show GMV in VND.

How-to

Firstly, set up User Attribute currency for each user in User Management

Then, in your Data Model or Dataset, create a new field Localized GMV which returns appropriate GMV value according to the currently logged in user's User Attribute currency

case(
when: in('ALL', H.current_user.currency),
then: ecommerce_orders_master.gmv,
when: in('SGD', H.current_user.currency),
then: ecommerce_orders_master.gmv * 1.36,
when: in('VND', H.current_user.currency),
then: ecommerce_orders_master.gmv * 23180,
else:
ecommerce_orders_master.gmv
)

Test your logic with Edit and View as feature