[vhffs-dev] [845] bye bye get_bad_username and get_bad_groupname, removed minuid and mingid which are not used anymore

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


Revision: 845
Author:   gradator
Date:     2007-08-30 23:55:46 +0000 (Thu, 30 Aug 2007)

Log Message:
-----------
bye bye get_bad_username and get_bad_groupname, removed minuid and mingid which are not used anymore

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Conf.pm
    trunk/vhffs-api/src/Vhffs/Functions.pm
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/User.pm
    trunk/vhffs-backend/conf/vhffs.conf.dist.in


Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm	2007-08-30 23:38:56 UTC (rev 844)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm	2007-08-30 23:55:46 UTC (rev 845)
@@ -144,58 +144,6 @@
 }
 
 
-#Open the file of bad username, fill a table with them and return a reference to it
-sub get_bad_username
-{
-    my $badusers;
-
-    if( ( defined $Config{"users"}{"bad_username_file"} ) && ( -f $Config{"users"}{"bad_username_file"} ) )
-    {
-	    open MYFILE , $Config{"users"}{"bad_username_file"};
-	
-	    while( <MYFILE> )
-	    {
-	        chomp;
-	        push( @{$badusers} , $_ );
-	    } 
-
-	    close MYFILE;
-	    return $badusers;
-    }
-    else
-    {
-	    return undef;
-    }
-    
-}
-
-
-#Same thing than get_bad_username, but for group
-sub get_bad_groupname
-{
-    my $badgroups;
-
-    if( ( defined $Config{"users"}{"bad_groupname_file"} ) && ( -f $Config{"users"}{"bad_groupname_file"} ) )
-    {
-	    open MYFILE , $Config{"users"}{"bad_groupname_file"};
-	
-	    while( <MYFILE> )
-	    {
-	        chomp;
-	        push( @{$badgroups} , $_ );
-	    } 
-
-	    close MYFILE;
-	    return $badgroups;
-    }
-    else
-    {
-	    return undef;
-    }
-    
-}
-
-
 sub get_allow_subscribe
 {
 	return -1 if( ! defined $Config{"global"}{"allow_subscribe"} );

Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm	2007-08-30 23:38:56 UTC (rev 844)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm	2007-08-30 23:55:46 UTC (rev 845)
@@ -606,4 +606,22 @@
 	close( EMPTYFILE );
 }
 
+
+# read a file and put each line in a @
+sub readfile
+{
+	my $file = shift;
+	my $l;
+
+	return undef unless( defined $file  &&  -f $file );
+
+	open MYFILE , $file;
+	while( <MYFILE> )  {
+		chomp;
+		push( @{$l} , $_ );
+	}
+	close MYFILE;
+	return $l;
+}
+
 1;

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2007-08-30 23:38:56 UTC (rev 844)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2007-08-30 23:55:46 UTC (rev 845)
@@ -71,16 +71,18 @@
     my ($main, $groupname, $owner_uid, $gid, $description) = @_;
     return undef unless check_groupname($groupname);
     return undef unless defined($owner_uid);
-    my $badgroups = $main->get_config->get_bad_groupname;
+
+    my $groupconf = $main->get_config->get_groups;
+    my $group;
+
+    use Vhffs::Functions;
+    my $badgroups = Vhffs::Functions::readfile( $groupconf->{'bad_groupname_file'} );
     if( defined $badgroups ) {
         foreach ( @{$badgroups} ) {
             return undef if ( $_ eq $groupname );
         }
     }
 
-    my $groupconf = $main->get_config->get_groups;
-    my $group;
-
     my $dbh = $main->get_db_object;
     local $dbh->{RaiseError} = 1;
     local $dbh->{PrintError} = 0;

Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm	2007-08-30 23:38:56 UTC (rev 844)
+++ trunk/vhffs-api/src/Vhffs/User.pm	2007-08-30 23:55:46 UTC (rev 845)
@@ -179,9 +179,10 @@
 sub create {
     my ( $main, $username, $password, $admin, $mail, $firstname, $lastname, $city, $zipcode, $country, $address, $gpg_key ) = @_;
     return undef unless check_username($username);
+    use Vhffs::Functions;
 
     my $userconf = $main->get_config->get_users;
-    my $badusers = $main->get_config->get_bad_username;
+    my $badusers = Vhffs::Functions::readfile( $userconf->{'bad_username_file'} );
     my $user;
 
     foreach ( @{$badusers} ) {

Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in	2007-08-30 23:38:56 UTC (rev 844)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in	2007-08-30 23:55:46 UTC (rev 845)
@@ -127,13 +127,12 @@
 ################################################
 #the default configuration for users
 <users>
-	minuid			=	@MINUID@
-	mingid			=	@MINGID@
 	bad_username_file	=	@CONFDIR@/bl_username
-	bad_groupname_file	=	@CONFDIR@/bl_groupname
+
+	default_quota		=	10
+
 	available_shells	=	/bin/bash /bin/tcsh /bin/zsh /bin/false
 	default_shell		=	/bin/false
-	default_quota		=	10
 
 	#Notation is useful to handle aggressive users
 	#If a project is refused by moderation, the note os the user if decreased
@@ -145,9 +144,12 @@
 </users>
 
 <groups>
+	bad_groupname_file	=	@CONFDIR@/bl_groupname
+
+	default_quota		=	100
+
 	# URL to the documentation (optional)
-	url_doc		=	http://help.myhoster.net/group
-	default_quota	=	100
+	url_doc			=	http://help.myhoster.net/group
 </groups>
 
 


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