From 38a9e1273b09ab0e0946af0967232ad070eebe09 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 5 Nov 2007 21:03:21 +0000 Subject: [PATCH] ebl Add sql stuff git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5858 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/cgi/bgraph.pl | 1 + gui/bweb/script/bweb-postgresql.sql | 51 +++++++++++++++++++ .../script/upgrade-2.2_3.0_postgresql.sql | 51 +++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 gui/bweb/script/upgrade-2.2_3.0_postgresql.sql diff --git a/gui/bweb/cgi/bgraph.pl b/gui/bweb/cgi/bgraph.pl index 5c43e1fdcd..cb3cdcab61 100755 --- a/gui/bweb/cgi/bgraph.pl +++ b/gui/bweb/cgi/bgraph.pl @@ -110,6 +110,7 @@ if ($arg->{jclient_groups}) { $groupq = " AND client_group_name IN ($arg->{jclient_groups}) "; } +$bweb->can_do('r_view_job'); my $filter = $bweb->get_client_filter(); my $gtype = CGI::param('gtype') || 'bars'; diff --git a/gui/bweb/script/bweb-postgresql.sql b/gui/bweb/script/bweb-postgresql.sql index 9d62ed1985..ecd20e50a5 100644 --- a/gui/bweb/script/bweb-postgresql.sql +++ b/gui/bweb/script/bweb-postgresql.sql @@ -1,3 +1,54 @@ + +-- -------------------------------------------------- +-- Upgrade from 2.2 +-- -------------------------------------------------- +BEGIN; +CREATE TABLE bweb_user +( + userid serial not null, + username text not null, + use_acl boolean default false, + comment text default '', + passwd text default '', + primary key (userid) +); +CREATE UNIQUE INDEX bweb_user_idx on bweb_user (username); + +CREATE TABLE bweb_role +( + roleid serial not null, + rolename text not null, +-- comment text default '', + primary key (roleid) +); +CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename); + +INSERT INTO bweb_role (rolename) VALUES ('r_user_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_delete_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_prune'); +INSERT INTO bweb_role (rolename) VALUES ('r_purge'); +INSERT INTO bweb_role (rolename) VALUES ('r_group_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_location_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_cancel_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_run_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_configure'); +INSERT INTO bweb_role (rolename) VALUES ('r_client_status'); +INSERT INTO bweb_role (rolename) VALUES ('r_view_job'); + +CREATE TABLE bweb_role_member +( + roleid integer not null, + userid integer not null, + primary key (roleid, userid) +); + +CREATE TABLE bweb_client_group_acl +( + client_group_id integer not null, + userid integer not null, + primary key (client_group_id, userid) +); +COMMIT; -- -------------------------------------------------- -- Upgrade from 2.0 -- -------------------------------------------------- diff --git a/gui/bweb/script/upgrade-2.2_3.0_postgresql.sql b/gui/bweb/script/upgrade-2.2_3.0_postgresql.sql new file mode 100644 index 0000000000..5c7decee12 --- /dev/null +++ b/gui/bweb/script/upgrade-2.2_3.0_postgresql.sql @@ -0,0 +1,51 @@ +-- -------------------------------------------------- +-- Upgrade from 2.2 +-- -------------------------------------------------- + +BEGIN; +CREATE TABLE bweb_user +( + userid serial not null, + username text not null, + use_acl boolean default false, + comment text default '', + passwd text default '', + primary key (userid) +); +CREATE UNIQUE INDEX bweb_user_idx on bweb_user (username); + +CREATE TABLE bweb_role +( + roleid serial not null, + rolename text not null, +-- comment text default '', + primary key (roleid) +); +CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename); + +INSERT INTO bweb_role (rolename) VALUES ('r_user_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_delete_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_prune'); +INSERT INTO bweb_role (rolename) VALUES ('r_purge'); +INSERT INTO bweb_role (rolename) VALUES ('r_group_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_location_mgnt'); +INSERT INTO bweb_role (rolename) VALUES ('r_cancel_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_run_job'); +INSERT INTO bweb_role (rolename) VALUES ('r_configure'); +INSERT INTO bweb_role (rolename) VALUES ('r_client_status'); +INSERT INTO bweb_role (rolename) VALUES ('r_view_job'); + +CREATE TABLE bweb_role_member +( + roleid integer not null, + userid integer not null, + primary key (roleid, userid) +); + +CREATE TABLE bweb_client_group_acl +( + client_group_id integer not null, + userid integer not null, + primary key (client_group_id, userid) +); +COMMIT; -- 2.39.5