[vhffs-dev] [2003] reworked ACLs

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


Revision: 2003
Author:   gradator
Date:     2012-02-11 18:25:16 +0100 (Sat, 11 Feb 2012)
Log Message:
-----------
reworked ACLs

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Acl.pm
    trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
    trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
    trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
    trunk/vhffs-api/src/Vhffs/Panel/Git.pm
    trunk/vhffs-api/src/Vhffs/Panel/Group.pm
    trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
    trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
    trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
    trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
    trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
    trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
    trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
    trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
    trunk/vhffs-api/src/Vhffs/Panel/Web.pm
    trunk/vhffs-api/src/examples/add_acl.pl
    trunk/vhffs-api/src/examples/add_acl_dns.pl
    trunk/vhffs-api/src/examples/modify_acl.pl
    trunk/vhffs-tools/src/vhffs-useradd

Modified: trunk/vhffs-api/src/Vhffs/Acl.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Acl.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Acl.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -50,100 +50,112 @@
 
 =cut
 
-sub get_perm
-{
+=pod
+
+=head2 get_perm
+
+	my $perm = Vhffs::Acl::get_perm( $vhffs, $object, $user );
+
+Returns the permission of C<$user> for C<$object>.
+
+=cut
+sub get_perm {
 	my $vhffs = shift;
 	my $object = shift;
 	my $user = shift;
-
-	return Vhffs::Constants::ACL_DENIED unless( defined $vhffs && defined $object && defined $user );
+	return Vhffs::Constants::ACL_DENIED unless defined $vhffs and defined $object and defined $user;
 	return Vhffs::Constants::ACL_DELETE if $user->is_admin;
 
-	my $ooid = $object->get_oid;
-	my $uoid = $user->get_oid;
-	my $goid = $object->get_group->get_oid;
+	my $perm;
+	$perm = $vhffs->{'db'}->selectrow_array('SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=?', undef, $user->get_oid, $object->get_oid);
 
-	my $perm;
-	$perm = $vhffs->{'db'}->selectrow_array('SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=?', undef, $uoid, $ooid);
-	$perm = $vhffs->{'db'}->selectrow_array('SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=? AND EXISTS ( SELECT * FROM vhffs_user_group ug INNER JOIN vhffs_users u ON ug.uid=u.uid INNER JOIN vhffs_groups g ON ug.gid=g.gid AND u.object_id=? AND g.object_id=? )', undef, $goid, $ooid, $uoid, $goid ) unless defined $perm;
+	# Fetch default ACL (on group) if user specific ACL is not defined
+	$perm = $vhffs->{'db'}->selectrow_array('SELECT perm FROM vhffs_acl WHERE granted_oid=? AND target_oid=? AND EXISTS ( SELECT * FROM vhffs_user_group ug INNER JOIN vhffs_users u ON ug.uid=u.uid INNER JOIN vhffs_groups g ON ug.gid=g.gid AND u.object_id=? AND g.object_id=? )', undef, $object->get_group->get_oid, $object->get_oid, $user->get_oid, $object->get_group->get_oid ) unless defined $perm;
+
 	$perm = Vhffs::Constants::ACL_DENIED unless defined $perm;
-	$perm = Vhffs::Constants::ACL_VIEW if( $perm < Vhffs::Constants::ACL_VIEW && $user->is_moderator );
+	$perm = Vhffs::Constants::ACL_VIEW if $user->is_moderator and (not defined $perm or $perm < Vhffs::Constants::ACL_VIEW);
 
 	return $perm;	
 }
 
-
 =pod
 
 =head2 add_acl
 
-    die("Unable to add ACL\n") if( Vhffs::Acl::add_acl($granted_oid, $svc, $perm, $vhffs) );
+    die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_object, $target_object, $perm) < 0;
 
-Grant permission C<$perm> to user or group C<$granted_oid> on service C<$svc>.
+Grant permission C<$perm> to user or group C<$granted_object> on service C<$target_object>.
 
 Should be modified soon to use OIDs instead of heavy objects.
 
-An ACL where granted_oid is a group object is the default access for users of the group.
+An ACL where granted_object is a group object is the default access for users of the group.
 
 =cut
+sub add_acl {
+	my ( $vhffs, $granted_object , $target_object , $perm ) = @_;
+	return -1 unless defined $vhffs and defined $granted_object and defined $target_object and defined $perm;
+	return -2 unless( $granted_object->get_type == Vhffs::Constants::TYPE_USER || $granted_object->get_type == Vhffs::Constants::TYPE_GROUP );
 
-sub add_acl
-{
-	my ( $granted_oid , $target_oid , $perm , $vhffs ) = @_;
-
-	return -1 unless(defined $granted_oid && defined $target_oid );
-	return -2 unless( $granted_oid->get_type == Vhffs::Constants::TYPE_USER || $granted_oid->get_type == Vhffs::Constants::TYPE_GROUP );
 	my $sql = 'INSERT INTO vhffs_acl(granted_oid, perm, target_oid) VALUES(?, ?, ?)';
 	my $dbh = $vhffs->get_db_object;
-	return -3 unless( $dbh->do($sql, undef, $granted_oid->get_oid, $perm, $target_oid->get_oid) );
+	return -3 unless( $dbh->do($sql, undef, $granted_object->get_oid, $perm, $target_object->get_oid) );
 	return 1;
 }
 
+=pod
 
-sub add_acl_oid
-{
+=head2 add_acl_oid
+
+    die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_oid, $target_oid, $perm) < 0;
+
+Grant permission $perm to user or group OID $granted_oid on service OID $target_oid.
+
+An ACL where granted_oid is a group object OID is the default access for users of the group.
+
+=cut
+sub add_acl_oid {
 	my ( $vhffs, $target_oid , $granted_oid , $perm ) = @_;
-	return -1 unless(defined $vhffs && defined $target_oid && defined $granted_oid && defined $perm );
+	return -1 unless defined $vhffs and defined $target_oid and defined $granted_oid and defined $perm;
+
 	return -3 unless $vhffs->get_db_object->do( 'INSERT INTO vhffs_acl(granted_oid, perm, target_oid) VALUES(?, ?, ?)' , undef, $granted_oid, $perm, $target_oid);
 	return 1;
 }
 
+=pod
 
-sub update_acl
-{
-	my ($vhffs, $target_oid, $granted_oid, $perm) = @_;
+=head2 update_acl
 
-	return -1 unless(defined $vhffs && defined $target_oid && defined $granted_oid && defined $perm);
+    my $ret = Vhffs::Acl::update_acl($vhffs, $target_oid , $granted_oid, $perm);
 
+Update the ACL between $target_oid and $granted_oid.
+
+Returns >0 if success, <0 otherwise;
+
+=cut
+sub update_acl {
+	my ( $vhffs, $target_oid, $granted_oid, $perm ) = @_;
+	return -1 unless defined $vhffs and defined $target_oid and defined $granted_oid and defined $perm;
+
 	# If no line was updated, ACL doesn't exists => error
-	return -2 unless( $vhffs->get_db_object->do( 'UPDATE vhffs_acl SET perm = ? WHERE target_oid=? AND granted_oid=?', undef, $perm, $target_oid, $granted_oid) > 0 );
+	return -2 unless $vhffs->get_db_object->do( 'UPDATE vhffs_acl SET perm = ? WHERE target_oid=? AND granted_oid=?', undef, $perm, $target_oid, $granted_oid) > 0;
 	return 1;
 }
 
+=pod
 
-# return 1 if acl has been added, 2 if acl has been updated, 3 if acl has been deleted, -1 is something went wrong
-sub add_update_or_del_acl
-{
-	my ($vhffs, $target_oid, $granted_oid, $perm) = @_;
-	return -1 unless(defined $vhffs && defined $target_oid && defined $granted_oid && defined $perm);
+=head2 del_acl
 
-	if( $perm == Vhffs::Constants::ACL_UNDEFINED )  {
-		return 3 if( del_acl( $vhffs, $target_oid, $granted_oid ) > 0 );
-		return -1;
-	}
+    my $ret = Vhffs::Acl::del_acl($vhffs, $target_oid , $granted_oid);
 
-	return 2 if( update_acl( $vhffs, $target_oid, $granted_oid, $perm ) > 0 );
-	return 1 if( add_acl_oid( $vhffs, $target_oid, $granted_oid, $perm ) > 0 );
-	return -1;
-}
+Delete the ACL between $target_oid and $granted_oid.
 
+Returns >0 if success, <0 otherwise;
 
-sub del_acl
-{
+=cut
+sub del_acl {
 	my ( $vhffs, $target_oid , $granted_oid ) = @_;
+	return -1 unless defined $vhffs and defined $target_oid and defined $granted_oid;
 
-	return -1 unless(defined $vhffs && defined $target_oid && defined $granted_oid);
-
 	my $dbh = $vhffs->get_db_object();
 
 	$dbh->begin_work();
@@ -166,12 +178,37 @@
 	return 1;
 }
 
+=pod
 
+=head2 add_update_or_del_acl
+
+    my $ret = Vhffs::Acl::add_update_or_del_acl($vhffs, $target_oid , $granted_oid, $perm);
+
+This is the magic function. It deletes the ACL entry if $perm equals Vhffs::Constants::ACL_UNDEFINED or 
+creates the ACL entry if necessary or update the ACL entry if the ACL entry already exists.
+
+Returns 1 if acl has been added, 2 if acl has been updated, 3 if acl has been deleted, -1 is something went wrong.
+
+=cut
+sub add_update_or_del_acl {
+	my ($vhffs, $target_oid, $granted_oid, $perm) = @_;
+	return -1 unless defined $vhffs and defined $target_oid and defined $granted_oid and defined $perm;
+
+	if( $perm == Vhffs::Constants::ACL_UNDEFINED )  {
+		return 3 if del_acl( $vhffs, $target_oid, $granted_oid ) > 0;
+		return -1;
+	}
+
+	return 2 if update_acl( $vhffs, $target_oid, $granted_oid, $perm ) > 0;
+	return 1 if add_acl_oid( $vhffs, $target_oid, $granted_oid, $perm ) > 0;
+	return -1;
+}
+
 =pod
 
 =head2 get_object_acl
 
-    my $rights = Vhffs::Acl::get_object_acl($object, $vhffs);
+    my $rights = Vhffs::Acl::get_object_acl($vhffs, $object);
 
 Returns an array of hashref with keys 'granted_oid, name, perm'.
 A NULL perm is a non existing ACL.
@@ -187,16 +224,13 @@
 (4 rows)
 
 =cut
-
-sub get_object_acl
-{
+sub get_object_acl {
 	my ( $vhffs , $object ) = @_;
-	return undef unless( defined $vhffs && defined $object );
+	return undef unless defined $vhffs and defined $object;
 
 	my $sth = $vhffs->get_db_object->prepare( 'SELECT u.object_id AS granted_oid, u.username AS name, aclu.perm FROM vhffs_users u INNER JOIN vhffs_user_group ug ON ug.uid=u.uid INNER JOIN vhffs_object o ON o.owner_gid=ug.gid LEFT OUTER JOIN (SELECT acl.granted_oid, acl.perm FROM vhffs_acl acl WHERE acl.target_oid=?) AS aclu ON aclu.granted_oid=u.object_id WHERE o.object_id=? UNION SELECT g.object_id, NULL, aclg.perm FROM vhffs_groups g INNER JOIN vhffs_object o ON g.gid=o.owner_gid INNER JOIN vhffs_acl aclg ON aclg.granted_oid=g.object_id WHERE aclg.target_oid=? ORDER BY name ASC' );
 	return undef unless $sth->execute( $object->get_oid, $object->get_oid, $object->get_oid );
 	return $sth->fetchall_arrayref({});
 }
 
-
 1;

Modified: trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -111,8 +111,8 @@
 	my $bazaar = Vhffs::Services::Bazaar::create( $main, $repo, $description, $user, $group );
 	return -1 unless defined $bazaar;
     
-	return -3 if Vhffs::Acl::add_acl( $user , $bazaar , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return -3 if Vhffs::Acl::add_acl( $group , $bazaar , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $user, $bazaar, Vhffs::Constants::ACL_DELETE ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $group, $bazaar, Vhffs::Constants::ACL_VIEW ) < 0;
     	return $bazaar;
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cron.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cron.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -96,8 +96,8 @@
 	my $cron = Vhffs::Services::Cron::create( $main , $cronpath , $interval , $reportmail , $description, $user , $group );
 	return undef unless defined $cron;
 
-	return undef if Vhffs::Acl::add_acl( $user , $cron , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $cron , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $cron, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $cron, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $cron;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -71,8 +71,8 @@
 	my $cvs = Vhffs::Services::Cvs::create($main, $cvsroot, $description, $user, $group);
 	return undef unless defined $cvs;
 
-	return undef if Vhffs::Acl::add_acl( $user , $cvs , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $cvs , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $cvs, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $cvs, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $cvs;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/DNS.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/DNS.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -70,8 +70,8 @@
 	my $dns = Vhffs::Services::DNS::create( $main , $dns_name, $description, $user , $group );
 	return undef unless defined $dns;
 
-	return undef if Vhffs::Acl::add_acl( $user , $dns , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $dns , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $dns, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $dns, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $dns;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -115,8 +115,8 @@
 	my $git = Vhffs::Services::Git::create( $main, $repo, $description, $user, $group );
 	return -1 unless defined $git;
     
-	return -3 if Vhffs::Acl::add_acl( $user , $git , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return -3 if Vhffs::Acl::add_acl( $group , $git , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $user, $git, Vhffs::Constants::ACL_DELETE ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $group, $git, Vhffs::Constants::ACL_VIEW ) < 0;
     
 	return $git;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Group.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -208,8 +208,8 @@
 
 	return undef if ($group->add_user( $user->get_uid ) < 0 );
 
-	return undef if ( Vhffs::Acl::add_acl( $user , $group , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); 
-	return undef if ( Vhffs::Acl::add_acl( $group , $group , Vhffs::Constants::ACL_VIEW , $main ) < 0 );
+	return undef if ( Vhffs::Acl::add_acl( $main, $user, $group, Vhffs::Constants::ACL_DELETE ) < 0 ); 
+	return undef if ( Vhffs::Acl::add_acl( $main, $group, $group, Vhffs::Constants::ACL_VIEW ) < 0 );
 
 	return $group;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mail.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mail.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -119,8 +119,8 @@
 	my $mail = Vhffs::Services::Mail::create($main, $domain, $description, $user, $group);
 	return undef unless defined $mail;
 
-	return undef if Vhffs::Acl::add_acl( $user , $mail , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $mail , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $mail, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $mail, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $mail;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -127,8 +127,8 @@
 	my $list = Vhffs::Services::MailingList::create( $main , $lpart , $domain, $description, $user, $group );
 	return undef unless defined $list;
     
-	return undef if Vhffs::Acl::add_acl( $user , $list , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $list , Vhffs::Constants::ACL_VIEW , $main ) < 0; 
+	return undef if Vhffs::Acl::add_acl( $main, $user, $list, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $list, Vhffs::Constants::ACL_VIEW ) < 0; 
     
 	return $list;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mercurial.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -115,8 +115,8 @@
 	my $mercurial = Vhffs::Services::Mercurial::create( $main, $repo, $description, $user, $group );    
 	return -1 unless defined $mercurial;
 
-	return -3 if Vhffs::Acl::add_acl( $user , $mercurial , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return -3 if Vhffs::Acl::add_acl( $group , $mercurial , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $user, $mercurial, Vhffs::Constants::ACL_DELETE ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $group, $mercurial, Vhffs::Constants::ACL_VIEW ) < 0;
     
 	return $mercurial;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -80,8 +80,8 @@
 	my $mysql = Vhffs::Services::Mysql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group);
 	return undef unless defined $mysql;
 
-	return undef if Vhffs::Acl::add_acl( $user , $mysql , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $mysql , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $mysql, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $mysql, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $mysql;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -101,8 +101,8 @@
 	my $pgsql = Vhffs::Services::Pgsql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group);
 	return undef unless defined $pgsql;
 	
-	return undef if Vhffs::Acl::add_acl( $user , $pgsql , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $pgsql , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $pgsql, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $pgsql, Vhffs::Constants::ACL_VIEW ) < 0;
 	return $pgsql;
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Panel/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Repository.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Repository.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -100,8 +100,8 @@
 	my $repo = Vhffs::Services::Repository::create( $main , $name , $description, $user , $group );
 	return undef unless defined $repo;
 
-	return undef if Vhffs::Acl::add_acl( $user , $repo , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return undef if Vhffs::Acl::add_acl( $group , $repo , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $user, $repo, Vhffs::Constants::ACL_DELETE ) < 0;
+	return undef if Vhffs::Acl::add_acl( $main, $group, $repo, Vhffs::Constants::ACL_VIEW ) < 0;
 
 	return $repo;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Subscribe.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -121,7 +121,7 @@
 					$panel->add_error( gettext('Cannot apply changes to the user') );
 				}
 				else {
-					Vhffs::Acl::add_acl( $user , $user , Vhffs::Constants::ACL_DELETE , $vhffs );
+					Vhffs::Acl::add_acl( $vhffs, $user, $user, Vhffs::Constants::ACL_DELETE );
 	
 					# Newsletter
 					if( $vhffs->get_config->get_service_availability('newsletter') ) {

Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -115,8 +115,8 @@
 	my $svn = Vhffs::Services::Svn::create( $main, $repo, $description, $user, $group );
 	return -1 unless defined $svn;
     
-	return -3 if Vhffs::Acl::add_acl( $user , $svn , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-	return -3 if Vhffs::Acl::add_acl( $group , $svn , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $user, $svn, Vhffs::Constants::ACL_DELETE ) < 0;
+	return -3 if Vhffs::Acl::add_acl( $main, $group, $svn, Vhffs::Constants::ACL_VIEW ) < 0;
     
 	return $svn;
 }

Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Web.pm	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm	2012-02-11 17:25:16 UTC (rev 2003)
@@ -144,8 +144,8 @@
         my $web = Vhffs::Services::Web::create($main, $servername, $description, $user, $group);
 	return undef unless defined $web;
 
-        return undef if Vhffs::Acl::add_acl( $user , $web , Vhffs::Constants::ACL_DELETE , $main ) < 0;
-        return undef if Vhffs::Acl::add_acl( $group , $web , Vhffs::Constants::ACL_VIEW , $main ) < 0;
+        return undef if Vhffs::Acl::add_acl( $main, $user, $web, Vhffs::Constants::ACL_DELETE ) < 0;
+        return undef if Vhffs::Acl::add_acl( $main, $group, $web, Vhffs::Constants::ACL_VIEW ) < 0;
 
         return $web;
 }

Modified: trunk/vhffs-api/src/examples/add_acl.pl
===================================================================
--- trunk/vhffs-api/src/examples/add_acl.pl	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/examples/add_acl.pl	2012-02-11 17:25:16 UTC (rev 2003)
@@ -21,5 +21,5 @@
 my $httpd = Vhffs::Services::Web::get_by_servername($princ, $servername);
 die("Webarea $servername not found\n") unless(defined $httpd);
 
-Vhffs::Acl::add_acl( $user, $httpd, $level, $princ );
+Vhffs::Acl::add_acl( $princ, $user, $httpd, $level );
 

Modified: trunk/vhffs-api/src/examples/add_acl_dns.pl
===================================================================
--- trunk/vhffs-api/src/examples/add_acl_dns.pl	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/examples/add_acl_dns.pl	2012-02-11 17:25:16 UTC (rev 2003)
@@ -22,6 +22,6 @@
 my $user = Vhffs::User::get_by_username($princ, $username);
 die("User $username not found\n") unless(defined $user);
 
-Vhffs::Acl::add_acl($user, $dns, $level, $princ);
+Vhffs::Acl::add_acl($princ, $user, $dns, $level);
 
 print "User $username has now access level $level domain $domain\n";

Modified: trunk/vhffs-api/src/examples/modify_acl.pl
===================================================================
--- trunk/vhffs-api/src/examples/modify_acl.pl	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-api/src/examples/modify_acl.pl	2012-02-11 17:25:16 UTC (rev 2003)
@@ -21,5 +21,5 @@
 my $httpd = Vhffs::Services::Web::get_by_servername($princ, $servername);
 die("Webarea $servername not found\n") unless(defined $httpd);
 
-Vhffs::Acl::add_acl($user, $httpd , $level, $princ);
+Vhffs::Acl::add_acl($princ, $user, $httpd, $level);
 

Modified: trunk/vhffs-tools/src/vhffs-useradd
===================================================================
--- trunk/vhffs-tools/src/vhffs-useradd	2012-02-09 23:28:41 UTC (rev 2002)
+++ trunk/vhffs-tools/src/vhffs-useradd	2012-02-11 17:25:16 UTC (rev 2003)
@@ -57,8 +57,8 @@
 
 if(defined $user) {
 	print "User successfully created, setting default ACL\n";
-        Vhffs::Acl::add_acl( $user , $user , Vhffs::Constants::ACL_DELETE , $vhffs );
-        Vhffs::Acl::add_acl( $user->get_group , $user , Vhffs::Constants::ACL_DENIED , $vhffs );
+        Vhffs::Acl::add_acl( $vhffs, $user, $user, Vhffs::Constants::ACL_DELETE );
+        Vhffs::Acl::add_acl( $vhffs, $user->get_group, $user, Vhffs::Constants::ACL_DENIED );
 } else {
 	print "Unable to create user (duplicate ?)\n";
 }


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