Message-ID: <795371424.15623.1711716327469.JavaMail.confluence@ip-172-16-1-18.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15622_1777905515.1711716327468" ------=_Part_15622_1777905515.1711716327468 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Case Study: Adding Data Security to Show the Direct Reports of t= he Direct Reports

Case Study: Adding Data Security to Show the Direct Reports of the = Direct Reports

Note:  This is applicable to Totara only.<= /p>

When you want to only show the immediate direct reports for your = Managers, adding the managers.xml Data Security file to your existing Data = Source can solve the problem for you. For more information, please review t= his page: Zoola Data Source & Security File Mappings= .

For scenarios where you want the report to go deeper into the Manager-Em= ployee hierarchy [ VPs see Directors and their direct reports (Managers) an= d any direct report of the Managers (employees) ] you can add the following= Derived Table to your Data Source. Once you have saved the Derived Table, = you must INNER JOIN it to a table that has a user id (i.e. mdl_user). = For anyone runnning the report, this will restrict the resulting report to= only show your data and anyone below you in the Manager-Employee hi= erarchy.


=20
SELECT =
boss.id AS bossid, mja.*
FROM mdl_job_assignment mja
JOIN (SELECT id
      FROM mdl_job_assignment
      WHERE userid =3D { attribute ('userid') }) boss  ON (    mja.managerj=
apath LIKE CONCAT('%/', (boss.id), '/%')
=09=09=09=09=09=09=09=09=09=09=09=09=09=09  OR mja.managerjapath LIKE CONCA=
T('%/', (boss.id))
                                                        )
=20
------=_Part_15622_1777905515.1711716327468--