Configuration

Authorization

In Anjana Data, user authorization is based on the assignment of roles to people within organizational units (OUs). This combination determines which actions each user can perform and in which scopes within the platform.

Table User-Ou-Roles in the Configuration Panel (Administrator view)

The management of these assignments is carried out through the Users-OU-Roles table, which acts as the central mechanism for permission control.

image-20251117-180424.png
Screenshot of the Users-OU-Roles table for assigning roles to users in OUs

Structure of the Roles table

Each record in the users_ou_role table defines a unique assignment between a user, an organizational unit and a role.
The elements that characterize this assignment are:

  • user: unique identifier of the user.

    • Corresponds to the id field of the Users table.

  • ou: unique identifier of the Organizational Unit.

    • Corresponds to the id field of the Organizational Unit table.

The assignment must be made at a leaf organizational unit, never at an intermediate or root level. For example, if the unit "Data space/Tourism" has been configured, roles should never be assigned at the "Data space" level

  • role: unique identifier of the role.

    • Corresponds to the id field of the Roles table.

Assigning roles to users

Assigning cross roles

To assign a user a role that has been configured as Cross (see configuration of the Roles table) the following steps must be followed:

  1. Click the New button in the top right corner. This will open an assistant (wizard) with the fields defined in the Structure section.

  2. Fill in the fields as follows:

    1. user: Select the user identifier. If the user does not exist, it must be created beforehand.

    2. ou: Select the default Cross unit. This OU is created internally by the platform; however, if it has been deleted manually, it must be created in order to authorize cross roles.

    3. role: Select the role from among the previously configured roles. If the role does not exist, it must be created beforehand.

  3. Click Save to save the role or Cancel to discard it.

image-20251117-181827.png
Example screenshot of the assignment of a cross role

Assigning vertical roles

To assign a user a vertical role that has not been configured as cross (see configuration of the Roles table), the following steps must be followed:

  1. Click the New button in the top right corner. This will open an assistant (wizard) with the fields defined in the Structure section.

  2. Fill in the fields as follows:

    1. user: Select the user identifier. If the user does not exist, it must be created beforehand.

    2. ou: Select the corresponding leaf organizational unit. If it does not exist, it must be created beforehand.

    3. role: Select the role from among the previously configured roles. If the role does not exist, it must be created beforehand.

  3. Click Save to save the role or Cancel to discard it.

image-20251117-182107.png
Example screenshot of the assignment of a vertical role

Modifying authorizations

To modify the assignment of roles to users in organizational units, this can be done by deleting a record and creating a new one.

Querying and using authorization data in the database (Developer view)

In addition to being configured from the Configuration Panel, the assignment of roles to users is stored in the database and can be queried in read-only mode to use it for analytical purposes. For example, it allows the customer to build their own data mart, dashboards or reports on the authorization of their platform (which users hold which roles in which data domains).

This section is intended for the querying (read-only) of the information. The creation and modification of authorization must always be carried out from the Configuration Panel (administrator view), as described in the previous sections; writing directly to the tables is not recommended.

Table zeus.user_ou_role

The assignment of roles to users is stored in the zeus.user_ou_role table. Each record represents a unique user-organizational unit-role assignment. Its columns, available for querying, are:

Column

Data type

Description

user_id

int4 (INTEGER)

Identifier of the user (foreign key to zeus.users.id_user).

ou_id

int4 (INTEGER)

Identifier of the organizational unit (foreign key to zeus.organizational_unit.id_organizational_unit).

rol_id

int4 (INTEGER)

Identifier of the role (foreign key to zeus.role.id_role).

unique_idx

UNIQUE constraint (user_id, ou_id, rol_id). Ensures that no duplicate assignments exist for the same user-OU-role combination.

The table is joined with the following model tables to resolve identifiers and enrich queries:

Column

Referenced table

Referenced field

Description

user_id

zeus.users

id_user

Resolves the assigned user.

ou_id

zeus.organizational_unit

id_organizational_unit

Resolves the organizational unit (alias / hierarchy).

rol_id

zeus.role

id_role

Resolves the assigned role (role_name).

Query examples

Resolved authorizations (user, organizational unit and role):

SQL
SELECT uor.user_id,
       ou.alias      AS unidad_organizativa,
       r.role_name   AS rol
FROM zeus.user_ou_role uor
JOIN zeus.organizational_unit ou ON uor.ou_id = ou.id_organizational_unit
JOIN zeus."role" r            ON uor.rol_id = r.id_role
ORDER BY uor.user_id;

Roles assigned to a specific user (by their identifier):

SQL
SELECT ou.alias AS unidad_organizativa,
       r.role_name AS rol
FROM zeus.user_ou_role uor
JOIN zeus.organizational_unit ou ON uor.ou_id = ou.id_organizational_unit
JOIN zeus."role" r            ON uor.rol_id = r.id_role
WHERE uor.user_id = 2;

Count of assignments by role (useful as a metric for a data mart):

SQL
SELECT r.role_name,
       COUNT(*) AS asignaciones
FROM zeus.user_ou_role uor
JOIN zeus."role" r ON uor.rol_id = r.id_role
GROUP BY r.role_name
ORDER BY asignaciones DESC;

Important:

  • Use a database user with read-only permissions for these queries. The creation and modification of authorization must always be carried out from the Configuration Panel, in order to maintain referential integrity (users, units and roles) and the caches.

  • Schema, table and column names may evolve between versions of Anjana Data; it is advisable to validate them before building a data mart or reports on this information.