Users tool: too many columns for student view
Current behavior / Resultado actual / Résultat actuel
A student can see the userID of course members (and more) if the users tool is visible for learners. The first UserID column is sensitive and not needed. Other columns may show sensitive user data also.

Expected behavior / Resultado esperado / Résultat attendu
Show only photo, firstname, lastname, and group column in the student view. The rest may be sensitive info and is not a need-to-know for students.
Steps to reproduce / Pasos para reproducir / Étapes pour reproduire
Login as a student on a course with many other students and click on the user tool
Chamilo Version / Versión de Chamilo / Version de Chamilo
1.11.x
And some coding bugs in the parsing of the configuration variable in api.lib.php: // Check if variable exists if (isset($_configuration[$variable])) { if (is_array($_configuration[$variable])) { // Check if it exists for the sub portal if (array_key_exists($urlId, $_configuration[$variable])) { return $_configuration[$variable][$urlId]; } }
Well, array_key 1 will exist in any array that has more than 1 entry ... Even with a workaround like this (prevent 0 as index) the resulting table still shows the userid and the table is messed up: _configuration['hide_user_field_from_list'] = array('a' => 'username', 'b'=> 'id', 'c'=>'official_code');
Chamilo needs regression tests. Badly.
And another bug in user.php: $table->set_header($header_nr++, get_lang('OfficialCode')); $indexList['official_code'] = $header_nr;
if ($is_western_name_order) { $indexList['firstname'] = $header_nr;
So index firstname and official_code both get header number 3. That's wrong.
Are there any Behat/Mink test templates available?
I remove the user id. In order to hide other columns you can use in configuration.php
$_configuration['hide_user_field_from_list'] = ['username'];
You're welcome to add behat tests here:
https://github.com/chamilo/chamilo-lms/tree/1.11.x/tests/behat/features
You can read the documentation about it here:
https://github.com/chamilo/chamilo-lms/tree/1.11.x/tests/behat
Almost fixed. Try this for a test: $_configuration['hide_user_field_from_list'] = ['username', 'official_code']; and it fails because array index 1 is now set (api.lib.php function api_get_configuration_value)
I just added a fix, the setting should be:
$_configuration['hide_user_field_from_list'] = ['fields' => ['username']];
Maybe I have the wrong git repo but the indexList for the hide fields has a duplicate index 3 for Firstname and officialcode:

I fixed that, but it does not affect the behaviour of the hide fields funcionality.