Hi, I was created User Filter Brick and scheduled ...
# gooddata-platform
l
Hi, I was created User Filter Brick and scheduled it for SALE_VEHICLE table. Now I need to set it for other tables but cant find how to do it. Can you help me anybody please? Thanks 🙏
m
Hi Ludek, what exactly do you mean by “set it for other tables”? Are you setting up the User Filters for workspaces in your LCM segment and you have set user filter for one attribute/label and now want to set another user filter for the same set of workspaces in a segment and the same set of users but now on different dataset and attribute? Is that the case? If yes, then one single User Filter Brick can handle multiple user filters. To do it just in the “filters_config” section of its configuration mention more labels and map them to another column in your user filters provisioning table. (the labels is actually an array).
Copy code
{
  "filters_config": {
    "user_column": "login",
    "labels": [
      {
        "label": "label.first_label",
        "column": "filter_column_1"
      },
      {
        "label": "label.second_label",
        "column": "filter_column_2"
      }
    ]
  }
}
then in your user filter provisioning table just add new column (filter_column_2 in this example) and it will handle all the filters at once.
l
Hi Michal, we have multiple tables that we need to filter for specific users. Now the filter is set according to the input table out_l05_lcm_user_filter_brick_dev for the
sale_vehicle
table according to the column
pobocka
(1st att). Now I need to ensure this for other tables as well (e.g. vehicle table and others). Or can this be added by duplicating lines 20-26 defining the other tables? (2nd att) Anything like 3rd att? Thanks
m
One instance of User Filter Brick only reads from one table/query. I do not know what exactly you have in the
out_l05_lcm_user_filter_brick_dev
table and if it also contains information about the other filters you are trying to set up. But if it does, then yes, by duplicating and modifying the highlighted section of the configuration will do it. Just to make it clear, the source table for the user provisioning brick will need to look something like this, so instead of having just one column (currently named “user_filter”) you will have as manu columns as many filters you want to set up. Assuming you want to set your “pobocka” filter and additional “znacka” filter, it will look like this:
Copy code
client_id, login, pobocka, znacka
AAA, alena@aaa.aa, Brno, Skoda
BBB, <mailto:zdenek@bbb.bb|zdenek@bbb.bb>, Praha, Seat
and of course you need to assign the column names properly in your configuration.
alternatively if this would not be possible for whatever reason, you could also schedule another instance of the User Filter Brick and configure it to use the other table, but note this very important thing: the default configuration of the brick is to “*replace all filters in the workspaces by its input*”. That means if you just plainly run one brick and then the other, the second one will remove all the filters added by the first one (because they would not be in the input data of the second brick). So if you with default configuration run brick with data saying that user Alena should have pobocka=Brno. And then run another instance of the brick saying that user Alena should have filter znacka=Skoda (and filter for pobocka will not be mentioned in the data), it will remove the filter for pobocka! To avoid this, there is a parameter (mentioned in the documentation)`do_not_touch_filters_that_are_not_mentioned` which switches the brick into a mode where it will not remove user filters that are not in the input. But note that this also means that it becomes troublesome if you want to remove filter from some user (since that normally means you just remove it from the table). So for this reasons it is highly recommended to use a single run of the brick with multiple columns in the table if you want to handle multiple filters.