No "Montage Review" for restricted monitors

Forum for questions and support relating to the 1.30.x releases only.
Post Reply
jogo
Posts: 4
Joined: Thu Aug 03, 2017 3:00 pm

No "Montage Review" for restricted monitors

Post by jogo » Thu Aug 10, 2017 5:41 pm

When I restrict the monitors for a user, I cannot use "Montage Review", possibly due to a minor sql syntax error.

This is how it looks like when clicking "Montage Review":

Code: Select all

SQL-ERR 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND Id IN (6,2,5,4,12,8,11,15,14) order by Sequence asc' at line 1', statement was 'select * from Monitors AND Id IN (6,2,5,4,12,8,11,15,14) order by Sequence asc '
When I have some spartime, I'll have a look at it myself.

Zoneminder: 1.30.4
OS: Debian 9

rockedge
Posts: 478
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: No "Montage Review" for restricted monitors

Post by rockedge » Fri Aug 11, 2017 3:49 pm

I think this is a permissions conflict. I have in the past modified the php in /usr/share/zoneminder/www/skins/classic/views/montage.php around line 21 to add an "AND" to the if statement to clarify more detailed (or less) which users can view the montage streams or not.

viewtopic.php?p=100570#p100570

jogo
Posts: 4
Joined: Thu Aug 03, 2017 3:00 pm

Re: No "Montage Review" for restricted monitors

Post by jogo » Sat Aug 12, 2017 5:12 pm

Thanks, I'll check that with my setup asap.

rockedge
Posts: 478
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: No "Montage Review" for restricted monitors

Post by rockedge » Sat Aug 12, 2017 8:14 pm

let us know how you make out. :)

jogo
Posts: 4
Joined: Thu Aug 03, 2017 3:00 pm

Re: No "Montage Review" for restricted monitors

Post by jogo » Sun Aug 13, 2017 6:13 am

It seems that the error is related to a missing WHERE clause. Instead of

Code: Select all

select *  from Monitors  AND Id IN (6,3,5,4,8,16,14) order by Sequence asc
it probably should have been

Code: Select all

select *  from Monitors  WHERE Id IN (6,3,5,4,8,16,14) order by Sequence asc
in montagereview.php.

I added a small patch around line 150 in montagereview.php

Code: Select all

if ( !empty($user['MonitorIds']) )
{
#   Patch jogo: 2017-08-13
    $monitorsSql   .= ' WHERE 1=1 ';
#   End of patch
    $eventsSql   .= ' AND M.Id IN ('.$user['MonitorIds'].')';
    $monitorsSql .= ' AND Id IN ('.$user['MonitorIds'].')';
    $frameSql    .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')';
}
I could have replaced the AND by WHERE, but I wanted an extra line. Initially the view hang, but after a restart of zoneminder and apache, it worked as expected. I think restarting apache would have sufficed.

Let's see, where the next bug shows up, where the db server complains about too many where clauses, :mrgreen: ...

rockedge
Posts: 478
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: No "Montage Review" for restricted monitors

Post by rockedge » Sun Aug 13, 2017 6:46 pm

your patch works so far okay on my test system(s). Nice! :D

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests