[vhffs-dev] [619] ACL management use only one page. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 619
Author: beuss
Date: 2007-05-20 17:48:53 +0000 (Sun, 20 May 2007)
Log Message:
-----------
ACL management use only one page. Less fetches. More understandable names for columns.
Modified Paths:
--------------
branches/vhffs-design/vhffs-api/src/Vhffs/Acl.pm
branches/vhffs-design/vhffs-backend/src/pgsql/initdb.sql.in
branches/vhffs-design/vhffs-compat/4.0.sql.in
branches/vhffs-design/vhffs-panel/Makefile.am
branches/vhffs-design/vhffs-panel/acl/view.pl
branches/vhffs-design/vhffs-panel/cvs/prefs.pl
branches/vhffs-design/vhffs-panel/dns/prefs.pl
branches/vhffs-design/vhffs-panel/mail/prefs.pl
branches/vhffs-design/vhffs-panel/mailinglist/prefs.pl
branches/vhffs-design/vhffs-panel/mysql/prefs.pl
branches/vhffs-design/vhffs-panel/pgsql/prefs.pl
branches/vhffs-design/vhffs-panel/repository/prefs.pl
branches/vhffs-design/vhffs-panel/svn/prefs.pl
branches/vhffs-design/vhffs-panel/templates/acl/view.tmpl
branches/vhffs-design/vhffs-panel/templates/acl/view_each.tmpl
branches/vhffs-design/vhffs-panel/templates/cvs/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/dns/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/mail/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/mailinglist/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/mysql/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/pgsql/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/repository/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/svn/prefs.tmpl
branches/vhffs-design/vhffs-panel/templates/web/prefs.tmpl
branches/vhffs-design/vhffs-panel/web/prefs.pl
Removed Paths:
-------------
branches/vhffs-design/vhffs-panel/acl/add_acl_group.pl
branches/vhffs-design/vhffs-panel/acl/add_acl_user.pl
branches/vhffs-design/vhffs-panel/acl/submit.pl
Modified: branches/vhffs-design/vhffs-api/src/Vhffs/Acl.pm
===================================================================
--- branches/vhffs-design/vhffs-api/src/Vhffs/Acl.pm 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-api/src/Vhffs/Acl.pm 2007-05-20 17:48:53 UTC (rev 619)
@@ -68,20 +68,17 @@
$perm = Vhffs::Constants::ACL_DENIED;
- $query = 'SELECT perm FROM vhffs_acl WHERE oid_src=? AND oid_dst=?';
+ $query = 'SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=?';
$request = $main->{'db'}->prepare( $query );
- $rows = $request->execute($user->{'object_id'}, $object->{'object_id'});
+ $rows = $request->execute($user->get_oid, $object->get_oid);
- if( $rows != 0 )
- {
+ if( $rows != 0 ) {
($perm) = $request->fetchrow();
- }
- else
- {
+ } else {
$query = 'SELECT acl.perm FROM vhffs_acl acl
- INNER JOIN vhffs_groups g ON g.object_id = acl.oid_src
+ INNER JOIN vhffs_groups g ON g.object_id = acl.granted_oid
INNER JOIN vhffs_user_group ug ON ug.gid = g.gid
- WHERE acl.oid_dst = ? AND ug.uid = ?';
+ WHERE acl.target_oid = ? AND ug.uid = ?';
$request = $main->{'db'}->prepare( $query );
$rows = $request->execute( $object->{'object_id'}, $user->get_uid );
@@ -112,48 +109,57 @@
return -1 unless(defined $group && defined $object);
- $query = 'SELECT perm FROM vhffs_acl WHERE oid_src = ? AND oid_dst = ?';
+ $query = 'SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=?';
$request = $main->{'db'}->prepare( $query );
- $rows = $request->execute( $group->{'object_id'}, $object->{'object_id'} );
+ $rows = $request->execute( $group->get_oid, $object->get_oid );
- if ( $rows != 0 )
- {
+ if ( $rows != 0 ) {
($result) = $request->fetchrow();
- return $result;
- }
- else
- {
- return 0;
- }
-
+ return $result;
+ } else {
+ return 0;
+ }
}
+=pod
+=head2 add_acl
+
+ die("Unable to add ACL\n") if( Vhffs::Acl::add_acl($entity, $svc, $perm, $vhffs) );
+
+Grant permission C<$perm> to user or group C<$entity> on service C<$svc>.
+
+Should be modified soon to use OIDs instead of heavy objects.
+
+=cut
+
sub add_acl
{
my ( $entity , $object , $perm , $main ) = @_;
return -1 unless(defined $entity && defined $object );
+ return -2 unless( $entity->get_type == Vhffs::Constants::TYPE_USER || $entity->get_type == Vhffs::Constants::TYPE_GROUP );
+ my $sql = 'INSERT INTO vhffs_acl(granted_oid, perm, target_oid) VALUES(?, ?, ?)';
+ my $dbh = $main->get_db_object;
+ return -3 unless( $dbh->do($sql, undef, $entity->get_oid, $perm, $object->get_oid) );
+ return 1;
+}
- my $query = 'UPDATE vhffs_acl SET perm = ? WHERE oid_src = ? AND oid_dst = ?';
- my $request = $main->{'db'}->prepare( $query );
- my $result = $request->execute($perm, $entity->{'object_id'}, $object->{'object_id'}) or return -1;
- if($result && $result == 0) {
- # If update fails for a connection error, $result would be false
- # If no line are updated, $result is true but $result == 0 is true
- # too ($result contains "0E0")
- # No line updated, INSERT ACL
- $query = 'INSERT INTO vhffs_acl(oid_src, perm, oid_dst) VALUES(?, ?, ?)';
- $request = $main->{'db'}->prepare($query);
- $request->execute($entity->{'object_id'}, $perm, $object->{'object_id'}) or return -1;
-
- }
+sub update_acl
+{
+ my ($main, $target_oid, $granted_oid, $perm) = @_;
+
+ return -1 unless(defined $target_oid && defined $granted_oid && defined $perm);
+
+ my $sql = 'UPDATE vhffs_acl SET perm = ? WHERE target_oid=? AND granted_oid=?';
+ my $dbh = $main->get_db_object;
+ # If no line was updated, ACL doesn't exists => error
+ return -2 unless ($dbh->do($sql, undef, $perm, $target_oid, $granted_oid) > 0);
return 1;
}
-
sub del_acl
{
my ( $entity , $object , $main ) = @_;
@@ -164,11 +170,11 @@
$dbh->begin_work();
- my $sql = 'DELETE FROM vhffs_acl WHERE oid_src = ? AND oid_dst = ?';
+ my $sql = 'DELETE FROM vhffs_acl WHERE granted_oid=? AND target_oid=?';
my $sth = $dbh->prepare( $sql );
- $sth->execute( $entity->{'object_id'}, $object->{'object_id'}) or return -1;
+ $sth->execute( $entity->get_oid, $object->get_oid) or return -1;
- $sql = 'SELECT COUNT(*) FROM vhffs_acl WHERE perm IN (?, ?) AND oid_dst=?';
+ $sql = 'SELECT COUNT(*) FROM vhffs_acl WHERE perm IN (?, ?) AND target_oid=?';
$sth = $dbh->prepare( $sql );
$sth->execute(Vhffs::Constants::ACL_MANAGEACL, Vhffs::Constants::ACL_DELETE, $object->get_oid) or return -1;
my ($count) = $sth->fetchrow();
@@ -199,7 +205,7 @@
my ( $obj , $main ) = @_;
return -1 unless( defined $obj );
- my $sql = 'SELECT acl.oid_src, u.username AS name, acl.perm FROM vhffs_acl acl INNER JOIN vhffs_users u ON u.object_id = acl.oid_src WHERE oid_dst = ?';
+ my $sql = 'SELECT acl.granted_oid, u.username AS name, acl.perm FROM vhffs_acl acl INNER JOIN vhffs_users u ON u.object_id = acl.granted_oid WHERE target_oid=? ORDER BY u.username';
my $dbh = $main->get_db_object;
my $sth = $dbh->prepare($sql);
return undef unless($sth->execute($obj->get_oid));
@@ -222,7 +228,7 @@
my ( $obj , $main ) = @_;
return -1 unless( defined $obj );
- my $sql = 'SELECT acl.oid_src, g.groupname AS name, acl.perm FROM vhffs_acl acl INNER JOIN vhffs_groups g ON acl.oid_src = g.object_id WHERE acl.oid_dst = ?';
+ my $sql = 'SELECT acl.granted_oid, g.groupname AS name, acl.perm FROM vhffs_acl acl INNER JOIN vhffs_groups g ON acl.granted_oid=g.object_id WHERE acl.target_oid=? ORDER BY g.groupname';
my $dbh = $main->get_db_object;
my $sth = $dbh->prepare( $sql );
return undef unless( $sth->execute($obj->get_oid) );
Modified: branches/vhffs-design/vhffs-backend/src/pgsql/initdb.sql.in
===================================================================
--- branches/vhffs-design/vhffs-backend/src/pgsql/initdb.sql.in 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-backend/src/pgsql/initdb.sql.in 2007-05-20 17:48:53 UTC (rev 619)
@@ -44,11 +44,10 @@
CREATE TABLE vhffs_acl
(
- acl_id serial,
- oid_src int4,
+ granted_oid int4,
perm int4 NOT NULL,
- oid_dst int4 ,
- CONSTRAINT vhffs_acl_pkey PRIMARY KEY (acl_id)
+ target_oid int4 ,
+ CONSTRAINT vhffs_acl_pkey PRIMARY KEY (granted_oid, target_oid)
) WITH OIDS;
CREATE TABLE vhffs_groups
@@ -316,8 +315,8 @@
Defining foreign keys here allow to create tables in any order.
*******/
-ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_dst FOREIGN KEY (oid_dst) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_src FOREIGN KEY (oid_src) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_dst FOREIGN KEY (target_oid) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_src FOREIGN KEY (granted_oid) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
ALTER TABLE vhffs_groups ADD CONSTRAINT fk_vhffs_group_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
ALTER TABLE vhffs_groups ADD CONSTRAINT fk_vhffs_group_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users (uid);
Modified: branches/vhffs-design/vhffs-compat/4.0.sql.in
===================================================================
--- branches/vhffs-design/vhffs-compat/4.0.sql.in 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-compat/4.0.sql.in 2007-05-20 17:48:53 UTC (rev 619)
@@ -2,7 +2,6 @@
-- the greatest id. Ideally, vhffs should be stopped during upgrade
SELECT setval('vhffs_object_object_id_seq', (SELECT COALESCE(MAX(object_id), 1) FROM vhffs_object));
-SELECT setval('vhffs_acl_acl_id_seq', (SELECT COALESCE(MAX(acl_id), 1) FROM vhffs_acl));
SELECT setval('vhffs_groups_gid_seq', (SELECT COALESCE(MAX(gid), @MINGID@) FROM vhffs_groups));
SELECT setval('vhffs_users_uid_seq', (SELECT COALESCE(MAX(uid), @MINUID@) FROM vhffs_users));
SELECT setval('vhffs_confirmation_cid_seq', (SELECT COALESCE(MAX(cid), 1) FROM vhffs_confirmation));
@@ -47,7 +46,7 @@
UPDATE vhffs_object SET type=61 WHERE object_id IN (SELECT object_id FROM vhffs_ml);
-- cleanup unused objects
-DELETE FROM vhffs_object WHERE type='0';
+-- DELETE FROM vhffs_object WHERE type=0;
-- merge vhffs_user_info to vhffs_users
ALTER TABLE vhffs_users ADD COLUMN date_creation timestamp;
@@ -189,6 +188,13 @@
-- DROP TABLE vhffs_dns_soa;
+-- Rename vhffs_acl columns, remove unused acl_id
+ALTER TABLE vhffs_acl DROP CONSTRAINT vhffs_acl_pkey;
+ALTER TABLE vhffs_acl DROP COLUMN acl_id;
+ALTER TABLE vhffs_acl RENAME COLUMN oid_src TO granted_oid;
+ALTER TABLE vhffs_acl RENAME COLUMN oid_dst TO target_oid;
+ALTER TABLE vhffs_acl ADD CONSTRAINT vhffs_acl_pkey PRIMARY KEY (granted_oid, target_oid);
+
-- change the type of vhffs_object.state from varchar to int4 ..... (no comments allowed please)
BEGIN;
ALTER TABLE vhffs_object ADD COLUMN state_new int4;
Modified: branches/vhffs-design/vhffs-panel/Makefile.am
===================================================================
--- branches/vhffs-design/vhffs-panel/Makefile.am 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/Makefile.am 2007-05-20 17:48:53 UTC (rev 619)
@@ -14,9 +14,6 @@
panel.pl \
show_code.pl \
subscribe.pl \
- acl/add_acl_group.pl \
- acl/add_acl_user.pl \
- acl/submit.pl \
acl/view.pl \
ajax/help.pl \
admin/index.pl \
Deleted: branches/vhffs-design/vhffs-panel/acl/add_acl_group.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/acl/add_acl_group.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/acl/add_acl_group.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -1,113 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::Httpd;
-use Vhffs::Acl;
-use Vhffs::Constants;
-my $panel = new Vhffs::Panel::Main();
-if(!$panel) {
- exit 0;
-}
-
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-my $cgi = $panel->{'cgi'};
-my $type = $cgi->param("TYPE");
-my $name = $cgi->param("NAME");
-my $oid_src = $cgi->param( "OID_SRC" );
-my $oid_dst = $cgi->param( "OID_DST" );
-my $acl_level = $cgi->param( "ACL_TYPE" );
-my $groupname = $cgi->param( "GROUPNAME" );
-my $template;
-
-my $object;
-my $ok = 1;
-my $title;
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-my $obj_src = Vhffs::Group::get_by_groupname( $vhffs , $groupname );
-my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
-
-
-my $message;
-
-if( ( ! defined $groupname ) || ( ! defined $oid_dst ) || ( ! defined $acl_level ) )
-{
- $message = gettext( "CGI Error " );
-}
-elsif( ( ! defined $obj_src ) || ( ! defined $obj_dst ) )
-{
- $message = gettext( "The group does not exist" );
-}
-else
-{
- if( ( Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) )
- {
- $message = gettext("You're not allowed to view this object's ACL");
- }
- else
- {
- if( Vhffs::Acl::add_acl( $obj_src , $obj_dst , $acl_level , $vhffs ) < 0 )
- {
- $message = gettext( "Sorry, can't add ACL");
- }
- else
- {
- $message = gettext( "ACL successfully added");
- }
-
- }
-}
- $template->param( MESSAGE => $message );
-
-display Vhffs::Panel::Main($panel, $template->output);
Deleted: branches/vhffs-design/vhffs-panel/acl/add_acl_user.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/acl/add_acl_user.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/acl/add_acl_user.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -1,113 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::Httpd;
-use Vhffs::Acl;
-use Vhffs::Constants;
-my $panel = new Vhffs::Panel::Main();
-if(!$panel) {
- exit 0;
-}
-
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-my $cgi = $panel->{'cgi'};
-my $type = $cgi->param("TYPE");
-my $name = $cgi->param("NAME");
-my $oid_src = $cgi->param( "OID_SRC" );
-my $oid_dst = $cgi->param( "OID_DST" );
-my $acl_level = $cgi->param( "ACL_TYPE" );
-my $username = $cgi->param( "USERNAME" );
-my $template;
-
-my $object;
-my $ok = 1;
-my $title;
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-my $obj_src = Vhffs::User::get_by_username( $vhffs , $username );
-my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
-
-
-my $message;
-
-if( ( ! defined $username ) || ( ! defined $oid_dst ) || ( ! defined $acl_level ) )
-{
- $message = gettext( "CGI Error " );
-}
-elsif( ( ! defined $obj_src ) || ( ! defined $obj_dst ) )
-{
- $message = gettext( "Object Error" );
-}
-else
-{
- if( ( Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) )
- {
- $message = gettext("You're not allowed to view this object's ACL");
- }
- else
- {
- if( Vhffs::Acl::add_acl( $obj_src , $obj_dst , $acl_level , $vhffs ) < 0 )
- {
- $message = gettext( "Sorry, can't add ACL");
- }
- else
- {
- $message = gettext( "ACL successfully added");
- }
-
- }
-}
- $template->param( MESSAGE => $message );
-
-display Vhffs::Panel::Main($panel, $template->output);
Deleted: branches/vhffs-design/vhffs-panel/acl/submit.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/acl/submit.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/acl/submit.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -1,127 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::Httpd;
-use Vhffs::Acl;
-use Vhffs::Constants;
-my $panel = new Vhffs::Panel::Main();
-if(!$panel) {
- exit 0;
-}
-
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-my $cgi = $panel->{'cgi'};
-my $type = $cgi->param("TYPE");
-my $name = $cgi->param("NAME");
-my $oid_src = $cgi->param( "OID_SRC" );
-my $oid_dst = $cgi->param( "OID_DST" );
-my $acl_level = $cgi->param( "acl$oid_src" );
-my $template;
-
-my $object;
-my $ok = 1;
-my $title;
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-my $obj_src = Vhffs::Object::get_by_oid( $vhffs , $oid_src );
-my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst );
-
-
-my $message;
-
-if( ( ! defined $oid_src ) || ( ! defined $oid_dst ) || ( ! defined $acl_level ) )
-{
- $message = gettext( "CGI Error" );
-}
-elsif( ( ! defined $obj_src ) || ( ! defined $obj_dst ) )
-{
- $message = gettext( "Object Error" );
-}
-else
-{
- if( ( Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) )
- {
- $message = gettext("You're not allowed to view this object's ACL");
- }
- else
- {
-
- if( $acl_level == Vhffs::Constants::ACL_DENIED )
- {
- if( Vhffs::Acl::del_acl( $obj_src , $obj_dst , $vhffs ) < 0 )
- {
- $message = gettext( "Sorry, can't delete this ACL");
- }
- else
- {
- $message = gettext( "ACL successfully deleted");
- }
- }
- else
- {
- if( Vhffs::Acl::add_acl( $obj_src , $obj_dst , $acl_level , $vhffs ) < 0 )
- {
- $message = gettext( "Sorry, can't add ACL");
- }
- else
- {
- $message = gettext( "ACL successfully modified");
- }
- }
-
- }
-}
- $template->param( MESSAGE => $message );
-
-display Vhffs::Panel::Main($panel, $template->output);
Modified: branches/vhffs-design/vhffs-panel/acl/view.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/acl/view.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/acl/view.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -53,100 +53,82 @@
exit 0;
}
-my $vhffs = $panel->{'vhffs'};
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-my $cgi = $panel->{'cgi'};
-my $type = $cgi->param("TYPE");
-my $name = $cgi->param("NAME");
+my $vhffs = $panel->{vhffs};
+my $user = $panel->{user};
+my $cgi = $panel->{cgi};
+my $oid = $cgi->param('target_oid');
+my $templatedir = $vhffs->get_config->get_templatedir;
my $template;
-my $message;
-my $object;
-my $ok = 1;
-my $g;
-my $u;
-my $templatedir = $vhffs->get_config->get_templatedir;
+my $object = Vhffs::Object::get_by_oid($vhffs, $oid);
+my $access_level = Vhffs::Acl::what_perm_for_user( $user , $object , $vhffs );
-#First, we instanciate an Object, according to the variable $type
-if( $type eq "web" )
-{
- $object = Vhffs::Services::Httpd::get_by_servername( $vhffs , $name );
-}
-elsif( $type eq "dns" )
-{
- $object = Vhffs::Services::DNS::get_by_domainname( $vhffs , $name );
-}
-elsif( $type eq "mysql" )
-{
- $object = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $name );
-}
-elsif( $type eq "pgsql" )
-{
- $object = Vhffs::Services::Postgres::get_by_dbname( $vhffs , $name );
-}
-elsif( $type eq "cvs" )
-{
- $object = Vhffs::Services::Cvs::get_by_cvsroot( $vhffs , $name );
-}
-elsif( $type eq "svn" )
-{
- $object = Vhffs::Services::Svn::get_by_reponame( $vhffs , $name );
-}
-elsif( $type eq "ns" )
-{
- #?????
- $object = Vhffs::Services::DNS::get_by_domainname( $vhffs , $name );
-}
-elsif( $type eq "mail" )
-{
- $object = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $name );
-}
-elsif( $type eq "ml" )
-{
- my( $lpart , $domain ) = split( /\@/ , $name );
- $object = Vhffs::Services::Mailing::get_by_mladdress( $vhffs , $lpart , $domain );
-}
-elsif( $type eq "repository" )
-{
- $object = Vhffs::Services::Repository::get_by_reponame( $vhffs , $name );
-}
-else
-{
- #If the type was not found, we juste print an error
- $ok = 0;
- $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
- $message = gettext( "This type of object is not treated in the panel.");
- $template->param( MESSAGE => $message );
-}
+# Object does not exists
+if( ! defined $object ) {
+ $template = new HTML::Template( filename => $templatedir.'/misc/simplemsg.tmpl' );
+ $template->param( MESSAGE => sprintf( gettext('Cannot get informations on object #%d'), $oid) );
+} else {
+ # Object exists, we need to know if access is granted to the user
+ if( ( $access_level < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) ) {
+ $template = new HTML::Template( filename => $templatedir.'/misc/simplemsg.tmpl' );
+ $template->param( MESSAGE => gettext('You\'re not allowed to view this object\'s ACL') );
+ } else {
+ # access OK, let's see if some action was requested
+ if(defined $cgi->param('add_acl_user_submit')) {
+ my $perm = $cgi->param('perm');
+ my $username = $cgi->param('username');
+ my $acl_user;
+ if(! (defined $perm && defined $username) ) {
+ $panel->add_error( gettext('CGI Error') );
+ } elsif( ! defined($acl_user = Vhffs::User::get_by_username( $vhffs, $username ) ) ) {
+ $panel->add_error( gettext('User not found') );
+ } elsif( ( $access_level < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) ) {
+ $panel->add_error( gettext('You\'re not allowed to manage this object\'s ACL') );
+ } elsif( Vhffs::Acl::add_acl ($acl_user, $object, $perm, $vhffs ) < 0 ) {
+ $panel->add_error( gettext('Sorry, can\'t add ACL') );
+ } else {
+ $panel->add_info( gettext('ACL sucessfuly added') );
+ }
+ } elsif(defined $cgi->param('add_acl_group_submit')) {
+ my $perm = $cgi->param('perm');
+ my $groupname = $cgi->param('groupname');
+ my $acl_group;
+ if(! (defined $perm && defined $groupname) ) {
+ $panel->add_error( gettext('CGI Error') );
+ } elsif( ! defined($acl_group = Vhffs::Group::get_by_groupname( $vhffs, $groupname ) ) ) {
+ $panel->add_error( gettext('Group not found') );
+ } elsif( ( $access_level < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) ) {
+ $panel->add_error( gettext('You\'re not allowed to manage this object\'s ACL') );
+ } elsif( Vhffs::Acl::add_acl ($acl_group, $object, $perm, $vhffs ) < 0 ) {
+ $panel->add_error( gettext('Sorry, can\'t add ACL') );
+ } else {
+ $panel->add_info( gettext('ACL sucessfuly added') );
+ }
+ } elsif(defined $cgi->param('update_acl_submit')) {
+ my $granted_oid = $cgi->param('granted_oid');
+ my $perm = $cgi->param('perm'.$granted_oid);
+ my $granted;
+ if(! (defined $granted_oid && defined $perm) ) {
+ $panel->add_error( gettext('CGI Error') );
+ } elsif( ! defined( $granted = Vhffs::Object::get_by_oid( $vhffs, $granted_oid ) ) ) {
+ $panel->add_error( gettext('Group or user not found') );
+ } elsif( ( $access_level < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) ) {
+ $panel->add_error( gettext('You\'re not allowed to manage this object\'s ACL') );
+ } elsif( Vhffs::Acl::update_acl( $vhffs, $object->get_oid, $granted_oid, $perm ) < 0 ) {
+ $panel->add_error( gettext('Sorry, can\'t update ACL') );
+ } else {
+ $panel->add_info( gettext('ACL updated') );
+ }
+ }
+ $template = new HTML::Template( filename => $templatedir.'/acl/view.tmpl' );
-# $ok = 1 , so, ths object is instanciate
-if( $ok == 1 )
-{
- if( ! defined $object )
- {
- $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
- $message = sprintf( gettext("Cannot get informations on this object %s %s"), $type, $name);
- $template->param( MESSAGE => $message );
-
- }
- elsif( ( Vhffs::Acl::what_perm_for_user( $user , $object , $vhffs ) < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) )
- {
- $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
- $message = gettext("You're not allowed to view this object's ACL");
- $template->param( MESSAGE => $message );
- }
- else
- {
- $template = new HTML::Template( filename => $templatedir."/acl/view.tmpl" );
-
$panel->set_title( gettext('ACL Administration') );
+ # Disable ACL managment facilities if user doesn't have enough rights
+ $template->param( MANAGE_ACL => ($access_level >= Vhffs::Constants::ACL_MANAGEACL));
+
$template->param( TEXT_USERNAME => gettext('Username:' ) );
$template->param( TEXT_GROUPNAME => gettext('Groupname:' ) );
@@ -164,7 +146,7 @@
$template->param( TEXT_ACL_LEVEL => gettext('ACL level') );
- $template->param( OIDDST => $object->get_oid );
+ $template->param( OID => $object->get_oid );
$template->param( SEND => gettext('Send it') );
my $user_rights = Vhffs::Acl::getall_acl_for_user_per_object( $object , $vhffs );
my $group_rights = Vhffs::Acl::getall_acl_for_group_per_object( $object , $vhffs );
@@ -183,13 +165,14 @@
$subtemplate->param( TEXT_ACL_DELETE => gettext('Can destroy this service') );
$subtemplate->param( TEXT_MODIFY => gettext('Modify') );
- $subtemplate->param( OIDDST => $object->get_oid );
+ $subtemplate->param( TARGET_OID => $object->get_oid );
- # fills users ACL
+ # fill in users' ACL
$subtemplate->param( TEXT_TYPE => gettext('Username') );
$subtemplate->param( rights => $user_rights );
$template->param( USERS_TABLE => $subtemplate->output );
+ # fill in groups' ACL
$subtemplate->param( TEXT_TYPE => gettext('Groupname') );
$subtemplate->param( rights => $group_rights );
$template->param( GROUPS_TABLE => $subtemplate->output );
Modified: branches/vhffs-design/vhffs-panel/cvs/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/cvs/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/cvs/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -86,9 +86,10 @@
} else {
$template = new HTML::Template( filename => $templatedir."/cvs/prefs.tmpl" );
- $template->param( TEXT_TITLE => gettext("Admin CVS Repository") );
+ $panel->set_title( gettext('Admin CVS Repository') );
$template->param( TEXT_REPONAME => $cvs->get_cvsroot );
+ $template->param( VALUE_OID => $cvs->get_oid );
$template->param( TEXT_PUBLIC => gettext("Is this CVS repository public ??") );
$template->param( PUBLIC_YES => gettext("Yes") );
$template->param( PUBLIC_NO => gettext("No") );
Modified: branches/vhffs-design/vhffs-panel/dns/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/dns/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/dns/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -54,6 +54,8 @@
my $vhffs = $panel->{'vhffs'};
my $domain_name = $cgi->param('domain');
+# FIXME Temporary hack to be compatible with project info page
+$domain_name = $cgi->param('name') unless(defined $domain_name);
my $user = $panel->{'user'};
my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
@@ -254,6 +256,7 @@
#Treat ACL part
+ $template->param( VALUE_OID => $dns->get_oid );
$template->param( TEXT_ACL_ADMIN => gettext( "Admin Rights on this object (ACL)") );
$template->param( EXPLAIN_ADMIN_ACL => gettext( "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.") );
$template->param( ADMIN_ACL => gettext("Ok, go to ACL admin") );
Modified: branches/vhffs-design/vhffs-panel/mail/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/mail/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/mail/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -134,6 +134,7 @@
$template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
$template->param( TEXT_DELETE => gettext("Delete") );
+ $template->param( VALUE_OID => $mail->get_oid );
$template->param( TEXT_ACL_ADMIN => gettext("Admin Rights on this object (ACL)") );
$template->param( EXPLAIN_ADMIN_ACL => gettext("You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.") );
$template->param( ADMIN_ACL => gettext( "Ok, go to ACL admin" ) );
Modified: branches/vhffs-design/vhffs-panel/mailinglist/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/mailinglist/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/mailinglist/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -205,6 +205,7 @@
$template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
$template->param( TEXT_DELETE => gettext("Delete") );
+ $template->param( VALUE_OID => $list->get_oid );
$template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
$template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
$template->param( ADMIN_ACL => "Ok, go to ACL admin" );
Modified: branches/vhffs-design/vhffs-panel/mysql/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/mysql/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/mysql/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -105,7 +105,8 @@
$template->param( TEXT_DBPASS => gettext("Password for this database") );
#$template->param( VALUE_DBPASS => $mysql->get_dbpassword );
-
+
+ $template->param( VALUE_OID => $mysql->get_oid );
$template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
$template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
$template->param( ADMIN_ACL => "Ok, go to ACL admin" );
Modified: branches/vhffs-design/vhffs-panel/pgsql/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/pgsql/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/pgsql/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -98,7 +98,8 @@
$template->param( TEXT_DBPASS => gettext("Password for this database") );
# $template->param( VALUE_DBPASS => $pgsql->get_dbpassword );
-
+
+ $template->param( VALUE_OID => $pgsql->get_oid );
$template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
$template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
$template->param( ADMIN_ACL => "Ok, go to ACL admin" );
Modified: branches/vhffs-design/vhffs-panel/repository/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/repository/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/repository/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -106,6 +106,7 @@
$template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
$template->param( TEXT_DELETE => gettext("Delete") );
+ $template->param( VALUE_OID => $repo->get_oid );
$template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
$template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
$template->param( ADMIN_ACL => "Ok, go to ACL admin" );
Modified: branches/vhffs-design/vhffs-panel/svn/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/svn/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/svn/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -126,15 +126,16 @@
$template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
$template->param( TEXT_DELETE => gettext("Delete") );
- $template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
- $template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
- $template->param( ADMIN_ACL => "Ok, go to ACL admin" );
- $template->param( TITLE_PERM => "Fix permissions in this repository" );
- $template->param( PERM_TEXT => "Fixing permissions on a repository solve permission access on the repository. Can be helpful if you encounter problems" );
- $template->param( TEXT_BUTTON_PERM => "Fix them !" );
+ $template->param( VALUE_OID => $svn->get_oid );
+ $template->param( TEXT_ACL_ADMIN => gettext('Admin Rights on this object (ACL)') );
+ $template->param( EXPLAIN_ADMIN_ACL => gettext('You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.') );
+ $template->param( ADMIN_ACL => gettext('Ok, go to ACL admin') );
+ $template->param( TITLE_PERM => gettext('Fix permissions in this repository') );
+ $template->param( PERM_TEXT => gettext('Fixing permissions on a repository solve permission access on the repository. Can be helpful if you encounter problems') );
+ $template->param( TEXT_BUTTON_PERM => gettext('Fix them !') );
- $template->param( TITLE_OPT => "Options" );
- $template->param( TEXT_OPT_ML => "Notify changes on mailing-list :");
+ $template->param( TITLE_OPT => gettext('Options') );
+ $template->param( TEXT_OPT_ML => gettext('Notify changes on mailing-list :'));
if ( $svn->{ml_name} ne '' )
{
Modified: branches/vhffs-design/vhffs-panel/templates/acl/view.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/acl/view.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/acl/view.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -2,54 +2,57 @@
<TMPL_VAR NAME="USERS_TABLE">
+<tmpl_if name="MANAGE_ACL">
<h3>Add an ACL for a User</h3>
-<form method="post" action="add_acl_user.pl">
+<form method="post" action="/acl/view.pl">
<p>
- <label for="USERNAME">
+ <label for="acl_username">
<TMPL_VAR NAME="TEXT_USERNAME">
</label>
- <input type="text" name="USERNAME" id="USERNAME"/>
+ <input type="text" name="username" id="acl_username"/>
</p>
<p>
- <label for="ACL_TYPE">
+ <label for="acl_user_perm">
<TMPL_VAR NAME="TEXT_ACL_LEVEL">
</label>
- <select name="ACL_TYPE" id="ACL_TYPE">
+ <select name="perm" id="acl_user_perm">
<option value="<TMPL_VAR NAME="VALUE_ACL_DENIED">" <TMPL_VAR NAME="DENIED_SELECTED">><TMPL_VAR NAME="TEXT_ACL_DENIED"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_VIEW">" <TMPL_VAR NAME="VIEW_SELECTED">><TMPL_VAR NAME="TEXT_ACL_VIEW"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_MODIFY">" <TMPL_VAR NAME="MODIFY_SELECTED">><TMPL_VAR NAME="TEXT_ACL_MODIFY"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_MANAGEACL">" <TMPL_VAR NAME="MANAGEACL_SELECTED">><TMPL_VAR NAME="TEXT_ACL_MANAGEACL"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_DELETE">" <TMPL_VAR NAME="DELETE_SELECTED">><TMPL_VAR NAME="TEXT_ACL_DELETE"></option>
</select>
- </p>
+ </p>
<p class="button">
- <input type="HIDDEN" name="OID_DST" value="<TMPL_VAR NAME="OIDDST">" />
- <input type="submit" value="<TMPL_VAR NAME="SEND">" />
+ <input type="HIDDEN" name="target_oid" value="<TMPL_VAR NAME="OID">" />
+ <input type="submit" value="<TMPL_VAR NAME="SEND">" name="add_acl_user_submit"/>
</p>
</form>
+</tmpl_if>
<h2>ACL for Groups</h2>
<TMPL_VAR NAME="GROUPS_TABLE">
+<tmpl_if name="MANAGE_ACL">
<h3>Add an ACL for a Group</h3>
-<form method="post" action="add_acl_group.pl">
+<form method="post" action="/acl/view.pl">
<p>
- <label for="GROUPNAME">
+ <label for="acl_groupname">
<TMPL_VAR NAME="TEXT_GROUPNAME">
</label>
- <input type="text" name="GROUPNAME" id="GROUPNAME"/>
+ <input type="text" name="groupname" id="acl_groupname"/>
</p>
<p>
- <label for="ACL_TYPE">
+ <label for="acl_group_perm">
<TMPL_VAR NAME="TEXT_ACL_LEVEL">
</label>
- <select name="ACL_TYPE" id="ACL_TYPE">
+ <select name="perm" id="acl_group_perm">
<option value="<TMPL_VAR NAME="VALUE_ACL_DENIED">" <TMPL_VAR NAME="DENIED_SELECTED">><TMPL_VAR NAME="TEXT_ACL_DENIED"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_VIEW">" <TMPL_VAR NAME="VIEW_SELECTED">><TMPL_VAR NAME="TEXT_ACL_VIEW"></option>
<option value="<TMPL_VAR NAME="VALUE_ACL_MODIFY">" <TMPL_VAR NAME="MODIFY_SELECTED">><TMPL_VAR NAME="TEXT_ACL_MODIFY"></option>
@@ -58,8 +61,8 @@
</select>
</p>
<p class="button">
- <input type="hidden" name="OID_DST" value="<TMPL_VAR NAME="OIDDST">" />
- <input type="submit" value="<TMPL_VAR NAME="SEND">" />
+ <input type="hidden" name="target_oid" value="<TMPL_VAR NAME="OID">" />
+ <input type="submit" value="<TMPL_VAR NAME="SEND">" name="add_acl_group_submit" />
</p>
</form>
-
+</tmpl_if>
Modified: branches/vhffs-design/vhffs-panel/templates/acl/view_each.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/acl/view_each.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/acl/view_each.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -13,18 +13,18 @@
</div>
<div class="tablebody">
<tmpl_loop name="rights">
- <form method="post" action="submit.pl">
+ <form method="post" action="view.pl">
<p>
<span><TMPL_VAR NAME="NAME"></span>
- <span><input type="radio" name="acl<TMPL_VAR NAME="OID_SRC">" value="<TMPL_VAR NAME="VALUE_ACL_DENIED">" <tmpl_if expr="perm==VALUE_ACL_DENIED">checked="checked"</tmpl_if>/></span>
- <span><input type="radio" name="acl<TMPL_VAR NAME="OID_SRC">" value="<TMPL_VAR NAME="VALUE_ACL_VIEW">" <tmpl_if expr="perm==VALUE_ACL_VIEW">checked="checked"</tmpl_if>/></span>
- <span><input type="radio" name="acl<TMPL_VAR NAME="OID_SRC">" value="<TMPL_VAR NAME="VALUE_ACL_MODIFY">" <tmpl_if expr="perm==VALUE_ACL_MODIFY">checked="checked"</tmpl_if>/></span>
- <span><input type="radio" name="acl<TMPL_VAR NAME="OID_SRC">" value="<TMPL_VAR NAME="VALUE_ACL_MANAGEACL">" <tmpl_if expr="perm==VALUE_ACL_MANAGEACL">checked="checked"</tmpl_if>/></span>
- <span><input type="radio" name="acl<TMPL_VAR NAME="OID_SRC">" value="<TMPL_VAR NAME="VALUE_ACL_DELETE">" <tmpl_if expr="perm==VALUE_ACL_DELETE">checked="checked"</tmpl_if>/></span>
+ <span><input type="radio" name="perm<TMPL_VAR NAME="GRANTED_OID">" value="<TMPL_VAR NAME="VALUE_ACL_DENIED">" <tmpl_if expr="perm==VALUE_ACL_DENIED">checked="checked"</tmpl_if>/></span>
+ <span><input type="radio" name="perm<TMPL_VAR NAME="GRANTED_OID">" value="<TMPL_VAR NAME="VALUE_ACL_VIEW">" <tmpl_if expr="perm==VALUE_ACL_VIEW">checked="checked"</tmpl_if>/></span>
+ <span><input type="radio" name="perm<TMPL_VAR NAME="GRANTED_OID">" value="<TMPL_VAR NAME="VALUE_ACL_MODIFY">" <tmpl_if expr="perm==VALUE_ACL_MODIFY">checked="checked"</tmpl_if>/></span>
+ <span><input type="radio" name="perm<TMPL_VAR NAME="GRANTED_OID">" value="<TMPL_VAR NAME="VALUE_ACL_MANAGEACL">" <tmpl_if expr="perm==VALUE_ACL_MANAGEACL">checked="checked"</tmpl_if>/></span>
+ <span><input type="radio" name="perm<TMPL_VAR NAME="GRANTED_OID">" value="<TMPL_VAR NAME="VALUE_ACL_DELETE">" <tmpl_if expr="perm==VALUE_ACL_DELETE">checked="checked"</tmpl_if>/></span>
<span>
- <input type="hidden" NAME="OID_SRC" VALUE="<TMPL_VAR NAME="OID_SRC">" />
- <input type="hidden" NAME="OID_DST" VALUE="<TMPL_VAR NAME="OIDDST">" />
- <input type="submit" value="<TMPL_VAR NAME="TEXT_MODIFY">" />
+ <input type="hidden" NAME="granted_oid" VALUE="<TMPL_VAR NAME="GRANTED_OID">" />
+ <input type="hidden" NAME="target_oid" VALUE="<TMPL_VAR NAME="TARGET_OID">" />
+ <input type="submit" value="<TMPL_VAR NAME="TEXT_MODIFY">" name="update_acl_submit"/>
</span>
</p>
</form>
Modified: branches/vhffs-design/vhffs-panel/templates/cvs/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/cvs/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/cvs/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -1,4 +1,3 @@
-<h1><tmpl_var name="TEXT_TITLE"></h1>
<h2><tmpl_var name="TEXT_REPONAME"></h2>
<form method="post" action="/cvs/prefs_save.pl">
@@ -38,8 +37,7 @@
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
<p class="button" id="buttonSendAcl">
- <input type="hidden" name="NAME" value="<tmpl_var name="TEXT_REPONAME">" />
- <input type="hidden" name="TYPE" value="cvs" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">"/>
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
</form>
@@ -49,24 +47,22 @@
<form method="post" action="delete.pl">
<fieldset>
- <legend>
- <tmpl_var name="ASK_DELETE_CVS">:
- </legend>
+ <legend><tmpl_var name="ASK_DELETE_CVS">:</legend>
<p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
<p>
<input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
- <label for="DELETE_NO">
- <tmpl_var name="NO">
- </label>
+ <label for="DELETE_NO">
+ <tmpl_var name="NO">
+ </label>
</p>
<p>
<input type="radio" name="DELETE" id="DELETE_YES" value="1" />
- <label for="DELETE_YES">
- <tmpl_var name="YES">
- </label>
- </p>
+ <label for="DELETE_YES">
+ <tmpl_var name="YES">
+ </label>
+ </p>
</fieldset>
Modified: branches/vhffs-design/vhffs-panel/templates/dns/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/dns/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/dns/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -188,8 +188,7 @@
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
- <input type="hidden" name="NAME" value="<tmpl_var name="DOMAIN_NAME">" />
- <input type="hidden" name="TYPE" value="ns" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
Modified: branches/vhffs-design/vhffs-panel/templates/mail/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/mail/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/mail/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -72,13 +72,12 @@
</p>
</form>
-<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
+<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
-
- <input type="hidden" name="NAME" value="<tmpl_var name="VALUE_DOMAIN">" />
- <input type="hidden" name="TYPE" value="mail" />
+
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
@@ -86,34 +85,34 @@
<h2><tmpl_var name="TEXT_DELETE_MAIL"></h2>
-<form method="post" action="delete.pl">
+<form method="post" action="delete.pl">
<fieldset>
- <legend>
- <tmpl_var name="ASK_DELETE_WEB">:
- </legend>
-
- <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
- <label for="DELETE_NO">
- <tmpl_var name="NO">
- </label>
- </p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
- <label for="DELETE_YES">
- <tmpl_var name="YES">
- </label>
- </p>
- </fieldset>
-
- <p class="button" id="buttonDelete">
- <input type="hidden" name="name" value="<tmpl_var name="VALUE_DOMAIN">" />
- <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
- </p>
-
-</form>
+ <legend>
+ <tmpl_var name="ASK_DELETE_WEB">:
+ </legend>
+ <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">
+ <tmpl_var name="NO">
+ </label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <label for="DELETE_YES">
+ <tmpl_var name="YES">
+ </label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="name" value="<tmpl_var name="VALUE_DOMAIN">" />
+ <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
+ </p>
+
+</form>
+
Modified: branches/vhffs-design/vhffs-panel/templates/mailinglist/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/mailinglist/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -108,8 +108,7 @@
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
- <input type="hidden" name="NAME" value="<tmpl_var name="VALUE_LIST">" />
- <input type="hidden" name="TYPE" value="ml" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" /
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
Modified: branches/vhffs-design/vhffs-panel/templates/mysql/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/mysql/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/mysql/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -29,45 +29,44 @@
</p>
</form>
-<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
+<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
-
- <input type="hidden" name="NAME" value="<tmpl_var name="VALUE_DBNAME">" />
- <input type="hidden" name="TYPE" value="mysql" />
+
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
</form>
-
-<h2><tmpl_var name="TEXT_DELETE_MYSQL"></h2>
-
-<form method="post" action="delete.pl">
+
+<h2><tmpl_var name="TEXT_DELETE_MYSQL"></h2>
+
+<form method="post" action="delete.pl">
<fieldset>
- <legend>
- <tmpl_var name="ASK_DELETE_MYSQL">:
- </legend>
-
- <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
- <label for="DELETE_NO">
- <tmpl_var name="NO">
- </label>
- </p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
- <label for="DELETE_YES">
- <tmpl_var name="YES">
- </label>
- </p>
- </fieldset>
-
- <p class="button" id="buttonDelete">
- <input type="hidden" name="DBNAME" value="<tmpl_var name="VALUE_DBNAME">" />
- <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
- </p>
-
+ <legend>
+ <tmpl_var name="ASK_DELETE_MYSQL">:
+ </legend>
+
+ <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">
+ <tmpl_var name="NO">
+ </label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <label for="DELETE_YES">
+ <tmpl_var name="YES">
+ </label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="DBNAME" value="<tmpl_var name="VALUE_DBNAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
+ </p>
+
</form>
Modified: branches/vhffs-design/vhffs-panel/templates/pgsql/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/pgsql/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/pgsql/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -26,45 +26,44 @@
</p>
</form>
-<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
+<h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
-
- <input type="hidden" name="NAME" value="<tmpl_var name="VALUE_DBNAME">" />
- <input type="hidden" name="TYPE" value="pgsql" />
+
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
</form>
-
-<h2><tmpl_var name="TEXT_DELETE_PGSQL"></h2>
-
-<form method="post" action="delete.pl">
+
+<h2><tmpl_var name="TEXT_DELETE_PGSQL"></h2>
+
+<form method="post" action="delete.pl">
<fieldset>
- <legend>
- <tmpl_var name="ASK_DELETE_PGSQL">:
- </legend>
-
- <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
- <label for="DELETE_NO">
- <tmpl_var name="NO">
- </label>
- </p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
- <label for="DELETE_YES">
- <tmpl_var name="YES">
- </label>
- </p>
- </fieldset>
-
- <p class="button" id="buttonDelete">
- <input type="hidden" name="DBNAME" value="<tmpl_var name="VALUE_DBNAME">" />
- <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
- </p>
-
+ <legend>
+ <tmpl_var name="ASK_DELETE_PGSQL">:
+ </legend>
+
+ <p class="warning"><tmpl_var name="TEXT_BEFORE_DELETE"></p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">
+ <tmpl_var name="NO">
+ </label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <label for="DELETE_YES">
+ <tmpl_var name="YES">
+ </label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="DBNAME" value="<tmpl_var name="VALUE_DBNAME">" />
+ <input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
+ </p>
+
</form>
Modified: branches/vhffs-design/vhffs-panel/templates/repository/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/repository/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/repository/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -13,8 +13,7 @@
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
<p class="button" id="buttonSendAcl">
- <input type="hidden" name="NAME" value="<tmpl_var name="TEXT_REPONAME">" />
- <input type="hidden" name="TYPE" value="repository" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
</form>
Modified: branches/vhffs-design/vhffs-panel/templates/svn/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/svn/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/svn/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -49,8 +49,7 @@
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
- <input type="hidden" name="NAME" value="<tmpl_var name="TEXT_REPONAME">" />
- <input type="hidden" name="TYPE" value="svn" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
Modified: branches/vhffs-design/vhffs-panel/templates/web/prefs.tmpl
===================================================================
--- branches/vhffs-design/vhffs-panel/templates/web/prefs.tmpl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/templates/web/prefs.tmpl 2007-05-20 17:48:53 UTC (rev 619)
@@ -45,8 +45,7 @@
<form method="post" action="../acl/view.pl">
<p><tmpl_var name="EXPLAIN_ADMIN_ACL"></p>
- <input type="hidden" name="NAME" value="<tmpl_var name="VALUE_SERVERNAME">" />
- <input type="hidden" name="TYPE" value="web" />
+ <input type="hidden" name="target_oid" value="<tmpl_var name="VALUE_OID">" />
<p class="button" id="buttonAclAdmin">
<input type="submit" value="<tmpl_var name="ADMIN_ACL">" />
</p>
Modified: branches/vhffs-design/vhffs-panel/web/prefs.pl
===================================================================
--- branches/vhffs-design/vhffs-panel/web/prefs.pl 2007-05-20 17:38:44 UTC (rev 618)
+++ branches/vhffs-design/vhffs-panel/web/prefs.pl 2007-05-20 17:48:53 UTC (rev 619)
@@ -122,6 +122,7 @@
$template->param( TEXT_ACL_ADMIN => gettext("Admin Rights on this object (ACL)") );
$template->param( EXPLAIN_ADMIN_ACL => gettext("You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.") );
$template->param( ADMIN_ACL => gettext("Ok, go to ACL admin") );
+ $template->param( VALUE_OID => $web->get_oid );
$template->param( TEXT_DELETE_WEB => gettext("Delete this web area") );
$template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. All services associated to this project will be DESTROYED.") );