PDA

View Full Version : patch for user creation bug in 1.9.2


grizzlysmit
25-03-2011, 08:32
This is a PATCH for a bug in creating user accounts
under version 1.9.2.

This problem affects both the web interface and the APIs.

The 2 possible bugs I fixed in order to get user account
creation to work are:


1. In the file "users.php" CHANGE ON line 158


API::User()->create($user)
call expects the field name
$user['usergrps']
instead of field name
$user['usrgrps']

I need to change
$user['usrgrps'] = $usrgrps;
to
$user['usergrps'] = $usrgrps;
to get it to work.


2. In the file "class.cuser.php" INSERT ABOVE line 520

If EXACTLY one media (instead of 0 or >=2) is supplied to
$user['user_medias']
then it would not work.

I fixed it by adding a line to normalise the array:
$user['user_medias'] = zbx_toArray($user['user_medias']);
just ABOVE the line 520. So above:
foreach($user['user_medias'] as $media_data) {

richlv
25-03-2011, 19:02
tracked at https://support.zabbix.com/browse/ZBX-3639

grizzlysmit
26-03-2011, 00:51
unless there's a typo in the bug report not quite the same, I guess the typo theory would be right as it's so similar and in the same bit of code, anything else is a bit far fetched. so looks like it's under control.