[vhffs-dev] [522] Removed some out of date examples.

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


Revision: 522
Author:   beuss
Date:     2007-03-22 07:09:18 +0000 (Thu, 22 Mar 2007)

Log Message:
-----------
Removed some out of date examples. Removes all calls to $var->create from examples.

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mysql.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Postgres.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Repository.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm
    branches/vhffs_4.1/vhffs-api/src/examples/create_dns.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_group.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_list.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_mail.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_mysql.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_postgres.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_repository.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_user.pl
    branches/vhffs_4.1/vhffs-api/src/examples/create_web.pl
    branches/vhffs_4.1/vhffs-tests/src/User.pl

Removed Paths:
-------------
    branches/vhffs_4.1/vhffs-api/src/examples/test.pl
    branches/vhffs_4.1/vhffs-api/src/examples/test_dns.pl
    branches/vhffs_4.1/vhffs-api/src/examples/test_httpd.pl
    branches/vhffs_4.1/vhffs-api/src/examples/test_obj.pl
    branches/vhffs_4.1/vhffs-api/src/examples/test_user.pl


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Constants.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -7,7 +7,7 @@
 
 use constant
 {
-    VHFFS_VERSION => '4.1-alpha (Revision: 518)',
+    VHFFS_VERSION => '4.1-alpha (Revision: 521)',
     VHFFS_RELEASE_NAME => "hippocampus",
     
     WAITING_FOR_VALIDATION => 1,

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -31,7 +31,6 @@
 
 package Vhffs::Group;
 
-#Vhffs::Group written by sod` <dieu AT gunnm DOT org>
 use base qw(Vhffs::Object);
 
 use strict;
@@ -49,7 +48,7 @@
 
 TODO
 
-=head2 METHODS
+=head1 METHODS
 
 =cut
 
@@ -782,6 +781,17 @@
     return \@result;
 }
 
+=pod
+
+=head2 get_by_gid
+
+    my $group = Vhffs::Group::get_by_gid($main, $gid);
+    die('Group not found') unless(defined $group);
+
+Fetches the group whose gid is $gid.
+
+=cut
+
 sub get_by_gid {
     my ($vhffs, $gid) = @_;
     my $query = 'SELECT g.gid, o.object_id, o.owner_uid, g.uid_mod, g.groupname, g.passwd, g.quota, g.quota_used, o.date_creation, o.description, o.state FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE g.gid = ?';
@@ -793,6 +803,17 @@
     return $group;
 }
 
+=pod
+
+=head2 get_by_groupname
+
+    my $group = Vhffs::Group::get_by_groupname($main, $groupname);
+    die('Group not found') unless(defined $group);
+
+Fetches the group whose name is $groupname.
+
+=cut
+
 sub get_by_groupname {
     my ($vhffs, $groupname) = @_;
     my $query = 'SELECT g.gid, o.object_id, o.owner_uid, g.uid_mod, g.groupname, g.passwd, g.quota, g.quota_used, o.date_creation, o.description, o.state FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE g.groupname = ?';
@@ -818,3 +839,10 @@
 
 1;
 
+__END__
+
+=head1 AUTHORS
+
+soda <dieu AT gunnm DOT org>
+
+Sebastien Le Ray <beuss at tuxfamily dot org>

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Group.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -136,11 +136,6 @@
 {
 	my( $groupname , $user , $main, $description ) = @_;
 
-	#my $group = new Vhffs::Group( $main , $groupname , $user->get_uid) ;
-
-	#return -1 if( ! defined $group );
-
-	#return -2 if ($group->create < 0);
 	my $group = Vhffs::Group::create($main, $groupname, $user->get_uid, undef, $description);
 
     return undef unless( defined $group );

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -29,21 +29,27 @@
 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 # POSSIBILITY OF SUCH DAMAGE.
 
+=pod
 
-# Vhffs::Services::DNS
-# This file is a part of VHFFS4 program. It is used to manage domain name server (DNS)
-# Please respect the licence of this program.
+=head1 NAME
 
-# Author: soda < dieu at gunnm dot org >
+Vhffs::Services::DNS - Handles domain name related stuff in VHFFS
 
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
+
 package Vhffs::Services::DNS;
 
 use base qw(Vhffs::Object);
 use strict;
 use DBI;
 
-
-
 sub new
 {
     my $this;
@@ -109,7 +115,18 @@
     return $domains;
 }
 
+=pod
 
+=head2 create
+
+    my $dns = Vhffs::Services::DNS::create($main, $domain, $description, $user, $group);
+    die('Unable to create DNS') unless(defined $dns);
+
+Create a new DNS in database and returns the corresponding object.
+If the init section of the VHFFS config is filled, use it to add initial A, MX and NS records.
+
+=cut
+
 sub create
 {
     if($_[0]->isa('Vhffs::Services::DNS')) {
@@ -292,6 +309,19 @@
     return 1;
 }
 
+=pod
+
+=head2 get_by_domainname
+
+    my $dns = Vhffs::Services::DNS::get_by_domainname($main, $domainname);
+    die('Domain not found') unless(defined $dns);
+
+Fetches the DNS object whose domainname is $domainname. Returned object is fully
+functionnal. A, NS, CNAME, I<etc.> records are filled and accessible using
+C<$dns->get_xxx_type>.
+
+=cut
+
 sub get_by_domainname($$)
 {
     my ($main, $name) = @_;
@@ -1017,3 +1047,10 @@
 
 
 1;
+__END__
+
+=head1 AUTHORS
+
+soda < dieu at gunnm dot org >
+
+Sebastien Le Ray < beuss at tuxfamily dot org>

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -32,11 +32,22 @@
 
 
 # This file is a part of VHFFS4
-# It is used to manage Web Area in VHFFS hosting platform
 # Please respect the licence of this file, and the whole VHFFS software.
 
-# Author: soda < dieu at gunnm dot org>
+=pod
 
+=head1 NAME
+
+Vhffs::Services::Httpd - Handle Web Area in VHFFS hosting platform.
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
 package Vhffs::Services::Httpd;
 
 use Vhffs::Functions;
@@ -88,6 +99,17 @@
 	return 1;
 }
 
+=pod
+
+=head2 create
+
+    my $httpd = Vhffs::Services::Httpd::create($main, $servername, $description, $user, $group);
+    die("Unable to create webarea $servername\n") unless(defined $httpd);
+
+Creates a new webarea in database and returns the corresponding fully functional object.
+
+=cut
+
 sub create
 {
     return old_create(@_) if($_[0]->isa('Vhffs::Services::Httpd'));
@@ -412,6 +434,17 @@
     return $objs;
 }
 
+=pod
+
+=head2 get_by_servername
+
+    my $httpd = Vhffs::Services::Httpd::get_by_servername($main, $servername);
+    die("Webarea $servername not found\n") unless(defined $httpd);
+
+Fetches the webarea whose address is $servername.
+
+=cut
+
 sub get_by_servername {
     my ($main, $servername) = @_;
     my $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?';
@@ -451,3 +484,11 @@
 
 
 1;
+
+__END__
+
+=head1 AUTHORS
+
+soda < dieu at gunnm dot org >
+
+Sebastien Le Ray < beuss at tuxfamily dot org >

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mail.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -35,6 +35,16 @@
 
 # Author : soda < dieu at gunnm dot org >
 
+=pod
+
+=head1 SYNOPSYS
+
+Vhffs::Services::Mail - Handle mail domains in VHFFS.
+
+=head2 METHODS
+
+=cut
+
 package Vhffs::Services::Mail;
 
 use base qw(Vhffs::Object);
@@ -106,6 +116,16 @@
     return 1;
 }
 
+=pod
+
+=head2 create
+
+    my $mail = Vhffs::Services::Mail::create($main, $domain, $description, $user, $group);
+
+Create a new domain mail in database and return corresponding object.
+
+=cut
+
 sub create {
     if($_[0]->isa('Vhffs::Services::Mail')) {
         my ($package, $file, $line) = caller();

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mailing.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -33,8 +33,20 @@
 # This file is a part of VHFFS4 software, a hosting platform suite
 # Please respect the licence of this file and whole program
 
-# Author : soda < god at gunnm dot org >
+=pod
 
+=head1 NAME
+
+Vhffs::Services::Mailing - Handle mailing lists in VHFFS.
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
 package Vhffs::Services::Mailing;
 
 use base qw(Vhffs::Object);
@@ -86,7 +98,16 @@
     return $this;
 }
 
+=pod
 
+=head2 create
+
+    my $ml = Vhffs::Services::Mailing::create($local, $domain, $admin, $description, $user, $group);
+    die('Unable to create list') unless defined $ml;
+
+Creates a new mailing list in database and returns the corresponding fully functional object.
+
+=cut
 sub create
 {
     if($_[0]->isa('Vhffs::Services::Mailing')) {
@@ -163,6 +184,17 @@
 }
 
 
+=pod
+
+=head2 get_by_mladdress
+
+    my $ml = Vhffs::Services::Mailing::get_by_mladdress($main, $local_part, $domain);
+    die("Mailing list $localpart\@$domain not found\n") unless(defined $ml);
+
+Fetches the mailing list $local_part@$domain.
+
+=cut
+
 sub get_by_mladdress {
     my ($main, $local, $domain) = @_;
     
@@ -643,3 +675,11 @@
 }
 
 1;
+
+__END__
+
+=head1 AUTHORS
+
+soda < god at gunnm dot org >
+
+Sebastien Le Ray < beuss at tuxfamily dot org >

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mysql.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mysql.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Mysql.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -33,9 +33,20 @@
 # This file is a part of VHFFS4 platofmrm
 # Please respect the licence
 
-# Author: soda < dieu at gunnm dot org>
+=pod
 
+=head1 NAME
 
+Vhffs::Services::Mysql - Handle MySQL databases on VHFFS plaform.
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
 package Vhffs::Services::Mysql;
 
 use base qw(Vhffs::Object);
@@ -101,6 +112,17 @@
 
 }
 
+=pod
+
+=head2 create
+
+    my $mysql = Vhffs::Services::Mysql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group);
+    die("Unable to create MySQL service $dbname\n") unless(defined $mysql);
+
+Creates a new MySQL service in VHFFS database and returns the fully functional object.
+
+=cut
+
 sub create {
     if($_[0]->isa('Vhffs::Services::Mysql')) {
         my ($package, $file, $line) = caller();
@@ -288,6 +310,17 @@
     return $self;
 }
 
+=pod
+
+=head2 get_by_dbname
+
+    my $mysql = Vhffs::Services::Mysql::get_by_dbname($main, $dbname);
+    die("MySQL service $dbname not found\n") unless(defined $mysql);
+
+Fetches the MySQL service $dbname.
+
+=cut
+
 sub get_by_dbname($$) {
     my ($vhffs, $dbname) = @_;
 
@@ -335,3 +368,10 @@
 
 
 1;
+__END__
+
+=head1 AUTHORS
+
+soda < dieu at gunnm dot org>
+
+Sebastien Le Ray < beuss at tuxfamily dot org >

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Postgres.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Postgres.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Postgres.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -31,11 +31,21 @@
 
 
 # This file is a part of VHFFS4 platofmrm
-# Please respect the licence
 
-# Author: soda < dieu at gunnm dot org>
+=pod
 
+=head1 NAME
 
+Vhffs::Services::Postgres - Handle PostgreSQL databases in VHFFS.
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
 package Vhffs::Services::Postgres;
 
 use base qw(Vhffs::Object);
@@ -78,15 +88,50 @@
 	return $this;
 }
 
+=pod
+
+=head2 check_dbname
+
+    die('Bad DB name') unless(Vhffs::Services::Postgres::check_dbname($dbname));
+
+Indicates wether a DB name is valid or not (3 to 32 alphanumeric chars, underscore
+allowed except at begining and end).
+
+=cut
+
 sub check_dbname($) {
     my $dbname = shift;
     return ( $dbname =~ /^[a-z0-9][a-z0-9\_]{1,30}[a-z0-9]$/ );
 }
 
+=pod
+
+=head2 check_dbuser
+
+    die('Bad DB username') unless(Vhffs::Services::Postgres::check_dbuser($user));
+
+Indicates wether a DB user name is valid or not (3 to 32 lowercase alphanumeric chars, underscore
+allowed except at begining and end).
+
+=cut
+
 sub check_dbuser($) {
     return check_dbname($_[0]);
 }
 
+
+=pod
+
+=head2 check_dbuser
+
+    die('Bad DB pass') unless(Vhffs::Services::Postgres::check_dbpass($pass));
+
+Indicates wether a DB password is valid or not (at least one alphanumeric
+char).
+
+=cut
+    
+
 sub check_dbpass($) {
     my $dbpass = shift;
     return ( $dbpass =~ /^[a-zA-Z0-9]+$/);
@@ -104,6 +149,17 @@
     return 1;
 }
 
+=pod
+
+=head2 create
+
+    my $psql = Vhffs::Services::Postgres::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group);
+    die("Unable to create Postgre Service\n") unless(defined $psql);
+
+Create a new Postgres services and return the corresponding fully functional object.
+
+=cut
+
 sub create {
     if($_[0]->isa('Vhffs::Services::Postgres')) {
         my ($package, $file, $line) = caller();
@@ -300,6 +356,17 @@
     return $self;
 }
 
+=pod
+
+=head2 get_by_dbname
+
+    my $pg = Vhffs::Services::Postgres::get_by_dbname($main, $dbname);
+    die("No database with this name") unless(defined $pg);
+
+Fetches the pg database whose name is C<$dbname>.
+
+=cut
+
 sub get_by_dbname($$) {
     my ($vhffs, $dbname) = @_;
 

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Repository.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Repository.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/Repository.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -32,8 +32,21 @@
 # This file is a part of VHFFS4 Hosting Platform
 # Please respect the licence of this file and the whole software
 
-# Author: Sylvain Rochet < gradator at gradator dot net >
 
+=pod
+
+=head1 NAME
+
+Vhffs::Services::Repository - Handle download repositories in VHFFS
+
+=head1 SYNOPSIS
+
+TODO
+
+=head1 METHODS
+
+=cut
+
 package Vhffs::Services::Repository;
 
 use base qw(Vhffs::Object);
@@ -95,6 +108,18 @@
 	return 1;
 }
 
+=pod
+
+=head2 create
+
+    my $repo = Vhffs::Services::Repository::create($main, $rname, $description, $user, $group);
+    die('Unable to create repository) unless(defined $repo);
+
+Creates a new download repository in database and return the corresponding
+fully functional object.
+
+=cut
+
 sub create 
 {
     if($_[0]->isa('Vhffs::Services::Repository')) {
@@ -202,6 +227,17 @@
 	return 1;
 }
 
+=pod
+
+=head2 get_by_reponame
+
+    my $repo = Vhffs::Services::Repository::get_by_reponame($main, $name);
+    die('Repository not found') unless(defined $repo);
+
+Fetches an existing repository.
+
+=cut
+
 sub get_by_reponame($$) {
     my ($main, $name) = @_;
 
@@ -378,3 +414,11 @@
 
 
 1;
+
+__END__
+
+=head1 AUTHORS
+
+Sylvain Rochet < gradator at gradator dot net >
+
+Sebastien Le Ray < beuss at tuxfamily dot net >

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm	2007-03-22 07:09:18 UTC (rev 522)
@@ -144,20 +144,21 @@
     return $self;
 }
 
+=pod
+
+=head2 exists
+
+    print "User $username already exists\n" if(Vhffs::User::exists($username));
+
+Indicates wether an username is already taken.
+
+=cut
+
 sub exists
 {
-    my $self;
-    my $request;
-    my $sth;
-    my $result;
+    my ($main, $username) = @_;
 
-    $self = shift;
-
-    $request = $self->{'db'}->prepare('SELECT COUNT(*) FROM vhffs_users WHERE username = ?' ) or return -1;
-    $request->execute($self->{'username'}) or return -2;
-
-    ($result) = $request->fetchrow_array;
-    return $result;
+    return ($main->get_db_object()->do('SELECT uid FROM vhffs_users WHERE username = ?', undef, $username) > 0);
 }
 
 
@@ -392,9 +393,9 @@
         $self->SUPER::commit();
 
         #Now, create the GID
-        $self->{'group'} = new Vhffs::Group( $self->{'main'} , $self->{'username'} , $self->{'uid'} );
-        $gid = $self->{'group'}->create;
-        die if ( $gid < 0 );
+
+        $self->{'group'} = Vhffs::Group::create( $self->{'main'} , $self->{'username'} , $self->{'uid'} );
+        die unless defined( $self->{group} );
 	    $self->{'group'}->set_status( Vhffs::Constants::ACTIVATED );
     	$self->{'group'}->commit;
         $self->{'gid'} = $gid;
@@ -983,6 +984,17 @@
     return $user;
 }
 
+=pod
+
+=head2 get_by_username
+
+    my $user = Vhffs::User::get_by_username($main, $username);
+    die('User not found') unless defined($user);
+
+Fetches an user using its username. Returned user is fully functional.
+
+=cut
+
 sub get_by_username {
     my ($main, $username) = @_;
     my $query = 'SELECT u.uid, u.gid, u.object_id, u.username, u.passwd, u.homedir, u.shell, u.admin, u.firstname, u.lastname, u.address, u.zipcode, u.city, u.country, u.mail, u.gpg_key, u.note, u.language, u.theme, o.date_creation, o.description, o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.username = ?';

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_dns.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_dns.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_dns.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,62 +12,25 @@
 use Vhffs::Object;
 use Vhffs::Services::DNS;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-my $group;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage $0 domain_name, description, user, group") unless(@ARGV == 4);
 
-if( $#ARGV != 0 )
-{
-         print "Error ! Exec this script as it : create_dns domain";
-         print "Example : create_dns prout.com";
-}
+my ($domain, $description, $username, $groupname) = @ARGV;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-$user = new Vhffs::User( $princ , "sod" , 401) ;
-$group = new Vhffs::Group( $princ , "prout" , 401) ;
+my $dns = Vhffs::Services::DNS::create( $princ , $domain, $description, $user , $group );
 
-
-my $dns = new Vhffs::Services::DNS( $princ , "$ARGV[0]" , $user , $group );
-
 if( defined $dns )
 {
-	print "object created\n";
+	print "Domain $domain successfully created\n";
 }
 else
 {
-	print "object error\n";
-	exit;
+	die("Unable to create object, check syntax and uniqueness\n");
 }
 
-my $retour;
-
-if( ( $retour = $dns->create ) > 0)
-{
-	print "Successfully create dns object in the database\n";
-}
-else
-{
-	print "ERROR while create dns object in the database $retour\n";
-}
-
-if ( $dns->fetch < 0 )
-{
-	print "error while fetching informations in the database";
-}
-else
-{
-	print "fetch reussi\n";
-$dns->commit;
-
-$dns->add_a("prou" , "900.10.10.3");
-$dns->add_mx("mx.".$ARGV[0]);
-}

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_group.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_group.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_group.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -10,60 +10,25 @@
 use Vhffs::Main;
 use Vhffs::Object;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 groupname owner_username description\n") unless(@ARGV == 3);
 
-if( $#ARGV != 0 )
-{
-	print "Error ! Create a new group with : create_group groupname";
-	print "Example : create_group soda";
-}
+my ($groupname, $username, $description) = @ARGV;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
 
-print "Creation du group $ARGV[0]\n";
-$user = new Vhffs::User( $princ , "sodalol" , 401) ;
+my $group = Vhffs::Group::create($princ, $groupname, $user->get_uid, undef, $description) ;
 
-if( $user->fetch <= 0 )
+if( !defined $group )
 {
-	print "Erreur, l'utilisateur pour creer le groupe n'existe pas !";
-
+    die "Unable to create group $groupname\n";
 }
-
-my $group = new Vhffs::Group( $princ , $ARGV[0] , $user->get_uid) ;
-#on fetche l'utilisateur
-my $retour;
-$retour = $group->fetch;
-if ( $retour > 0  )
-{
-	print "Ce groupe existe deja\n";
-	exit 0;
-}
-
-
-#on le cree dans la base
-my $gid = $group->create;
-if( $gid lt 0 )
-{
-	print "Impossible de creer ce groupe, code retour $gid \n";
-	exit 0;
-}
 else
 {
-	$user->commit;
-
-	print "Utilisateur cree avec comme gid $gid !\n";
+	print "Group $groupname created!\n";
 }
 
 $group->add_user( $user );
 
-
-exit;

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_list.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_list.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_list.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -13,45 +13,25 @@
 use Vhffs::Services::Mail;
 use Vhffs::Services::Mailing;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 local_part domain admin_email description owner_username owner_groupname\n") unless(@ARGV == 6);
 
+my ($local, $domain, $admin, $description, $username, $groupname) = @ARGV;
 
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-my $group = new Vhffs::Group( $princ , "prout" , 401) ;
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-my $mail = new Vhffs::Services::Mailing( $princ , "bla3" , "prout.com" , $user , $group);
+my $mail = Vhffs::Services::Mailing::create($princ, $local, $domain, $admin, $description, $user, $group);
 
 if( defined $mail )
 {
-	print "object created\n";
+	print "Mailing list $local\@$domain created\n";
 }
 else
 {
-	print "object error\n";
-	exit;
+	die("Unable to create mailing list $local\@$domain, please check syntax and uniqueness\n");
 }
 
-my $retour = $mail->create;
-
-if( $retour < 0 )
-{
-	print "ERROR while create mail object in the database, returns $retour \n";
-}
-else
-{
-	print "Successfully create mail object in the database : $retour \n";
-}
-
-
-use Data::Dumper;
-

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_mail.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_mail.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_mail.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,45 +12,25 @@
 use Vhffs::Object;
 use Vhffs::Services::Mail;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage $0 domain description owner_username owner_groupname") if(@ARGV != 4);
+my ($domain, $description, $username, $groupname) = @ARGV;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-my $group = new Vhffs::Group( $princ , "soda" , 401) ;
+my $mail = Vhffs::Services::Mail::create( $princ , $domain, $description, $user , $group);
 
-my $mail = new Vhffs::Services::Mail( $princ , $ARGV[0] , $user , $group);
-
 if( defined $mail )
 {
-	print "object created\n";
+	print "Mail domain $domain created\n";
 }
 else
 {
-	print "object error\n";
+	print "Error creating domain (check syntax and uniqueness)\n";
 	exit;
 }
 
-my $retour = $mail->create;
-
-if( $retour < 0 )
-{
-	print "ERROR while create mail object in the database, returns $retour \n";
-}
-else
-{
-	print "Successfully create mail object in the database : $retour \n";
-}
-
-
-use Data::Dumper;
-

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_mysql.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_mysql.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_mysql.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,64 +12,26 @@
 use Vhffs::Object;
 use Vhffs::Services::Mysql;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 dbname dbuser dbpass description owner_username owner_groupname\n") unless(@ARGV == 6);
 
-if( $#ARGV != 2 )
-{
-         print "Error ! Exec this script as it : create_mysql base user pass";
-         print "Example : create_mysql soda prout";
-}
+my ($dbname, $dbuser, $dbpass, $description, $username, $groupname) = @ARGV;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-my $group = new Vhffs::Group( $princ , "soda" , 401) ;
 
+my $sql = Vhffs::Services::Mysql::create($princ , $dbname, $dbuser, $dbpass, $description, $user, $group);
 
-my $sql = new Vhffs::Services::Mysql( $princ , "$ARGV[0]" , $user);
-
 if( defined $sql )
 {
-	print "object created\n";
+	print "Mysql service $dbname created\n";
 }
 else
 {
-	print "object error\n";
-	exit;
+	die("Unable to create MySQL service $dbname\n");
 }
 
-if( $sql->set_dbusername( $ARGV[1] ) < 0 )
-{
-	print "L'utilisateur Mysql desire est deja pris !";
-	exit 0;
-}
-$sql->set_dbpassword( $ARGV[2] );
-
-$sql->set_group( $group );
-
-if( $sql->create > 0)
-{
-	
-	print "Successfully create sql object in the database\n";
-}
-else
-{
-	print "ERROR while create sql object in the database\n";
-}
-
-if ( $sql->fetch < 0 )
-{
-	print "error while fetching informations in the database";
-}
-$sql->commit;
-
-

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_postgres.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_postgres.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_postgres.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,66 +12,27 @@
 use Vhffs::Object;
 use Vhffs::Services::Postgres;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
 
-if( $#ARGV != 2 )
-{
-         print "Error ! Exec this script as it : create_postgres base user pass";
-         print "Example : create_mysql soda prout";
-}
+die("Usage: $0 dbname dbuser dbpass description user group\n") unless(@ARGV == 6);
 
+my ($dbname, $dbuser, $dbpass, $description, $username, $groupname) = @ARGV;
 
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-my $group = new Vhffs::Group( $princ , "sodaproject" , 401) ;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-print "gros con" if ( $group->fetch < 0 );
+my $sql = Vhffs::Services::Postgres::create( $princ , $dbname, $dbuser, $dbpass, $description, $user, $group);
 
-my $sql = new Vhffs::Services::Postgres( $princ , "$ARGV[0]" , $user , $group);
-
 if( defined $sql )
 {
-	print "object created\n";
+	print "Postgres Service $dbname created\n";
 }
 else
 {
-	print "object error\n";
-	exit;
+    die("Unable to create $dbname, check syntax and uniqueness\n");
 }
 
-if( $sql->set_dbusername( $ARGV[1] ) < 0 )
-{
-	print "L'utilisateur Mysql desire est deja pris !";
-	exit 0;
-}
-$sql->set_dbpassword( $ARGV[2] );
-$sql->set_user( $user );
-$sql->set_group( $group );
-
-if( $sql->create > 0)
-{
-	
-	print "Successfully create sql object in the database\n";
-}
-else
-{
-	print "ERROR while create sql object in the database\n";
-}
-
-if ( $sql->fetch < 0 )
-{
-	print "error while fetching informations in the database";
-}
-$sql->commit;
-
-

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_repository.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_repository.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_repository.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,59 +12,26 @@
 use Vhffs::Object;
 use Vhffs::Services::Repository;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-my $group;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 reponame description username groupname\n") unless(@ARGV == 4);
 
-if( $#ARGV != 0 )
-{
-         print "Error ! Exec this script as it : create_repository name\nExample : create_repository mypr0n\n";
-	 exit( 0 );
-}
+my ($reponame, $description, $username, $groupname) = @ARGV;
 
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-$user = new Vhffs::User( $princ , "gradator" , 401) ;
-$group = new Vhffs::Group( $princ , "gradator" , 401) ;
+my $repo = Vhffs::Services::Repository::create($princ, $reponame, $description, $user, $group );
 
-
-my $repo = new Vhffs::Services::Repository( $princ , "$ARGV[0]" , $user , $group );
-
 if( defined $repo )
 {
-	print "object created\n";
+	print "Repository $reponame created\n";
 }
 else
 {
-	print "object error\n";
+	print "Unable to create $reponame, check syntax and uniqueness\n";
 	exit;
 }
 
-if( $repo->create > 0)
-{
-	print "Successfully created repository object in the database\n";
-}
-else
-{
-	print "ERROR while creating repository object in the database\n";
-	exit( 0 );
-}
-
-print "plop\n";
-
-if ( $repo->fetch < 0 )
-{
-	print "Error while fetching informations in the database";
-}
-
-$repo->commit;
-
-print Dumper $repo;

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_user.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_user.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_user.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -10,66 +10,23 @@
 use Vhffs::Main;
 use Vhffs::Object;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 username password\n") unless(@ARGV == 2);
 
-if( $#ARGV != 0 )
-{
-	print "Error ! Create a new user with : create_user username";
-	print "Example : create_user soda";
-}
+my ($username, $password) = @ARGV;
 
+die("User $username already exists\n") if(Vhffs::User::exists($princ, $username));
 
-print "Creation du user $ARGV[0]\n";
-$user = new Vhffs::User( $princ , "$ARGV[0]" , 401) ;
+my $user = Vhffs::User::create($princ, $username, $password);
 
-
-#on fetche l'utilisateur
-my $retour;
-$retour = $user->fetch;
-if ( $retour > 0  )
+if( !defined $user )
 {
-	print "Cet utilisateur existe deja\n";
-	exit 0;
+	die "Unable to create user $username\n";
 }
-
-
-#on le cree dans la base
-my $uid = $user->create;
-if( $uid lt 0 )
-{
-	print "Impossible de creer cet utilisateur, code retour $uid \n";
-	exit 0;
-}
 else
 {
-	$user->set_password("default");
-
-	$user->commit;
-
-	print "Utilisateur cree avec comme uid $uid !\n";
+	print "User $username created!\n";
 }
 
-$user->set_shell("/usr/bin/lol");
-$user->set_firstname("Julien");
-$user->set_lastname("Delange");
-$user->set_city("Le Neubourg");
-$user->set_zipcode("27110");
-$user->set_country("France");
-$user->set_address("10 Rue des chiens");
-$user->set_gpgkey("gpg_key");
-
-$user->commit;
-
-$user->fetch;
-
 exit;

Modified: branches/vhffs_4.1/vhffs-api/src/examples/create_web.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/create_web.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/create_web.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -12,45 +12,24 @@
 use Vhffs::Object;
 use Vhffs::Services::Httpd;
 
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
 my $princ = init Vhffs::Main;
 
-$config = $princ->get_config;
+die("Usage: $0 servername description owner_username owner_groupname\n") unless(@ARGV == 4);
 
+my($servername, $description, $username, $groupname) = @_;
 
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-my $group = new Vhffs::Group( $princ , "soda" , 401) ;
+my $user = Vhffs::User::get_by_username($princ, $username);
+die("User not found\n") unless(defined $user);
+my $group = Vhffs::Group::get_by_groupname($princ, $groupname);
+die("Group not found\n") unless(defined $group);
 
-my $httpd = new Vhffs::Services::Httpd( $princ , $ARGV[0] , $user , $group);
+my $httpd = Vhffs::Services::Httpd::create($princ, $servername, $description, $user, $group);
 
 if( defined $httpd )
 {
-	print "object created\n";
+	print "Webarea $servername created\n";
 }
 else
 {
-	print "object error\n";
-	exit;
+	die "Unable to create webarea $servername\n";
 }
-
-my $retour = $httpd->create;
-
-if( $retour < 0 )
-{
-	print "Successfully create httpd object in the database\n";
-}
-else
-{
-	print "ERROR while create httpd object in the database, returns $retour \n";
-}
-
-
-use Data::Dumper;
-

Deleted: branches/vhffs_4.1/vhffs-api/src/examples/test.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/test.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/test.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -1,61 +0,0 @@
-#!/usr/bin/perl -w -I. /vhffs/vhffs-api/src/
-
-
-use strict;
-
-use Data::Dumper;
-use lib "/usr/share/vhffs/api/";
-use Vhffs::Conf;
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-
-
-
-my $princ = init Vhffs::Main;
-
-$dbh = $princ->get_db_object;
-$config = $princ->get_config;
-
-
-$user = new Vhffs::User( $dbh , "prout" ) ;
-
-#on fetche l'utilisateur
-if ( $user->get < 0  )
-{
-	print "ce user n'existe pas\n";
-}
-else
-{
-	print "ce user existe\n";
-	$user->delete;
-	print "user supprime\n";
-}
-
-#on le cree dans la base
-if( $user->create( $princ->get_config ) < 0 )
-{
-	print "impossible de creer ce user\n";
-}
-else
-{
-	print "user cree !\n";
-}
-
-
-#on le supprimer
-#if( $user->delete < 0 )
-#{
-#    print "probleme lors de la suppression";
-#}
-#else
-#{
-#   print "utilisateur supprime";
-#}

Deleted: branches/vhffs_4.1/vhffs-api/src/examples/test_dns.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/test_dns.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/test_dns.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -1,60 +0,0 @@
-#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/
-
-
-use strict;
-
-use Data::Dumper;
-use lib "/usr/share/vhffs/api/";
-use Vhffs::Conf;
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Object;
-use Vhffs::Services::DNS;
-
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-my $group;
-
-my $princ = init Vhffs::Main;
-
-$config = $princ->get_config;
-
-
-$user = new Vhffs::User( $princ , "sodalol" , 401) ;
-$group = new Vhffs::Group( $princ , "sodalol" , 401) ;
-
-
-my $dns = new Vhffs::Services::DNS( $princ , "proutlol4.com" , $user , $group );
-
-if( defined $dns )
-{
-	print "object created\n";
-}
-else
-{
-	print "object error\n";
-	exit;
-}
-
-if( $dns->create > 0)
-{
-	print "Successfully create dns object in the database\n";
-}
-else
-{
-	print "ERROR while create dns object in the database\n";
-}
-
-$dns->commit;
-
-$dns->add_a("prou" , "900.10.10.3");
-
-use Data::Dumper;
-
-print Dumper $dns;

Deleted: branches/vhffs_4.1/vhffs-api/src/examples/test_httpd.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/test_httpd.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/test_httpd.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -1,55 +0,0 @@
-#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/
-
-
-use strict;
-
-use Data::Dumper;
-use lib "/usr/share/vhffs/api/";
-use Vhffs::Conf;
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Object;
-use Vhffs::Services::Httpd;
-
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
-my $princ = init Vhffs::Main;
-
-$config = $princ->get_config;
-
-
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-
-my $httpd = new Vhffs::Services::Httpd( $princ , "proutlol2.com" , $user );
-
-if( defined $httpd )
-{
-	print "object created\n";
-}
-else
-{
-	print "object error\n";
-	exit;
-}
-
-if( $httpd->create > 0)
-{
-	print "Successfully create httpd object in the database\n";
-}
-else
-{
-	print "ERROR while create httpd object in the database\n";
-}
-
-$httpd->fetch;
-
-use Data::Dumper;
-
-print Dumper $httpd;

Deleted: branches/vhffs_4.1/vhffs-api/src/examples/test_obj.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/test_obj.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/test_obj.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -1,40 +0,0 @@
-#!/usr/bin/perl
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::Object;
-use Vhffs::Conf;
-use Vhffs::Main;
-use Vhffs::User;
-
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-
-my $princ = init Vhffs::Main;
-
-$dbh = $princ->get_db_object;
-$config = $princ->get_config;
-
-
-my $test = new Vhffs::Object( $dbh , 30 , 10);
-
-$user = new Vhffs::User($dbh,"soda2");
-$user->get;
-
-
-
-print "object error" if ( ! defined $test );
-my $r = $test->create;
-if ( $r < 0)
-{
-	print "erreur : $r";
-}
-else
-{
-	print "ok ...";
-}
-
-$test->get;

Deleted: branches/vhffs_4.1/vhffs-api/src/examples/test_user.pl
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/examples/test_user.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-api/src/examples/test_user.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -1,86 +0,0 @@
-#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/
-
-
-use strict;
-
-use Data::Dumper;
-use lib "/usr/share/vhffs/api/";
-use Vhffs::Conf;
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Object;
-
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-
-my $princ = init Vhffs::Main;
-
-$config = $princ->get_config;
-
-
-print "new du user\n";
-$user = new Vhffs::User( $princ , "soda" , 401) ;
-
-
-#on fetche l'utilisateur
-my $retour;
-print "fetch du user\n";
-$retour = $user->fetch;
-if ( $retour< 0  )
-{
-	print "ce user n'existe pas : $retour \n";
-	$user->create;
-}
-else
-{
-	print "ce user existe\n";
-	print "username : " . $user->get_username . "\n" ;
-	$user->delete;
-}
-
-exit;
-
-
-print "creation du user\n";
-
-#on le cree dans la base
-$user = new Vhffs::User( $princ , "proutlolzizi2" , 401) ;
-my $uid = $user->create;
-if( $uid < 0 )
-{
-	print "impossible de creer ce user : $uid \n";
-}
-else
-{
-	$user->set_password("lol");
-
-	$user->commit;
-
-	print "user cree avec uid $uid !\n";
-}
-
-$user->set_shell("/usr/bin/lol");
-
-$user->commit;
-
-$user->fetch;
-
-exit;
-
-#
-#on le supprimer
-$retour = $user->delete;
-if( $retour < 0 )
-{
-    print "probleme lors de la suppression : $retour \n";
-}
-else
-{
-   print "utilisateur supprime\n";
-}

Modified: branches/vhffs_4.1/vhffs-tests/src/User.pl
===================================================================
--- branches/vhffs_4.1/vhffs-tests/src/User.pl	2007-03-21 08:45:01 UTC (rev 521)
+++ branches/vhffs_4.1/vhffs-tests/src/User.pl	2007-03-22 07:09:18 UTC (rev 522)
@@ -15,7 +15,7 @@
 cmp_ok($user1->get_mail, 'eq', 'test1@xxxxxxxx', 'Email matches');
 
 my $uid1 = $user1->get_uid;
-ok($user1->exists, 'First user exists');
+ok(Vhffs::User::exists($main, $user1->get_username), 'First user exists');
 ok(Vhffs::User::uid_exists($main->get_db_object, $uid1), 'First user UID exists');
 
 my $user2 = Vhffs::User::create($main, 'test2', 'abcdef', 0, 'test2@xxxxxxxx');


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