chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

Users tool: too many columns for student view

Open jderriks opened this issue 9 years ago • 7 comments

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. afbeelding

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

jderriks avatar May 08 '17 14:05 jderriks

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.

jderriks avatar May 08 '17 16:05 jderriks

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?

jderriks avatar May 08 '17 20:05 jderriks

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

jmontoyaa avatar May 09 '17 06:05 jmontoyaa

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)

jderriks avatar May 09 '17 11:05 jderriks

I just added a fix, the setting should be:

$_configuration['hide_user_field_from_list'] = ['fields' => ['username']];

jmontoyaa avatar May 18 '17 07:05 jmontoyaa

Maybe I have the wrong git repo but the indexList for the hide fields has a duplicate index 3 for Firstname and officialcode: afbeelding

jderriks avatar May 19 '17 17:05 jderriks

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

jmontoyaa avatar May 22 '17 06:05 jmontoyaa