Page 1 of 1

Limit access to ZM by hour

Posted: Wed May 27, 2015 4:26 am
by estranged1977
Hi everybody!!
I recently implemented ZM on a kinder school where the parents has access to cameras in the class room to see the kids...
I use IpCam Viewer to access to zoneminder and everything goes very well.

There is a username and a password for each one of the parents that wants to access cameras...

Now the people in charge of the shool ask me if there is a way to limit the access only between 8:00 am and 13:00 pm so parents cant access in others hours of the day.

Im not sure how to do this, is there a known wat to do this?? Something like group access and a way to limit a group by hour...

Thanks...

Re: Limit access to ZM by hour

Posted: Wed May 27, 2015 11:56 am
by PacoLM
http://www.zoneminder.com/wiki/index.ph ... or_week.3F

You could create a state with monitors set to None, in this way no one could see anything. Save another state with the normal view in class hours.

Hope it helps,

PacoLM

Re: Limit access to ZM by hour

Posted: Fri May 29, 2015 10:26 pm
by estranged1977
Ok I did it using MySql event scheduler, its better because you can program differents hours access to differents groups...

In this case there are childrens in the morning and other group in the afternoon, so what I did is to program the event scheduler to this:

1.- Update to "0" the field "enabled" to all users by id except user admin at 18:00 every day.
2.- Update to "1" field "enabled" to the users by username that are allowed to view cameras in the morning.
3.- Again Update to "0" the field "enabled" to all users by id except user admin, this time at 13:00 so nobody can access at lunch time...
4.- Update to "1" field "enabled" to users by username allowed to view cameras at the afternoon.

And at last in the weekend I programed a cron job using /usr/bin/zmpkg.pl to run a state in where cameras are set to none and other cron to run state with working cameras at 06:00 am on Monday.

Of course I added the same cameras again with only access to admin so we can still record de weekend for security...

Re: Limit access to ZM by hour

Posted: Fri May 29, 2015 11:58 pm
by asker
Interesting that you went to mysql instead of handling it at the ZM level.
Did you check what happens if say you enable streaming for a group, keep a browser window open so it keeps streaming and then you directly change the enabled to 0 at mysql level? Will that stream get disconnected from the browser ? (for example, lets say a parent logs in to monitor and never closes the window). If you handle this at the ZM level, since the monitors get restarted the connection will break.

Re: Limit access to ZM by hour

Posted: Sun May 31, 2015 2:39 pm
by estranged1977
You are right, when someone logs in and never close the widows it still streaming when change to 0 "enabled" in DB..
To fix it I added a restart for apache server in cron at same time groups change access at zm...

Thanks for the tip