In Moodle 3.9 (other versions may differ, but file is probably the same), you can find the permissions for those links in admin/settings/users.php lines 242 and 243
The following permissions are used for assign system roles:
$ADMIN->add('roles', new admin_externalpage('assignroles', new lang_string('assignglobalroles', 'role'), "$CFG->
wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, '
moodle/role:assign'));
The following permissions are used for check system permissions:
$ADMIN->add('roles', new admin_externalpage('checkpermissions', new lang_string('checkglobalpermissions', 'role'), "$CFG->
wwwroot/$CFG->admin/roles/check.php?contextid=".$systemcontext->id, array('
moodle/role:assign', '
moodle/role:safeoverride', '
moodle/role:override', '
moodle/role:manage')
So you could also use these permissions to hide check system permissions without hiding assign system roles:
'moodle/role:safeoverride'
'moodle/role:override'
'moodle/role:manage'