diff --git a/CMakeLists.txt b/CMakeLists.txt index aa5a3219e..3ffaf99ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # cmake_minimum_required (VERSION 2.6) project (zoneminder) -set(zoneminder_VERSION "1.28.100") +set(zoneminder_VERSION "1.28.101") # make API version a minor of ZM version set(zoneminder_API_VERSION "${zoneminder_VERSION}.1") diff --git a/configure.ac b/configure.ac index 23ca6db47..8017087e2 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # For instructions on building with cmake, please see INSTALL # AC_PREREQ(2.59) -AC_INIT(zm,1.28.100,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html) +AC_INIT(zm,1.28.101,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR(src/zm.h) AC_CONFIG_HEADERS(config.h) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index c52c5741e..8c7a840d4 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -461,6 +461,7 @@ CREATE TABLE `Users` ( `Events` enum('None','View','Edit') NOT NULL default 'None', `Control` enum('None','View','Edit') NOT NULL default 'None', `Monitors` enum('None','View','Edit') NOT NULL default 'None', + `Groups` enum('None','View','Edit') NOT NULL default 'None', `Devices` enum('None','View','Edit') NOT NULL default 'None', `System` enum('None','View','Edit') NOT NULL default 'None', `MaxBandwidth` varchar(16) NOT NULL default '', @@ -546,7 +547,7 @@ CREATE TABLE `Zones` ( -- -- Create a default admin user. -- -insert into Users VALUES (NULL,'admin',password('admin'),'',1,'View','Edit','Edit','Edit','Edit','Edit','',''); +insert into Users VALUES (NULL,'admin',password('admin'),'',1,'View','Edit','Edit','Edit','Edit','Edit','Edit','',''); -- -- Add a sample filter to purge the oldest 100 events when the disk is 95% full diff --git a/db/zm_update-1.28.101.sql b/db/zm_update-1.28.101.sql new file mode 100644 index 000000000..adf3f34e8 --- /dev/null +++ b/db/zm_update-1.28.101.sql @@ -0,0 +1,23 @@ +-- +-- This updates a 1.28.100 database to 1.28.101 +-- + +-- +-- Add Groups column to Users +-- + + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Groups' + ) > 0, +"SELECT 'Column Groups exists in Users'", +"ALTER TABLE Users ADD COLUMN `Groups` ENUM('None','View','Edit') NOT NULL DEFAULT 'None' AFTER `Monitors`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + diff --git a/version b/version index 1bffe5fba..d21af5761 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.28.100 +1.28.101 diff --git a/web/includes/actions.php b/web/includes/actions.php index 6fdb33a9b..7868f0adb 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -624,15 +624,42 @@ if ( !empty($action) ) } } - // System view actions - if ( $action == "setgroup" ) { - if ( !empty($_REQUEST['gid']) ) { - setcookie( "zmGroup", validInt($_REQUEST['gid']), time()+3600*24*30*12*10 ); - } else { - setcookie( "zmGroup", "", time()-3600*24*2 ); - } - $refreshParent = true; - } + // Group view actions + if ( canView( 'Groups' ) && $action == "setgroup" ) { + if ( !empty($_REQUEST['gid']) ) { + setcookie( "zmGroup", validInt($_REQUEST['gid']), time()+3600*24*30*12*10 ); + } else { + setcookie( "zmGroup", "", time()-3600*24*2 ); + } + $refreshParent = true; + } + + // Group edit actions + if ( canEdit( 'Groups' ) ) { + if ( $action == "group" ) { + # Should probably verfy that each monitor id is a valid monitor, that we have access to. HOwever at the moment, you have to have System permissions to do this + $monitors = empty( $_POST['newGroup']['MonitorIds'] ) ? NULL : implode(',', $_POST['newGroup']['MonitorIds']); + if ( !empty($_POST['gid']) ) { + dbQuery( "UPDATE Groups SET Name=?, MonitorIds=? WHERE Id=?", array($_POST['newGroup']['Name'], $monitors, $_POST['gid']) ); + } else { + dbQuery( "INSERT INTO Groups SET Name=?, MonitorIds=?", array( $_POST['newGroup']['Name'], $monitors ) ); + } + $view = 'none'; + } + if ( !empty($_REQUEST['gid']) && $action == "delete" ) { + dbQuery( "delete from Groups where Id = ?", array($_REQUEST['gid']) ); + if ( isset($_COOKIE['zmGroup']) ) + { + if ( $_REQUEST['gid'] == $_COOKIE['zmGroup'] ) + { + unset( $_COOKIE['zmGroup'] ); + setcookie( "zmGroup", "", time()-3600*24*2 ); + $refreshParent = true; + } + } + } + $refreshParent = true; + } // System edit actions if ( canEdit( 'System' ) ) @@ -851,19 +878,6 @@ if ( !empty($action) ) dbQuery( "replace into States set Name=?, Definition=?", array( $_REQUEST['runState'],$definition) ); } } - elseif ( $action == "group" ) - { - # Should probably verfy that each monitor id is a valid monitor, that we have access to. HOwever at the moment, you have to have System permissions to do this - $monitors = empty( $_POST['newGroup']['MonitorIds'] ) ? NULL : implode(',', $_POST['newGroup']['MonitorIds']); - if ( !empty($_POST['gid']) ) { - dbQuery( "UPDATE Groups SET Name=?, MonitorIds=? WHERE Id=?", array($_POST['newGroup']['Name'], $monitors, $_POST['gid']) ); - } else { - dbQuery( "INSERT INTO Groups SET Name=?, MonitorIds=?", array( $_POST['newGroup']['Name'], $monitors ) ); - } - - $refreshParent = true; - $view = 'none'; - } elseif ( $action == "delete" ) { if ( isset($_REQUEST['runState']) ) @@ -876,19 +890,6 @@ if ( !empty($action) ) if ( $markUid == $user['Id'] ) userLogout(); } - if ( !empty($_REQUEST['gid']) ) - { - dbQuery( "delete from Groups where Id = ?", array($_REQUEST['gid']) ); - if ( isset($_COOKIE['zmGroup']) ) - { - if ( $_REQUEST['gid'] == $_COOKIE['zmGroup'] ) - { - unset( $_COOKIE['zmGroup'] ); - setcookie( "zmGroup", "", time()-3600*24*2 ); - $refreshParent = true; - } - } - } } } else diff --git a/web/includes/config.php.in b/web/includes/config.php.in index fbcb0e7b3..4378ef1ec 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -131,6 +131,7 @@ $GLOBALS['defaultUser'] = array( "Events" => 'Edit', "Control" => 'Edit', "Monitors" => 'Edit', + "Groups" => 'Edit', "Devices" => 'Edit', "System" => 'Edit', "MaxBandwidth" => "", diff --git a/web/skins/classic/css/dark/views/frames.css b/web/skins/classic/css/dark/views/frames.css index 249fa3751..574119a46 100644 --- a/web/skins/classic/css/dark/views/frames.css +++ b/web/skins/classic/css/dark/views/frames.css @@ -7,9 +7,9 @@ tr.alarm { } tr.bulk { - background-color: #cccccc; + background-color: #000000; } tr.normal { - background-color: #ffffff; + background-color: #222222; } diff --git a/web/skins/classic/css/dark/views/timeline.css b/web/skins/classic/css/dark/views/timeline.css index 93509dd15..376dec4a3 100644 --- a/web/skins/classic/css/dark/views/timeline.css +++ b/web/skins/classic/css/dark/views/timeline.css @@ -122,8 +122,8 @@ position: absolute; text-align: center; left: 0px; - background-color: #fcfcfc; - border-bottom: 1px solid black; + background-color: #000000; + border-bottom: 1px solid #cccccc; } #chartPanel .event { diff --git a/web/skins/classic/js/skin.js.php b/web/skins/classic/js/skin.js.php index 5a27c6550..d5d414111 100644 --- a/web/skins/classic/js/skin.js.php +++ b/web/skins/classic/js/skin.js.php @@ -33,6 +33,8 @@ var skinPath = ""; var canEditSystem = ; var canViewSystem = ; +var canEditGroups = ; + var refreshParent = ; var focusWindow = ; diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 69c1f81c1..915972d10 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -191,7 +191,7 @@ xhtmlHeaders( __FILE__, translate('Console') );

: / : %

ZoneMinder - - v'.ZM_VERSION.'', canEdit( 'System' ) ) ?>

-
+
- disabled="disabled"/> + disabled="disabled"/>
diff --git a/web/skins/classic/views/groups.php b/web/skins/classic/views/groups.php index 2e957fbc9..1cd1e66b4 100644 --- a/web/skins/classic/views/groups.php +++ b/web/skins/classic/views/groups.php @@ -18,6 +18,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +if ( !canView( 'Groups' ) ) { + $view = "error"; + return; +} $sql = "select * from Groups order by Name"; $groups = array(); @@ -72,9 +76,9 @@ xhtmlHeaders(__FILE__, translate('Groups') );
- /> - /> - /> + /> + /> + />
diff --git a/web/skins/classic/views/js/groups.js b/web/skins/classic/views/js/groups.js index 3756f4b83..199ababc2 100644 --- a/web/skins/classic/views/js/groups.js +++ b/web/skins/classic/views/js/groups.js @@ -33,7 +33,7 @@ function deleteGroup( element ) function configureButtons( element ) { - if ( canEditSystem ) + if ( canEditGroups ) { var form = element.form; if ( element.checked ) diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index 5e335ce43..7b24eafa7 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -159,6 +159,7 @@ elseif ( $tab == "users" ) + @@ -194,6 +195,7 @@ elseif ( $tab == "users" ) + diff --git a/web/skins/classic/views/user.php b/web/skins/classic/views/user.php index 274fd2fc5..d6f577604 100644 --- a/web/skins/classic/views/user.php +++ b/web/skins/classic/views/user.php @@ -117,6 +117,10 @@ if ( canEdit( 'System' ) ) + + + +