[vhffs-dev] [svn] commit: r92 - in /trunk: vhffs-api/src/Vhffs/Acl.pm vhffs-panel/admin/svn/list.pl vhffs-panel/svn/prefs.pl vhffs-panel/templates/admin/svn/part.tmpl vhffs-panel/web/prefs_save.pl

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Author: soda
Date: Tue Aug  9 00:54:17 2005
New Revision: 92

Log:
Admin can now edit subversion repositories
User can now save preferences of web areas
fix some bugs


Modified:
    trunk/vhffs-api/src/Vhffs/Acl.pm
    trunk/vhffs-panel/admin/svn/list.pl
    trunk/vhffs-panel/svn/prefs.pl
    trunk/vhffs-panel/templates/admin/svn/part.tmpl
    trunk/vhffs-panel/web/prefs_save.pl

Modified: trunk/vhffs-api/src/Vhffs/Acl.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Acl.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Acl.pm Tue Aug  9 00:54:17 2005
@@ -13,16 +13,27 @@
 
 sub what_perm_for_user
 {
-	my ( $entity , $object , $main ) = @_;
+	my $entity;
+	my $object;
+	my $main;
+	my $perm;
+	my $result;
+	my $query;
+	my $request;
+	my $rows;
+
+	$entity 	= 	shift;
+	$object 	= 	shift;
+	$main		=	shift;
 
 	return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) );
 
-	my $perm = Vhffs::Constants::ACL_DENIED;
-	my $result;
+	$perm = Vhffs::Constants::ACL_DENIED;
+	$result;
 	
-	my $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'";
-	my $request = $main->{'db'}->{'DB_READ'}->prepare( $query );
-	my $rows = $request->execute;
+	$query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'";
+	$request = $main->{'db'}->{'DB_READ'}->prepare( $query );
+	$rows = $request->execute;
 
 	if( $rows != 0 )
 	{
@@ -31,9 +42,9 @@
 	}
 	else
 	{
-		my $query = "SELECT acl.perm FROM vhffs_acl acl, vhffs_groups groups, vhffs_user_group ug WHERE acl.oid_dst='".$object->{'object_id'} ."' AND ug.uid='".$entity->get_uid."' AND ug.gid=groups.gid AND groups.object_id=acl.oid_src";
-		my $request = $main->{'db'}->{'DB_READ'}->prepare( $query );
-		my $rows = $request->execute;
+		$query = "SELECT acl.perm FROM vhffs_acl acl, vhffs_groups groups, vhffs_user_group ug WHERE acl.oid_dst='".$object->{'object_id'} ."' AND ug.uid='".$entity->get_uid."' AND ug.gid=groups.gid AND groups.object_id=acl.oid_src";
+		$request = $main->{'db'}->{'DB_READ'}->prepare( $query );
+		$rows = $request->execute;
 
 		if( $rows != 0 )
 		{
@@ -48,18 +59,28 @@
 
 sub what_perm_for_group
 {
-	my ( $entity , $object , $main ) = @_;
+	my $entity;
+	my $object;
+	my $main;
+	my $query;
+	my $request;
+	my $result;
+	my $rows;
+
+	$entity		=	shift;
+	$object		=	shift;
+	$main		=	shift;
 
 	return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) );
 	
-	my $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'";
+	$query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'";
 
-	my $request = $main->{'db'}->{'DB_READ'}->prepare( $query );
-	my $rows = $request->execute;
+	$request = $main->{'db'}->{'DB_READ'}->prepare( $query );
+	$rows = $request->execute;
 
 	if ( $rows != 0 )
 	{
-		my $result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query );
+		$result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query );
 		return $result->[0][0];
 	}
 	else
@@ -149,11 +170,18 @@
 
 sub getall_acl_for_group_per_object
 {
-	my ( $obj , $main ) = @_;
+	my $obj;
+	my $main;
+	my $query;
+	my $request;
+
+	$obj		=	shift;
+	$main		=	shift;
+
 	return -1 if( $obj->fetch < 0 );
 
-	my $query = "SELECT groups.groupname, perm FROM vhffs_acl acl, vhffs_groups groups WHERE oid_src=groups.object_id AND oid_dst='".$obj->{'object_id'} ."'"; 
-	my $request = $main->{'db'}->{'DB_READ'}->prepare( $query );
+	$query = "SELECT groups.groupname, perm FROM vhffs_acl acl, vhffs_groups groups WHERE oid_src=groups.object_id AND oid_dst='".$obj->{'object_id'} ."'"; 
+	$request = $main->{'db'}->{'DB_READ'}->prepare( $query );
 	return undef if( $request->execute <= 0 );
 	return ( $request->fetchall_hashref('groupname') );
 }

Modified: trunk/vhffs-panel/admin/svn/list.pl
==============================================================================
--- trunk/vhffs-panel/admin/svn/list.pl (original)
+++ trunk/vhffs-panel/admin/svn/list.pl Tue Aug  9 00:54:17 2005
@@ -72,6 +72,7 @@
 			$subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $svn->get_status ) );
 
 			if( $user->is_admin == 1 )  {
+				$subtemplate->param( CGIGROUP => $svn->get_group->get_groupname  );
 				$subtemplate->param( SEND => gettext("Modify this Subversion repository") );
 			}
 

Modified: trunk/vhffs-panel/svn/prefs.pl
==============================================================================
--- trunk/vhffs-panel/svn/prefs.pl (original)
+++ trunk/vhffs-panel/svn/prefs.pl Tue Aug  9 00:54:17 2005
@@ -7,7 +7,6 @@
 use CGI;
 use CGI::Session;
 use strict;
-use Data::Dumper;
 
 use Vhffs::User;
 use Vhffs::Group;
@@ -27,22 +26,36 @@
 my $group = $panel->{'group'};
 my $projectname = $session->param("project");
 my $cgi = $panel->{'cgi'};
+my $cgigroupname = $cgi->param('cgigroup');
 my $repo_name = $cgi->param("name");
 my $template;
 my $output;
 my $subtemplate;
+my $svn;
+my $templatedir;
+my $message;
 
-my $svn = new Vhffs::Services::Svn( $vhffs , $repo_name  , undef , $group );
+$templatedir = $vhffs->get_config->get_templatedir;
 
-my $templatedir = $vhffs->get_config->get_templatedir;
+if( defined $cgigroupname )
+{
+	$group = new Vhffs::Group( $vhffs , $cgigroupname , '401' );
+	$group->fetch;
+}
 
-my $message;
+$svn = new Vhffs::Services::Svn( $vhffs , $repo_name  , undef , $group );
+
 
 if( ( ! defined $repo_name ) || ( ! defined $svn ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-	$message = gettext( "CGI Error !");
+	$message = gettext( "CGI Error ! $cgigroupname" );
 	$template->param( MESSAGE => $message );
+}
+elsif( ( ! defined $group ) || ( $group->fetch < 0 ) )
+{
+	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
+	$template->param( MESSAGE => gettext("Error on this group") );
 }
 elsif( $svn->fetch < 0 )
 {

Modified: trunk/vhffs-panel/templates/admin/svn/part.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/admin/svn/part.tmpl (original)
+++ trunk/vhffs-panel/templates/admin/svn/part.tmpl Tue Aug  9 00:54:17 2005
@@ -11,8 +11,9 @@
 	</td>
 	<td>
 		<form method="post" action="../../svn/prefs.pl">
-			<input type="hidden" name="OID" value="<TMPL_VAR NAME="OID">" />
-			<input type="hidden" name="name" value="<TMPL_VAR NAME="SVNROOT">" />
+			<input type="hidden" id="OID" name="OID" value="<TMPL_VAR NAME="OID">" />
+			<input type="hidden" id="name" name="name" value="<TMPL_VAR NAME="SVNROOT">" />
+			<input type="hidden" id="cgigroup" name="cgigroup" value="<TMPL_VAR NAME="CGIGROUP">" />
 			<input type="submit" value="<TMPL_VAR NAME="SEND">" />
 		</form>
 	</td>

Modified: trunk/vhffs-panel/web/prefs_save.pl
==============================================================================
--- trunk/vhffs-panel/web/prefs_save.pl (original)
+++ trunk/vhffs-panel/web/prefs_save.pl Tue Aug  9 00:54:17 2005
@@ -30,16 +30,17 @@
 my $cgi = $panel->{'cgi'};
 my $message;
 my $owner = $cgi->param("PROJECT_OWNER");
+my $template;
+my $crawl;
+my $description;
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
-#We test if the owner exist
-
 my $servername = $cgi->param("name");
 
-my $web = new Vhffs::Services::Httpd( $vhffs , $servername , $user , $group );
 
 
+my $web = new Vhffs::Services::Httpd( $vhffs , $servername , $user , $group );
 
 if( ( ! defined( $web ) )  || ( $web->fetch < 0 ) )
 {
@@ -49,14 +50,14 @@
 {
 	$message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
 }
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $web , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) || ( $user->is_admin != 1 ) )
+elsif( ( Vhffs::Acl::what_perm_for_user( $user , $web , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
 {
 	$message = gettext( "You're not allowed to do this (ACL rights)" );
 }
 else
 {
-	my $crawl = $cgi->param("CRAWL");
-	my $description = $cgi->param("DESCRIPTION");
+	$crawl = $cgi->param("CRAWL");
+	$description = $cgi->param("DESCRIPTION");
 	$web->set_crawl( $crawl );
 	$web->set_description( $description );
 	$web->commit;
@@ -64,7 +65,7 @@
 }
 
 
-my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
+$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 $template->param( MESSAGE => $message );
 
 set_refresh_url Vhffs::Panel::Main($panel, "/web/prefs.pl?name=$servername", 0);




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/