- How you installed ZoneMinder - zmrepo
- Full name and version of OS - CentOS Linux release 7.9.2009 (Core)
- Browser name and version (if this is an issue with the web interface) - any
- MYSQL Version - Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
I ran yum to update my system and it upgraded zoneminder to 1.37.25 and completely broke it. Unfortunately I did not write down what the previous version was, but the update script said it updated the database from 1.37.1 to1.37.25. I had to find Monitor_Permissions.php in the GIT repository as it's not in the rpm. I tried to reinstall the rpm and downloaded the SRPM and that file is in neither. I also had to run the zm_update-1.x.x.sql files manually to fix a large number of missing table fields. Once the interface is up, I still have no monitors, it is recording and I can view past recordings, but I cannot view anything live. The log shows "Insufficient privileges for request user 1 admin for monitor x" from the zms.cpp. I check the user for permissions and set every available field to "Edit" and verified the sql tables Groups_Permissions and Monitors_Permissions and the fields are set to 'Edit'. In the debug log it shows the queries are returning "Inherit" instead of "Edit" and not giving permission to view the monitors. I cannot seem to locate any idea why, here is an example from the log -
Code: Select all
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | ERR | Insufficient privileges for request user 1 admin for monitor 4 | zms.cpp | 44
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | DB1 | INHERIT from group_permission | zm_user.cpp | 133
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | DB1 | # of Group_Permissions 1 | zm_user.cpp | 76
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | DB1 | INHERIT from monitor_permission | zm_user.cpp | 104
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | DB1 | # of Monitor_Permissions 6 | zm_user.cpp | 71
11/5/22, 12:54:25 PM CDT | zms_m4 | | 11800 | DB1 | Authenticated user 'admin' | zm_user.cpp | 298
in the SQL table -
Code: Select all
MariaDB [zm]> select * from Monitors_Permissions;
+----+-----------+--------+------------+
| Id | MonitorId | UserId | Permission |
+----+-----------+--------+------------+
| 1 | 1 | 1 | Edit |
| 2 | 2 | 1 | Edit |
| 3 | 3 | 1 | Edit |
| 4 | 4 | 1 | Edit |
| 5 | 5 | 1 | Edit |
| 6 | 6 | 1 | Edit |
+----+-----------+--------+------------+
MariaDB [zm]> select * from Groups_Permissions;
+----+---------+--------+------------+
| Id | GroupId | UserId | Permission |
+----+---------+--------+------------+
| 1 | 1 | 1 | Edit |
+----+---------+--------+------------+
MariaDB [zm]> select * from Groups_Monitors;
+----+---------+-----------+
| Id | GroupId | MonitorId |
+----+---------+-----------+
| 22 | 1 | 1 |
| 23 | 1 | 2 |
| 24 | 1 | 3 |
| 25 | 1 | 4 |
| 26 | 1 | 5 |
+----+---------+-----------+
MariaDB [zm]> select * from Users;
+----+----------+--------------------------------------------------------------+----------+---------+--------+--------+---------+----------+--------+---------+-----------+--------+--------------+-------------+----------------+------------+----------+
| Id | Username | Password | Language | Enabled | Stream | Events | Control | Monitors | Groups | Devices | Snapshots | System | MaxBandwidth | MonitorIds | TokenMinExpiry | APIEnabled | HomeView |
+----+----------+--------------------------------------------------------------+----------+---------+--------+--------+---------+----------+--------+---------+-----------+--------+--------------+-------------+----------------+------------+----------+
| 1 | admin | XXXXXXXXX | en_us | 1 | View | Edit | Edit | Edit | Edit | Edit | Edit | Edit | high | 1,2,3,4,5,6 | 0 | 1 | |
+----+----------+--------------------------------------------------------------+----------+---------+--------+--------+---------+----------+--------+---------+-----------+--------+--------------+-------------+----------------+------------+----------+
Code: Select all
15488 Init DB zm
15488 Query SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
15488 Query SET NAMES utf8
15488 Query SELECT `Name`, `Value`, `Type` FROM `Config` ORDER BY `Id`
15488 Query SELECT `Id`, `Username`, `Password`, `Enabled`, `Stream`+0, `Events`+0, `Control`+0, `Monitors`+0,`System`+0 FROM `Users` WHERE `Enabled` = 1
15488 Query SELECT `Id`,`UserId`,`MonitorId`,`Permission` FROM Monitors_Permissions WHERE `UserId`='1'
15488 Query SELECT `Id`,`UserId`,`GroupId`,`Permission` FROM Groups_Permissions WHERE `UserId`='1'
15488 Query SELECT `MonitorId` FROM Groups_Monitors WHERE `GroupId`='1'
15488 Query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1667624537.281255, 'zms_m4', 0, 6703, -2, 'ERR', 'Insufficient privileges for request user 1 admin for monitor 4', 'zms.cpp', 44 )
15488 Quit
I know some c++, and some mysql, but I normally use java, anyway. What I am not knowing is how the sql enum maps to the c++ enum. The sql enum is "enum('Inherit','None','View','Edit')" and the c++ enum is " typedef enum { PERM_UNKNOWN=0, PERM_INHERIT, PERM_NONE, PERM_VIEW, PERM_EDIT } Permission;" , and as you can see, they do not exactly match. I am not that familiar with sql and c++ enums to know if that is correct or not.