Skip to main content

Data Export: Auditing User Account logins, Menu Set & Group Assignments

Data Export: Auditing User Account logins, Menu Set & Group Assignments.

H
Written by Harry Ledger
Updated over 5 months ago

This article shows how to audit what a user has accessed or been assigned in SelectHR, including:

  • What processes and menu items they’ve clicked.

  • Which menu sets they've used or been assigned.

  • Their group assignments (and by whom).

📌 Note: This article only applies to SelectHR version 4.0.

Identify the user number

Before running any audit queries, you’ll need the user’s User Number.

  1. Log into the SelectHR Admin Tool.

  2. Click Import/Export Data, then Create an export definition.

  3. Click Select the data to export.

  4. Change the database to SELECTSYSTEM and log in.

  5. Paste the SQL below:

    SELECT 
    u.[USER NUMBER],
    u.[USER NAME],
    p.[FIRST NAME],
    p.SURNAME,
    p.[E-MAIL]
    FROM SECURITY.USERS u
    LEFT JOIN HR.[PERSON DETAILS] p
    ON u.[PERSON NUMBER] = p.[PERSON NUMBER]
    WHERE u.[USER NAME] = 'CHANGEME';
  6. Click Options > Paste SQL from clipboard.

  7. Replace 'CHANGEME' with the actual Username.

  8. Click the Data tab.

  9. Note the User Number from the results.


Audit user logins

Follow the steps below to audit user logins.

  1. Follow steps 1–4 above.

  2. Change the database to SELECTPERSIST.

  3. Paste the SQL below:

    SELECT 
    a.[AUDIT NUMBER],
    a.[AUDIT DATE],
    a.[KEY NUMBER],
    a.ACTION,
    u.[USER NUMBER],
    u.[PERSON NUMBER],
    u.[USER NAME]
    FROM AUDIT a
    LEFT JOIN SECURITY.USERS u
    ON a.[USER NUMBER] = u.[USER NUMBER]
    WHERE a.ACTION = 'LOGON'
    AND u.[USER NAME] = 'CHANGEME'
    ORDER BY a.[AUDIT DATE] DESC;
  4. Replace 'CHANGEME' with the Username.

  5. Click Data to view the login history.


Audit user menu clicks

This shows which menu items the user clicked and under which menu set.

  1. Use SELECTSYSTEM as the database.

  2. Paste the SQL below:

    SELECT 
    u.[USER NAME],
    uc.[CLICK COUNT],
    mi.[MENU ITEM NAME],
    ms.[MENU SET NAME]
    FROM SECURITY.USERS u
    INNER JOIN WEB.[USER MENU CLICKS] uc
    ON u.[USER NUMBER] = uc.[USER NUMBER]
    INNER JOIN WEB.[MENU ITEMS] mi
    ON mi.[MENU ITEM NUMBER] = uc.[MENU ITEM NUMBER]
    INNER JOIN WEB.[MENU SETS] ms
    ON mi.[MENU SET NUMBER] = ms.[MENU SET NUMBER]
    WHERE u.[USER NAME] = 'CHANGEME'
    ORDER BY uc.[CLICK COUNT] DESC;
  3. Replace 'CHANGEME' with the Username.

  4. Click Data.


Audit group membership and assigners

This section is split into two parts to identify which groups the user has been assigned to and who assigned them.

Find group assignments

  1. Use SELECTPERSIST.

  2. Paste the SQL:

    SELECT 
    a.[AUDIT NUMBER],
    a.[AUDIT DATE],
    a.[OBJECT SCHEMA],
    a.[OBJECT NAME],
    a.ACTION,
    af.[FIELD NAME],
    af.[IS NUMBER],
    u.[USER NAME]
    FROM AUDIT a
    INNER JOIN [AUDIT FIELDS] af
    ON a.[AUDIT NUMBER] = af.[AUDIT NUMBER]
    LEFT JOIN SECURITY.USERS u
    ON a.[USER NUMBER] = u.[USER NUMBER]
    WHERE a.[OBJECT SCHEMA] = 'SECURITY'
    AND a.[OBJECT NAME] = 'GROUP MEMBERSHIPS'
    AND af.[IS NUMBER] = 12345
    ORDER BY a.[AUDIT DATE] DESC;
  3. Replace 12345 with the User Number.

  4. Click Data and note the Audit Numbers and Group Numbers.

Get group names

  1. Use SELECTSYSTEM.

  2. Paste the SQL:

    SELECT 
    g.[GROUP NUMBER],
    g.[GROUP NAME]
    FROM SECURITY.GROUPS g
    WHERE g.[GROUP NUMBER] = 12345;
  3. Replace 12345 with the Group Number(s) found in step 4a.

  4. Click Data to view group names.


Audit user-specific menu set assignments

Find menu sets manually assigned to the user

  1. Use SELECTPERSIST.

  2. Paste this SQL:

    SELECT 
    a.[AUDIT NUMBER],
    a.[AUDIT DATE],
    a.[OBJECT SCHEMA],
    a.[OBJECT NAME],
    a.ACTION,
    af.[FIELD NAME],
    af.[IS NUMBER],
    u.[USER NAME]
    FROM AUDIT a
    INNER JOIN [AUDIT FIELDS] af
    ON a.[AUDIT NUMBER] = af.[AUDIT NUMBER]
    LEFT JOIN SECURITY.USERS u
    ON a.[USER NUMBER] = u.[USER NUMBER]
    WHERE a.[OBJECT SCHEMA] = 'WEB'
    AND a.[OBJECT NAME] = 'USER MENU SETS'
    AND af.[IS NUMBER] = 12345
    ORDER BY a.[AUDIT DATE] DESC;
  3. Replace 12345 with the User Number.

  4. Click Data and note the Audit Numbers.

Identify the menu set names

  1. Use SELECTSYSTEM.

  2. Paste this SQL:

    SELECT 
    ms.[MENU SET NUMBER],
    ms.[MENU SET NAME]
    FROM WEB.[MENU SETS] ms
    WHERE ms.[MENU SET NUMBER] = 12345;
  3. Replace 12345 with the Menu Set Number from step 5a.

  4. Click Data to view the name of the menu set.

Did this answer your question?