[ZBX-7202] action can be left without any operations Created: 2013 Oct 24  Updated: 2022 Oct 08  Resolved: 2015 Oct 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.0.9, 2.1.8
Fix Version/s: 3.0.0alpha4

Type: Incident report Priority: Major
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: actions, validation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

have a user as the only recipient in action. delete that user. action is left without any operations - something we would normally not allow. apparently, validation does not really happen in the api

note that ZBXNEXT-105 is different - it asks about warning in such cases when there would still be some operations/targets left



 Comments   
Comment by richlv [ 2013 Dec 17 ]

still there in 2.2.0

Comment by richlv [ 2013 Dec 17 ]

(1) related : have action operation that sends to user and user group. delete user - whole operation is deleted. should not happen.

gunarspujats RESOLVED in r55712.

oleg.egorov CLOSED

Comment by richlv [ 2013 Dec 17 ]

ZBXNEXT-551 talks about warnings in case anything an action references is deleted

Comment by richlv [ 2014 Mar 18 ]

ZBX-7948 is related (asks to document cases when action can be disabled)

Comment by Gunars Pujats (Inactive) [ 2015 Sep 23 ]

(2) [A] Added translation strings:

  • Action disabled due to deletion of user.
  • Action disabled due to deletion of user group.

oleg.egorov CLOSED

<richlv> actual added translation string is "Action disabled due to deletion of user", without trailing dot - is that good ?

gunarspujats RESOLVED in r56416.

oleg.egorov Thank you, Rich! CLOSED

Comment by Gunars Pujats (Inactive) [ 2015 Sep 23 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-7202

Comment by Oleg Egorov (Inactive) [ 2015 Sep 24 ]

(3) Coding style:

  • Function description should be ended with a dot (CAction.php:2250, 2270);
  • Function descriptions and params should be separated by blank line (CAction.php:2251);
  • We don't use "empty" in conditions (CAction.php:2267);
  • Unnecessary tabs in CAction.php:2269-2270.

As example

Now:

	/**
	 * Disable actions
	 * @param array $actionids
	 */

Correct:

	/**
	 * Disable actions.
	 * 
	 * @param array $actionids
	 */
  • And as discussed don't use "public" for disableActions and disableActionsWithoutOperations functions.
  • Please change public methods for validateCreate and validateUpdate to protected.

gunarspujats RESOLVED in r55774.

oleg.egorov Other issues:

  • $dbOperations - used camelCases, but should be $db_operations

REOPENED

gunarspujats RESOLVED in r55802.

oleg.egorov testFormAdministrationUserCreate.php

  • Two blank lines after licence comment.
  • Use single quote instead of a double

Now:

$this->click("id=add_group");

REOPENED

gunarspujats RESOLVED in r55892.

oleg.egorov

  • Function disableActions
    protected function disableActions(array $actionids) {
    	if ($actionids) {
    		// Function action.
    	}
    }
    

    Should be changed to:

    protected function disableActions(array $actionids) {
    	// Function action.
    }
    

    And $actionids check should be before function call

  • Same issue exist in disableActionsWithoutOperations, disableActionsWithoutOperations should be executed only with $actionids

REOPENED

gunarspujats RESOLVED in r56376.

oleg.egorov Variable naming
$empty_actions sounds like boolean, but there is ID's array

gunarspujats RESOLVED in r56383.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2015 Sep 25 ]

(4) Please add operation id for disableActionsWithoutOperations, to improve performance

gunarspujats RESOLVED in r55774.

oleg.egorov As was discussed with oleg.egorov,iivs, ingus.vilnis, dimir and gunarspujats in audit log should be added details, why was disabled action.

And code from actions.inc.php (disableActionsWithoutOperations and disableActions) should be moved to CUser.php and CUserGroup.php

gunarspujats RESOLVED in r55948.

oleg.egorov CLOSED

Comment by Gunars Pujats (Inactive) [ 2015 Oct 27 ]

Fixed in:

  • pre-3.0.0alpha4 (trunk) r56387
Comment by Gunars Pujats (Inactive) [ 2015 Oct 27 ]

(5) API documentation:

oleg.egorov CLOSED

Generated at Thu Apr 25 06:31:26 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.