[ZBX-11121] User without user group Created: 2016 Aug 22  Updated: 2017 May 30  Resolved: 2016 Nov 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Frontend (F)
Affects Version/s: 2.2.15rc1, 2.4.8, 3.0.5rc1, 3.2.0beta1
Fix Version/s: 2.2.16rc1, 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1

Type: Incident report Priority: Major
Reporter: Oleg Egorov (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: user, usergroups
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 1.png     PNG File 2.png     PNG File BUG.png    

 Description   

In user group edit form possible to leave user from this group. And if the user was only in this group, then they will be left without a group.



 Comments   
Comment by vitalijs.cemeris (Inactive) [ 2016 Sep 19 ]

(1) Translation strings

Strings deleted:

  • Host group "%1$s" cannot be deleted, because some hosts depend on it.
  • User group "%1$s" is the only group that user "%2$s" belongs to.
  • No groups for host.

Strings changed:

  • User "%s" cannot be without user group. -> User "%1$s" cannot be without user group.
  • No groups for host "%s". -> Host "%1$s" cannot be without host group.
  • No groups for template "%1$s -> Template "%1$s" cannot be without host group.
  • Host prototype "%1$s" must have at least one host group. -> Host prototype "%1$s" cannot be without host group.

oleg.egorov CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Sep 19 ]

Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-11121

Comment by Natalja Romancaka [ 2016 Sep 20 ]

(2) [F] [A] if mass delete all user groups, user left without a group
Steps to reproduce:
1. create two user groups A and B
2. add user to groups A and B
3. mass delete groups A and B

vitalijs.cemeris RESOLVED in r62726

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Sep 21 ]

(3) [A] usergroup.massUpdate

{
    "usrgrpids": [
        "18",
        "19"
    ],
    "userids": []
}

User was in 2 groups, but after update user left without a group.

vitalijs.cemeris RESOLVED in r62710

oleg.egorov CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Oct 03 ]

(4) Improve exception messages for leaving host, host prototype and template without host group.

vitalijs.cemeris RESOLVED in r62938, r63053, r63123, r63124

oleg.egorov
API call:

$dbUserGroup = API::Template()->massupdate([
	'templates' => [],
	'groups' => []
]);

CTemplate.php:844

_s('Template "%1$s" cannot be without host group.', reset($updTemplates)['name'])

$updTemplates array is empty, and in this situation it return null.Then null inserted in the message as text string.

vitalijs.cemeris RESOLVED in r63174

oleg.egorov Not correct API request for host.massupdate

{
    "hostid": "10168",
    "groups": []
}

Result:

Host "Zabbix server" cannot be without host group.

But "hostid": "10168" is other host, Zabbix server is 10084

vitalijs.cemeris RESOLVED in r63302

oleg.egorov

Totally broken

REOPENED

vitalijs.cemeris RESOLVED in r63320

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Oct 13 ]

(5) [A] Zabbix 2.2 PHP min version is 5.3

Parse error: parse error in C:\wamp\www\ZBX-11121\frontends\php\api\classes\CTemplate.php on line 844

reset($updTemplates)['name'] - this construction is available only from PHP 5.4

Same issue exist for other API changes (Hosts..)

vitalijs.cemeris RESOLVED in r63174

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Oct 21 ]

(6) More issues in one line.
CHost.php:1084

  • double spaces
  • ZBX_API_ERROR_PERMISSIONS instead ZBX_API_ERROR_PARAMETERS. Same issue exist in CTemplate:827

vitalijs.cemeris RESOLVED in r63321

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Oct 31 ]

TESTED

Comment by vitalijs.cemeris (Inactive) [ 2016 Nov 02 ]

(7) For 3.0 added validation for required parameter "groups" and did minor code refactoring.
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-11121-30

oleg.egorov CLOSED

Comment by Natalja Romancaka [ 2016 Nov 02 ]

(8) [F] 3.0 in template edit form move all host groups from column "In groups" to column "Other groups", then update template

Undefined variable: updTemplates [templates.php:252 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CTemplate->update() → CTemplate->massUpdate() → CTemplate->validateMassUpdate() in include/classes/api/services/CTemplate.php:945]

vitalijs.cemeris Similar issue with host.update RESOLVED in r63534

natalja.zabbix ui tested

oleg.egorov According https://www.zabbix.org/wiki/PHP_coding_guidelines#Array_dereferencing

reset($db_hosts)['host']

Usage is not allowed

REOPENED

vitalijs.cemeris RESOLVED in r63580

oleg.egorov CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Nov 08 ]

Fixed in:

  • pre-2.2.16rc1 r63434
  • pre-3.0.6rc1 r63597
  • pre-3.2.2rc1 r63599
  • pre-3.3.0 r63600
Comment by vitalijs.cemeris (Inactive) [ 2016 Nov 08 ]

(9) [D] API documentation: disallowed leaving user without linked user groups 2.2, 3.0, 3.2

RESOLVED

martins-v Reviewed, with a small grammar fix. CLOSED.

Generated at Thu Apr 18 12:47:10 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.