[vhffs-dev] [1990] removed unused and stupid Vhffs::Groups::is_user_in_group(), Vhffs:: Groups::modify(), Vhffs::Groups::get_owner(), Vhffs::Groups::getall_by_user ()

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


Revision: 1990
Author:   gradator
Date:     2012-02-02 22:45:55 +0100 (Thu, 02 Feb 2012)
Log Message:
-----------
removed unused and stupid Vhffs::Groups::is_user_in_group(), Vhffs::Groups::modify(), Vhffs::Groups::get_owner(), Vhffs::Groups::getall_by_user()

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Group.pm

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm	2012-02-02 20:48:38 UTC (rev 1989)
+++ trunk/vhffs-api/src/Vhffs/Group.pm	2012-02-02 21:45:55 UTC (rev 1990)
@@ -189,21 +189,6 @@
 }
 
 
-sub is_user_in_group
-{
-	my $self = shift;
-	my $user = shift;
-
-	my $query ='SELECT COUNT(*) FROM vhffs_user_group WHERE gid=? AND uid=?';
-	my $request = $self->{'db'}->prepare( $query );
-	$request->execute( $self->get_gid, $user->get_uid );
-	my ( $rows ) = $request->fetchrow();
-
-	return 1 if( $rows == 1 );
-	return 0;
-}
-
-
 #Delete a group in the database
 sub delete
 {
@@ -231,24 +216,6 @@
 }
 
 
-
-#modify a group
-#use it as modify_user, but with the fields of the vhffs_groups table
-sub modify
-{
-    my $request;
-    
-    my ( $self , $field , $value ) = @_;
-    
-    $self->{$field} = $value;
-
-    # We don't need a special case for groupname, uniqueness is ensured by DB (we return -1 if groupname already exists)
-	$request = $self->{'db'}->prepare("UPDATE vhffs_groups SET $field=? WHERE gid=?");
-    $request->execute( $value, $self->{'gid'} ) or return -1;
-    
-    return 1;
-}
-
 =head2 add_user
 
     $group->add_user($uid);
@@ -358,53 +325,6 @@
     return \@users;
 }
 
-sub get_owner
-{
-	my $self = shift;
-
-	if( ! defined $self->{'user'} )
-	{
-		$self->{'user'} = Vhffs::User::get_by_uid( $self->{'main'}, $self->{'owner_uid'} );
-	}
-
-	return( $self->{'user'} );
-
-}
-
-sub getall_by_user
-{
-    my $vhffs = shift;
-    my $state = shift;
-    my $user = shift;
-	my $name;	
-	return undef if( ! defined $user );
-
-    my $db = $vhffs->get_db_object;
-    my @result;
-
-    my $query = 'SELECT g.gid  FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id INNER JOIN vhffs_user_group ug ON ug.gid=g.gid LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL AND ug.uid = '.$user->get_uid;
-
-    $query .= " AND o.state=$state " if( defined $state );
-    $query .= " ORDER BY g.groupname";
-
-    my $request = $db->prepare( $query );
-    my $rows = $request->execute;
-
-    return undef if( $rows <= 0 );
-
-    my $gids = $request->fetchall_arrayref;
-
-    my $group;
-    foreach my $gid ( @{$gids} )
-    {
-
-        $group = Vhffs::Group::get_by_gid( $vhffs , $gid->[0] );
-        push( @result , $group) if( defined $group );
-    }
-    return \@result;
-}
-
-
 sub getall
 {
 	my $vhffs = shift;
@@ -485,6 +405,7 @@
 }
 
 # Get all objects of the group
+# TODO should be in Vhffs::Object or should at least returns Vhffs:Object object...
 sub getall_objects
 {
 	my $self = shift;


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