Bug #1766

Some hosts are not shown with ACL - Using NDOUtils, centreon_acl is not correctly filled by centACL.php with cron

Added by nicolas hermestroff almost 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:05/19/2010
Priority:NormalDue date:
Assignee:Sylvestre Ho% Done:

100%

Category:-
Target version:Centreon-2.1.10
Resolution:fixed

Description

Let me first explain my problem : I created some ACL and a "Resources Access" named "Tout" including all hosts and all hosts groups. The problem is if I log in as root, I see 113 hosts and 1130 services. If I log as any user user that is not admin I got 32 hosts and 717 services.

This is not normal since I do not have any filter on resources.

After looking a lot into the files, I discovered that count(host_name) of centreon_acl (=32) is the source of this error. Looking forward, the result is that all missing hosts are those who do not have any direct test (test attached to them directly and not by a host group). My analyze is that getMyHostServicesByName function of centAcl-Func.php is based on global $hsRelation of centAcl.php and that's an error. Because (line 313 of centAcl.php) count(host_host_id) of host_service_relation = 32.


Related issues

related to Centreon-Core - Bug #435: In non-Admin mode ACLs are broken for hosts without services Rejected

History

#1 Updated by nicolas hermestroff almost 4 years ago

My solution in centAcl.php line 318 :

        $DBRESULT =& $pearDB->query("SELECT hostgroup_hg_id, host_host_id, service_service_id FROM host_service_relation");

replace it by

        $DBRESULT =& $pearDB->query("SELECT host_service_relation.hostgroup_hg_id, hostgroup_relation.host_host_id, host_service_relation.service_service_id ".
                                        "FROM host_service_relation, hostgroup_relation ".
                                        "WHERE hostgroup_relation.hostgroup_hg_id = host_service_relation.hostgroup_hg_id ".
                                        "UNION ".
                                        "SELECT hostgroup_hg_id, host_host_id, service_service_id ".
                                        "FROM host_service_relation ".
                                        "WHERE host_host_id IS NOT NULL");

I did the test and it works as I want (now 113 hosts are shown) but I don't know if there is side.

#2 Updated by Julien Mathis almost 4 years ago

  • Assignee set to Sylvestre Ho

Hi Sylvester,

When you have a moment, can you check all that ?

Thanks

#3 Updated by Julien Mathis almost 4 years ago

  • Target version set to Centreon-2.1.10

#4 Updated by Julien Mathis over 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Resolution set to fixed

#5 Updated by nathanael bonin over 3 years ago

Julien Mathis wrote:

Hi Sylvester,

When you have a moment, can you check all that ?

Thanks

Is it possible to get the patch for this error ? Thks!

#6 Updated by Sylvestre Ho over 3 years ago

Hi,

Just get the latest centAcl.php.
http://forge.centreon.com/repositories/changes/centreon/branches/centreon-2.1/cron/centAcl.php

Make sure you're using Centreon 2.1.x though

#7 Updated by nathanael bonin over 3 years ago

Sylvestre Ho wrote:

Hi,

Just get the latest centAcl.php.
http://forge.centreon.com/repositories/changes/centreon/branches/centreon-2.1/cron/centAcl.php

Make sure you're using Centreon 2.1.x though

I don't know if it's normal, but I tried the latest centAcl.php and when I try to make a "/usr/bin/php -q /usr/local/centreon/cron/centAcl.php" I have :
Fatal error: Call to undefined method DB_Error::fetchRow() in /usr/local/centreon/cron/centAcl.php on line 247

I'm in PHP 5.3... I know it's not the place to talk about problem, but if it's a problem in the upgrade...

Thanks in advance.

#8 Updated by Julien Mathis over 3 years ago

Please wait Centreon 2.1.10 for a full upgrade. There are some SQL evolution and you don't have yet upgraded your Database.

Thanks

Also available in: Atom PDF