Cacti / plugin_weathermap

Weathermap for Cacti 1.x
MIT License
81 stars 25 forks source link

Bug - Weathermap - Edit Permission Page #136

Closed MSS970 closed 7 months ago

MSS970 commented 10 months ago

a) Click on Management/Weathermaps b) Then click on any of the Accessible By to show and edit he permissions, e.g. click on the “2 Groups5 Users”, it is supposed to list the following:

  1. All Users (which is a special case, and it is always listed).
  2. 5 users who have permission to access the “Network Summary” weathermap. They are not listed!.
  3. All other users who do not have permission. They are listed.
  4. User Groups which have permission. They are listed.
  5. User Groups which do not have permission. (I did not test this case). Cacti-Wheathermap-1 2-Edit Permission Bug
MSS970 commented 10 months ago

I ran the relevant select statement in MySQL database and I got the expected correct results.

SELECT FROM ( SELECT '0' AS id, 'Everyone' AS name, 'All Users in System' AS description, 'special' AS type, '-1' AS allowed, 'N/A' AS realm UNION ALL SELECT id, username AS name, full_name AS description, 'user' AS type, wa.mapid AS allowed, realm FROM user_auth AS ua LEFT JOIN (SELECT FROM weathermap_auth WHERE mapid = 16) AS wa ON ua.id = wa.userid AND ua.enabled = 'on' WHERE (wa.mapid = 16 OR (wa.mapid IS NULL AND ua.enabled = 'on')) -- $sql_where1 UNION ALL SELECT id, name, description, 'group' AS type, wa.mapid AS allowed, 'N/A' AS realm FROM user_auth_group AS uag LEFT JOIN (SELECT * FROM weathermap_auth WHERE mapid = 16) AS wa ON uag.id = -wa.userid AND uag.enabled = 'on' WHERE (wa.mapid = 16 OR (wa.mapid IS NULL AND uag.enabled = 'on')) -- $sql_where2 ) AS rs

No sure if the bug is due to $sql_params[]

nbz6 commented 8 months ago

I have the same after a Cacti migration from 0.8.8h to 1.2.26. Seems like the view show only active users. If you have old permissions of inactive users, it will be count but not showed in the permissions view.

TheWitness commented 8 months ago

Oh!

TheWitness commented 8 months ago

Update to develop wait for one WeatherMap polling cycle to complete, and then see if the stats are better.

nbz6 commented 7 months ago

I can't confirm, before your fix I deleted entries in weathermap_auth to clean all rights.

TheWitness commented 7 months ago

Okay, well they will be fixed now. Thanks for the update. Let's just consider this one closed. Oh, but wait!

TheWitness commented 7 months ago

It's good. There was one check that I was not certain of "All Users".