How to use context group in model V2

Use case : manage user right depending its groups.

For example, you want some admin user to see a specific chart, but basic user not to, on the same report. In a model, you can get the context groups with :

:constants_contextVar_groups_ids

that gives you a string of all the user’s groups ‘18,19,27,600000,2,8’ (Jooma user group ids)

You can use it to check if your user is inside specific group :

SELECT ‘19’ = ANY (string_to_array(:constants_contextVar_groups_ids,',')) 

You can replace ‘19’ with a query that will give you the required group id (cast it as a text)

Finally, use this model for the conditonnal rendering of a grid item.

For v3 :
Put in a custom code :

  • Html :
  • Js : var customStyle = ‘.ii-form-table .red_cell { background-color:#F9ACAA !important;} .green_cell { background-color:#F9ACAA !important;} .orange_cell { background-color:#FCD9B6 !important;} .centered .ii-cell-display{ text-align: center; padding: 0px;}’
    jQuery(window.parent.document.querySelector(‘#ii-grid’)).append(customStyle);

With every class inline