Hide HR case from specific users

GhitaB
Tera Contributor

Hi everyone,

I’m trying to restrict visibility of HR Lifecycle cases (sn_hr_le_case) for a specific population so that i'll be hidden from the portal as well, but I’m seeing unexpected behavior.

i created one ACL 

GhitaB_0-1769419704575.png

GhitaB_1-1769419707720.png

but when impersonating the user and type sn_hr_le_case.LIST he still can see the cases

6 REPLIES 6

Hi @GhitaB ,

if my understanding is correct if the logged in user is a subcontractor from spain they should not be able to see any offboarding cases (or they should not see only their own offboarding cases?)

 

if they should not only their own case you can add a extra condition in the applies to (not in the data condition) that subject person is dynamic ME (ignore this if it's the first case)

 

also check the country field looks like it's a reference field.

 

look at the comments on each line 

 

 

 

answer = (function() {

    // Always allow admins / HR admins
    if (gs.hasRole('admin') || gs.hasRole('sn_hr_admin')) {
        return true;
    }

    // Safety checks
    if (!current.subject_person) {
        return true;
    }

    // Get subject person's HR profil
    var hrProfile = new sn_hr_core.hr_Profile(gs.getUserID(), gs).getCurrentProfile(current.sys_id);


    var employmentType = hrProfile.employment_type + '';
    var country = '';
    if (hrProfile.u_legal_entity && hrProfile.u_legal_entity.u_country)
        country = hrProfile.u_legal_entity.u_country; //isn't u_country a refernce field? looks like it is from the ACL description if yes replace the country value with sysid in the return statement



    return !(employmentType == 'subcontractor' || employmentType == 'Subcontractor') &&
        (country.name == 'Spain' || country == 'put the sysid of the contry here'); //replace with country sysid


})();

 

Note: remove the data condition 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Medi C
Giga Sage

Hi @GhitaB,

 

Could you please check other Read ACLs on the table "sn_hr_le_case"?
Might be access is granted through other ACLs.


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.