[X2go-Commits] x2goadmincenter.git - master (branch) updated: dc2c73feb7ba39e022d3bedf5c0ff0a987cbfe92

X2go dev team git-admin at x2go.org
Thu Sep 22 01:21:43 CEST 2011


The branch, master has been updated
       via  dc2c73feb7ba39e022d3bedf5c0ff0a987cbfe92 (commit)
      from  bd45e1a6373efeb3983c899804c1780a0c0d1d09 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dc2c73feb7ba39e022d3bedf5c0ff0a987cbfe92
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 22 01:20:59 2011 +0200

    tabified Perl code

-----------------------------------------------------------------------

Summary of changes:
 x2goadminserver/cgi-bin/x2gorpcserver.cgi          |   55 +-
 x2goadminserver/lib/x2goadminserver.pm             |   22 +-
 .../lib/x2goadminserver_backend_cipux.pm           | 1105 ++++++++++----------
 3 files changed, 587 insertions(+), 595 deletions(-)

The diff of changes is:
diff --git a/x2goadminserver/cgi-bin/x2gorpcserver.cgi b/x2goadminserver/cgi-bin/x2gorpcserver.cgi
index 5b6debe..eb2bc8b 100755
--- a/x2goadminserver/cgi-bin/x2gorpcserver.cgi
+++ b/x2goadminserver/cgi-bin/x2gorpcserver.cgi
@@ -49,32 +49,32 @@ process_cgi_call({
 
 # Process a CGI call.
 sub process_cgi_call ($) {
-    my ($methods) = @_;
-
-    # Get our CGI request information.
-    my $method = $ENV{'REQUEST_METHOD'};
-    my $type = $ENV{'CONTENT_TYPE'};
-    my $length = $ENV{'CONTENT_LENGTH'};
-
-    # Perform some sanity checks.
-    http_error(405, "Method Not Allowed") unless $method eq "POST";
-    http_error(400, "Bad Request") unless $type eq "text/xml";
-    http_error(411, "Length Required") unless $length > 0;
-
-    # Fetch our body.
-    my $body;
-    my $count = read STDIN, $body, $length;
-    http_error(400, "Bad Request") unless $count == $length; 
-
-    # Serve our request.
-    my $coder = Frontier::RPC2->new;
-    send_xml($coder->serve($body, $methods));
+	my ($methods) = @_;
+
+	# Get our CGI request information.
+	my $method = $ENV{'REQUEST_METHOD'};
+	my $type = $ENV{'CONTENT_TYPE'};
+	my $length = $ENV{'CONTENT_LENGTH'};
+
+	# Perform some sanity checks.
+	http_error(405, "Method Not Allowed") unless $method eq "POST";
+	http_error(400, "Bad Request") unless $type eq "text/xml";
+	http_error(411, "Length Required") unless $length > 0;
+
+	# Fetch our body.
+	my $body;
+	my $count = read STDIN, $body, $length;
+	http_error(400, "Bad Request") unless $count == $length; 
+
+	# Serve our request.
+	my $coder = Frontier::RPC2->new;
+	send_xml($coder->serve($body, $methods));
 }
 
 # Send an HTTP error and exit.
 sub http_error ($$) {
-    my ($code, $message) = @_;
-    print <<"EOD";
+	my ($code, $message) = @_;
+	print <<"EOD";
 Status: $code $message
 Content-type: text/html
 
@@ -82,20 +82,19 @@ Content-type: text/html
 <h1>$code $message</h1>
 <p>Unexpected error processing XML-RPC request.</p>
 EOD
-    exit 0;
+	exit 0;
 }
 
 # Send an XML document (but don't exit).
 sub send_xml ($) {
-    my ($xml_string) = @_;
-    my $length = length($xml_string);
-    print <<"EOD";
+	my ($xml_string) = @_;
+	my $length = length($xml_string);
+	print <<"EOD";
 Status: 200 OK
 Content-type: text/xml
 Content-length: $length
 
 EOD
     # We want precise control over whitespace here.
-    print $xml_string;
+	print $xml_string;
 }
-
diff --git a/x2goadminserver/lib/x2goadminserver.pm b/x2goadminserver/lib/x2goadminserver.pm
index 20bdc9b..2829419 100644
--- a/x2goadminserver/lib/x2goadminserver.pm
+++ b/x2goadminserver/lib/x2goadminserver.pm
@@ -28,7 +28,7 @@ use lib "/usr/lib/x2go";
 
 if($backend eq "cipux" )
 {
-    use x2goadminserver_backend_cipux;
+	use x2goadminserver_backend_cipux;
 }
 
 
@@ -39,41 +39,41 @@ our @EXPORT=('x2goadmin_getUsers','x2goadmin_getGroups', 'x2goadmin_getGroupsOfU
 
 
 sub x2goadmin_getUsers {
-    return getUsers(@_);
+	return getUsers(@_);
 }
 
 sub x2goadmin_getGroups {
-    return getGroups(@_);
+	return getGroups(@_);
 }
 
 sub x2goadmin_getGroupsWithUsers {
-    return getGroupsWithUsers(@_);
+	return getGroupsWithUsers(@_);
 }
 
 sub x2goadmin_getGroupsOfUser {
-    return getGroupsOfUser(@_);
+	return getGroupsOfUser(@_);
 }
 
 sub x2goadmin_modifyUser {
-    return modifyUser(@_);
+	return modifyUser(@_);
 }
 
 sub x2goadmin_modifyGroup {
-    return modifyGroup(@_);
+	return modifyGroup(@_);
 }
 
 sub x2goadmin_addGroup {
-    return addGroup(@_);
+	return addGroup(@_);
 }
 
 sub x2goadmin_addUser {
-    return addUser(@_);
+	return addUser(@_);
 }
 
 sub x2goadmin_removeUsers {
-    return removeUsers(@_);
+	return removeUsers(@_);
 }
 
 sub x2goadmin_removeGroups {
-    return removeGroups(@_);
+	return removeGroups(@_);
 }
diff --git a/x2goadminserver/lib/x2goadminserver_backend_cipux.pm b/x2goadminserver/lib/x2goadminserver_backend_cipux.pm
index 46d7d6e..b175851 100644
--- a/x2goadminserver/lib/x2goadminserver_backend_cipux.pm
+++ b/x2goadminserver/lib/x2goadminserver_backend_cipux.pm
@@ -35,261 +35,259 @@ my $version='0.0.1';
 my $perr;
 my $rpc=CipUX::RPC::Client->new(
 {
-  url => $url, client => $client, version => $version,
+	url => $url, client => $client, version => $version,
 }
 );
 
 use base 'Exporter';
 our @EXPORT=('getUsers', 'getGroups', 'getGroupsOfUser', 'getGroupsWithUsers',
-	     'modifyUser', 'modifyGroup', 'addUser', 'addGroup', 'removeUsers', 'removeGroups');
+             'modifyUser', 'modifyGroup', 'addUser', 'addGroup', 'removeUsers', 'removeGroups');
 
 sub ping
 {
-  eval { $rpc->rpc_ping;};
-  if($EVAL_ERROR)
-  {
-    $perr=$EVAL_ERROR;
-    return 0;
-  }
-  else
-  {
-    return 1;
-  }
-  
+	eval { $rpc->rpc_ping;};
+	if($EVAL_ERROR)
+	{
+		$perr=$EVAL_ERROR;
+		return 0;
+	}
+	else
+	{
+		return 1;
+	}
 }
 
 sub login_srv
 {
-  my ($login, $password) = @_;
-  my $login_info=
-  {
-    login => $login,
-    password => $password
-  };
-  return $rpc->rpc_login($login_info);
+	my ($login, $password) = @_;
+	my $login_info=
+	{
+		login => $login,
+		password => $password
+	};
+	return $rpc->rpc_login($login_info);
 }
 
 sub getServerInfo
 {
-  my ($login, $password) = @_;
-  if(!ping)
-  {
-    return (0, "SERVERDOWN URL:$url ERROR:$perr");
-  }
-  
-  if(!login_srv($login, $password))
-  {
-    return (0, "NOACCESS");
-  }
-  return (1,"OK");
+	my ($login, $password) = @_;
+	if(!ping)
+	{
+		return (0, "SERVERDOWN URL:$url ERROR:$perr");
+	}
+
+	if(!login_srv($login, $password))
+	{
+		return (0, "NOACCESS");
+	}
+	return (1,"OK");
 }
 
 
 sub execCommand
 {
-     my ($cmd,$param,$value)=@_;
-     my $msg;
-     my $status=1;
-     my $a_hr;
-     if($param)
-     {
-        my $p_hr;
-	if($value)
+	my ($cmd,$param,$value)=@_;
+	my $msg;
+	my $status=1;
+	my $a_hr;
+	if($param)
 	{
-	  $p_hr={object => $param, value => $value,};
+		my $p_hr;
+		if($value)
+		{
+			$p_hr={object => $param, value => $value,};
+		}
+		else
+		{
+			$p_hr={object => $param,};
+		}
+			$a_hr= $rpc->xmlrpc( { cmd => $cmd, param_hr => $p_hr} );
 	}
 	else
 	{
-	  $p_hr={object => $param,};
-	}
-        $a_hr= $rpc->xmlrpc( { cmd => $cmd, param_hr => $p_hr} );
-     }
-     else
-     {
-        $a_hr= $rpc->xmlrpc( { cmd => $cmd} );
-     }
-     my $cmdres=$a_hr->{'cmdres_r'};
-     if($a_hr->{'status'} eq 'FALSE')
-     {
-       $status=0;
-       $rpc->rpc_logout;
-       $msg='CMDERR '.$a_hr->{'cmd'}.' '.$a_hr->{'problem'}.' '.$a_hr->{'msg'};
-     }     
-     return ($status, $cmdres, $msg);
+		$a_hr= $rpc->xmlrpc( { cmd => $cmd} );
+	}
+	my $cmdres=$a_hr->{'cmdres_r'};
+	if($a_hr->{'status'} eq 'FALSE')
+	{
+		$status=0;
+		$rpc->rpc_logout;
+		$msg='CMDERR '.$a_hr->{'cmd'}.' '.$a_hr->{'problem'}.' '.$a_hr->{'msg'};
+	}
+	return ($status, $cmdres, $msg);
 }
 
 sub getRoleGroups
 {
-  my @groups;
-  my ($status,$cmdres, $msg)=execCommand('cipux_task_list_role_accounts');
-  if($status)
-  {
-      while( my ($key, $value) = each (%$cmdres))
-      {
-	push(@groups, $key);
-      }
-  }
-  return ($status, $msg, @groups);
+	my @groups;
+	my ($status,$cmdres, $msg)=execCommand('cipux_task_list_role_accounts');
+	if($status)
+	{
+		while( my ($key, $value) = each (%$cmdres))
+		{
+			push(@groups, $key);
+		}
+	}
+	return ($status, $msg, @groups);
 }
 
 sub changeUser
 {
-  my ($user, at args)=@_;
-  my @newgrp;
-  my @obsgrp;
-  foreach (@args)
-  {
-      my @cmd=split(":",$_);
-      if(@cmd[0] eq "fname")
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_firstname',$user, at cmd[1]);
-	if(!$status)
-	{
-	  return $msg;
-	}	
-      }
-      if(@cmd[0] eq "lname")
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_lastname',$user, at cmd[1]);
-	if(!$status)
-	{
-	  return $msg;
-	}	
-      }
-      if(@cmd[0] eq "password")
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_password',$user, at cmd[1]);
-	if(!$status)
-	{
-	  return $msg;
-	}	
-      }
-      if(@cmd[0] eq "newgroups")
-      {
-	@newgrp=split(";", at cmd[1]);
-      }
-      if(@cmd[0] eq "obsoletegroups")
-      {
-	@obsgrp=split(";", at cmd[1]);
-      }
-    }    
-  if(@obsgrp || @newgrp)
-  {
-    my ($rstatus,$rmsg, at rolegroups)=getRoleGroups();
-    if(!$rstatus)
-    {
-	  return $rmsg;
-    }    
-    foreach(@obsgrp)
-    {
-      my $grp=$_;
-      if( grep { $_ eq $grp} @rolegroups)
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_role_account',$grp,$user);
-	if(!$status)
-	{
-	  return $msg;
-	}		
-      }
-      else
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_class_share',$grp,$user);
-	if(!$status)
-	{
-	  return $msg;
-	}		
-      }
-    }
-    foreach(@newgrp)
-    {
-      my $grp=$_;
-      if( grep { $_ eq $grp} @rolegroups)
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_role_account',$grp,$user);
-	if(!$status)
+	my ($user, at args)=@_;
+	my @newgrp;
+	my @obsgrp;
+	foreach (@args)
 	{
-	  return $msg;
-	}		
-      }
-      else
-      {
-	my ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_class_share',$grp,$user);
-	if(!$status)
+		my @cmd=split(":",$_);
+		if(@cmd[0] eq "fname")
+		{
+			my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_firstname',$user, at cmd[1]);
+			if(!$status)
+			{
+				return $msg;
+			}
+		}
+		if(@cmd[0] eq "lname")
+		{
+			my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_lastname',$user, at cmd[1]);
+			if(!$status)
+			{
+				return $msg;
+			}
+		}
+		if(@cmd[0] eq "password")
+		{
+			my ($status,$cmdres, $msg)=execCommand('cipux_task_change_user_account_password',$user, at cmd[1]);
+			if(!$status)
+			{
+				return $msg;
+			}
+		}
+		if(@cmd[0] eq "newgroups")
+		{
+			@newgrp=split(";", at cmd[1]);
+		}
+		if(@cmd[0] eq "obsoletegroups")
+		{
+			@obsgrp=split(";", at cmd[1]);
+		}
+	}
+	if(@obsgrp || @newgrp)
 	{
-	  return $msg;
-	}		
-      }
-    }
-  }
-  $rpc->rpc_logout;
-  return "OK";
-}  
+		my ($rstatus,$rmsg, at rolegroups)=getRoleGroups();
+		if(!$rstatus)
+		{
+			return $rmsg;
+		}
+		foreach(@obsgrp)
+		{
+			my $grp=$_;
+			if( grep { $_ eq $grp} @rolegroups)
+			{
+				my ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_role_account',$grp,$user);
+				if(!$status)
+				{
+					return $msg;
+				}
+			}
+			else
+			{
+				my ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_class_share',$grp,$user);
+				if(!$status)
+				{
+					return $msg;
+				}
+			}
+		}
+		foreach(@newgrp)
+		{
+			my $grp=$_;
+			if( grep { $_ eq $grp} @rolegroups)
+			{
+				my ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_role_account',$grp,$user);
+				if(!$status)
+				{
+					return $msg;
+				}
+			}
+			else
+			{
+				my ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_class_share',$grp,$user);
+				if(!$status)
+				{
+					return $msg;
+				}
+			}
+		}
+	}
+	$rpc->rpc_logout;
+	return "OK";
+}
 
 sub modifyUser
 {
- 
-  my ($login,$password,$user, @args)=@_;
-  my $retmsg="OK";
-
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  return changeUser($user, at args);
+	my ($login,$password,$user, @args)=@_;
+	my $retmsg="OK";
+
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	return changeUser($user, at args);
 }
 
 sub addUser
 {
-  my ($login,$password,$user, @args)=@_;
-  my $retmsg="OK";
-
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  my $res;
-  my $msg;
-  ($status,$res, $msg)=execCommand('cipux_task_create_user_account',$user);
-  if(!$status)
-  {
-    return $msg;
-  }  
-  return changeUser($user, at args);
+	my ($login,$password,$user, @args)=@_;
+	my $retmsg="OK";
+
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	my $res;
+	my $msg;
+	($status,$res, $msg)=execCommand('cipux_task_create_user_account',$user);
+	if(!$status)
+	{
+		return $msg;
+	}
+	return changeUser($user, at args);
 }
 
 sub getUsers
 {
-  my ($login, $password) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  $str=userAttributes();  
-  my $cmdres;
-  my $msg;
-  ($status,$cmdres, $msg)=execCommand('cipux_task_retrieve_all_user_account_lastname_firstname');
-  if(!$status)
-  {
-    return $msg;
-  }
-  $str=$str."\nBEGIN_USERS";
-  ($status,$msg)=getAllUsers();
-  if(! $status)
-  {
-    return $msg;
-  }  
-  $str=$str.$msg."\nEND_USERS";
-
-  $rpc->rpc_logout;
-  return $str;
+	my ($login, $password) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	$str=userAttributes();  
+	my $cmdres;
+	my $msg;
+	($status,$cmdres, $msg)=execCommand('cipux_task_retrieve_all_user_account_lastname_firstname');
+	if(!$status)
+	{
+		return $msg;
+	}
+	$str=$str."\nBEGIN_USERS";
+	($status,$msg)=getAllUsers();
+	if(! $status)
+	{
+		return $msg;
+	}
+	$str=$str.$msg."\nEND_USERS";
+
+	$rpc->rpc_logout;
+	return $str;
 }
 
 sub userAttributes
 {
-  return "BEGIN_USERATTR\
+	return "BEGIN_USERATTR\
 uid:edit=0;unicode=0\
 firstname:edit=1;unicode=0\
 lastname:edit=1;unicode=0\
@@ -298,7 +296,7 @@ END_USERATTR";
 
 sub groupAttributes
 {
-  return "BEGIN_GROUPATTR\
+	return "BEGIN_GROUPATTR\
 name:edit=0;unicode=0\
 type:edit=0;vars=class_share,course_share,lecture_share,reading_share,seminar_share,studygroup_share,team_share,tutorial_share,workshop_share\
 password:edit=1;oncreate=0\
@@ -308,400 +306,395 @@ END_GROUPATTR";
 
 sub getGroups
 {
-  my ($login, $password) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  $str=groupAttributes();  
-  my $cmdres;
-  my $msg;
-  $str=$str."\nBEGIN_USERS";
-  ($status,$msg)=getAllUsers();
-  if(! $status)
-  {
-    return $msg;
-  }  
-  $str=$str.$msg."\nEND_USERS";
-  $str=$str."\nBEGIN_GROUPS\n";  
-  my $res;
-  ($status,$msg,$res)=getAllGroupsWithUsers();
-  if(!$status)
-  {
-    return $msg;
-  }
-  $str=$str.$res;
-  $str=$str."\nEND_GROUPS\n";  
-
-  $rpc->rpc_logout;
-  return $str;
+	my ($login, $password) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	$str=groupAttributes();  
+	my $cmdres;
+	my $msg;
+	$str=$str."\nBEGIN_USERS";
+	($status,$msg)=getAllUsers();
+	if(! $status)
+	{
+		return $msg;
+	}
+	$str=$str.$msg."\nEND_USERS";
+	$str=$str."\nBEGIN_GROUPS\n";  
+	my $res;
+	($status,$msg,$res)=getAllGroupsWithUsers();
+	if(!$status)
+	{
+		return $msg;
+	}
+	$str=$str.$res;
+	$str=$str."\nEND_GROUPS\n";  
+
+	$rpc->rpc_logout;
+	return $str;
 }
 
 sub getAllUsers
 {
-  my ($status,$cmdres, $msg)=execCommand('cipux_task_retrieve_all_user_account_lastname_firstname');
-  if(!$status)
-  {
-    return  ($status, $msg);
-  }
-  my $str;
-  while( my ($key, $value) = each (%$cmdres))
-  {
-    if($value->{'cipuxFirstname'}[0] ne "Role" && $value->{'cipuxLastname'}[0] ne "Account")
-    {
-       $str=$str."\nUID=".$value->{'uid'}[0].":FNAME=".$value->{'cipuxFirstname'}[0].":LNAME=".$value->{'cipuxLastname'}[0];
-    }
-  }
-  return ($status, $str);
+	my ($status,$cmdres, $msg)=execCommand('cipux_task_retrieve_all_user_account_lastname_firstname');
+	if(!$status)
+	{
+		return  ($status, $msg);
+	}
+	my $str;
+	while( my ($key, $value) = each (%$cmdres))
+	{
+		if($value->{'cipuxFirstname'}[0] ne "Role" && $value->{'cipuxLastname'}[0] ne "Account")
+		{
+			$str=$str."\nUID=".$value->{'uid'}[0].":FNAME=".$value->{'cipuxFirstname'}[0].":LNAME=".$value->{'cipuxLastname'}[0];
+		}
+	}
+	return ($status, $str);
 }
 
 
 sub getGroupsWithUsers
 {
-  my ($login, $password) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  $str=userAttributes;  
-  my $cmdres;
-  my $msg;
-  $str=$str."\nBEGIN_USERS";
-  ($status,$msg)=getAllUsers();
-  if(! $status)
-  {
-    return $msg;
-  }  
-  $str=$str.$msg."\nEND_USERS";
-  $str=$str."\nBEGIN_GROUPS\n";  
-  my $res;
-  ($status,$msg,$res)=getAllGroupsWithUsers();
-  if(!$status)
-  {
-    return $msg;
-  }
-  $str=$str.$res;
-  $str=$str."\nEND_GROUPS\n";  
-
-  $rpc->rpc_logout;
-  return $str;
+	my ($login, $password) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	$str=userAttributes;  
+	my $cmdres;
+	my $msg;
+	$str=$str."\nBEGIN_USERS";
+	($status,$msg)=getAllUsers();
+	if(! $status)
+	{
+		return $msg;
+	}
+	$str=$str.$msg."\nEND_USERS";
+	$str=$str."\nBEGIN_GROUPS\n";
+	my $res;
+	($status,$msg,$res)=getAllGroupsWithUsers();
+	if(!$status)
+	{
+		return $msg;
+	}
+	$str=$str.$res;
+	$str=$str."\nEND_GROUPS\n";  
+
+	$rpc->rpc_logout;
+	return $str;
 }
 
 sub getAllGroupsWithUsers
 {
 
-  my $str;
-  my ($status,$cmdres_all_tasks, $msg)=execCommand('cipux_task_list_tasks');
-  if(!$status)
-  {
-    return ($status, $msg, $str);
-  }  
-  while( my ($key, $value) = each (%$cmdres_all_tasks))
-  {
-    if($key =~ m/list/ && $key =~ m/accounts/ && 
-      $key ne "cipux_task_list_user_accounts" &&
-      $key ne "cipux_task_list_role_accounts" &&
-      $key ne "cipux_task_list_skel_accounts")
-    {
-      my $cmdres;
-      ($status,$cmdres, $msg)=execCommand($key);
-      if(!$status)
-      {
-         return ($status, $msg, $str);
-      }
-      while( my ($gkey, $gvalue) = each (%$cmdres))
-      {
-	my $aref=$gvalue->{'memberUid'};
-	$str=$str."\nNAME=".$gkey.":TYPE=role:MEMBERS=".join(";",@$aref);
-      }
-    }
-    if($key =~ m/list/ && $key =~ m/shares/)
-    {
-      my $cmdres;
-      ($status,$cmdres, $msg)=execCommand($key);
-      if(!$status)
-      {
-             return ($status, $msg, $str);
-      }
-      while( my ($gkey, $gvalue) = each (%$cmdres))
-      {
-	  my $sharetype=(split("_",$key))[3];
-	  my $cmdshareres;
-          ($status,$cmdshareres, $msg)=execCommand("cipux_task_list_members_of_$sharetype"."_share", $gkey);
-          if(!$status)
-          {
-            return ($status, $msg, $str);
-          }
-	  while( my ($gkey, $gvalue) = each (%$cmdshareres))
-	  {
-	    my $aref=$gvalue->{'memberUid'};
-	    $str=$str."\nNAME=".$gkey.":TYPE=".$sharetype."_share:MEMBERS=".join(";",@$aref);
-	  }
-      }      
-    }
-  }
-  return ($status, $msg, $str);
+	my $str;
+	my ($status,$cmdres_all_tasks, $msg)=execCommand('cipux_task_list_tasks');
+	if(!$status)
+	{
+		return ($status, $msg, $str);
+	}
+	while( my ($key, $value) = each (%$cmdres_all_tasks))
+	{
+		if($key =~ m/list/ && $key =~ m/accounts/ && 
+		   $key ne "cipux_task_list_user_accounts" &&
+		   $key ne "cipux_task_list_role_accounts" &&
+		   $key ne "cipux_task_list_skel_accounts")
+		{
+			my $cmdres;
+			($status,$cmdres, $msg)=execCommand($key);
+			if(!$status)
+			{
+				return ($status, $msg, $str);
+			}
+			while( my ($gkey, $gvalue) = each (%$cmdres))
+			{
+				my $aref=$gvalue->{'memberUid'};
+				$str=$str."\nNAME=".$gkey.":TYPE=role:MEMBERS=".join(";",@$aref);
+			}
+		}
+		if($key =~ m/list/ && $key =~ m/shares/)
+		{
+			my $cmdres;
+			($status,$cmdres, $msg)=execCommand($key);
+			if(!$status)
+			{
+				return ($status, $msg, $str);
+			}
+			while( my ($gkey, $gvalue) = each (%$cmdres))
+			{
+				my $sharetype=(split("_",$key))[3];
+				my $cmdshareres;
+				($status,$cmdshareres, $msg)=execCommand("cipux_task_list_members_of_$sharetype"."_share", $gkey);
+				if(!$status)
+				{
+					return ($status, $msg, $str);
+				}
+				while( my ($gkey, $gvalue) = each (%$cmdshareres))
+				{
+					my $aref=$gvalue->{'memberUid'};
+					$str=$str."\nNAME=".$gkey.":TYPE=".$sharetype."_share:MEMBERS=".join(";",@$aref);
+				}
+			}
+		}
+	}
+	return ($status, $msg, $str);
 }
 
 sub getGroupsOfUser
 {
-  my ($login, $password, $user) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  
-  if(!$status)
-  {
-    return $str;
-  }
-  $str="";
-
-  my $cmdres_all_tasks;
-  my $msg;
-  ($status,$cmdres_all_tasks, $msg)=execCommand('cipux_task_list_tasks');
-  if(!$status)
-  {
-    return $msg;
-  }
-  
-  while( my ($key, $value) = each (%$cmdres_all_tasks))
-  {
-    if($key =~ m/list/ && $key =~ m/accounts/ && 
-      $key ne "cipux_task_list_user_accounts" &&
-      $key ne "cipux_task_list_role_accounts" &&
-      $key ne "cipux_task_list_skel_accounts")
-    {
-      my $cmdres;
-      ($status,$cmdres, $msg)=execCommand($key);
-      if(!$status)
-      {
-	return $msg;
-      }
-      while( my ($gkey, $gvalue) = each (%$cmdres))
-      {
-	my $aref=$gvalue->{'memberUid'};
-	my $exists='0';
-	  
-	if( grep { $_ eq $user} @$aref)
-	{
-	  $exists='1';
-	}
-	$str=$str."\n".$gkey.":$exists";
-      }
-    }
-    if($key =~ m/list/ && $key =~ m/shares/)
-    {
-      my $cmdres;
-      ($status,$cmdres, $msg)=execCommand($key);
-      if(!$status)
-      {
-	return $msg;
-      }
-      while( my ($gkey, $gvalue) = each (%$cmdres))
-      {
-	  my $sharetype=(split("_",$key))[3];
-
-	  my $cmdshareres;
-          ($status,$cmdshareres, $msg)=execCommand("cipux_task_list_members_of_$sharetype"."_share", $gkey);
-          if(!$status)
-          {
-	      return $msg;
-          }
-	  while( my ($gkey, $gvalue) = each (%$cmdshareres))
-	  {
-	    my $aref=$gvalue->{'memberUid'};
-	    my $exists='0';
-	      
-	    if( grep { $_ eq $user} @$aref)
-	    {
-	      $exists='1';
-	    }
-	    $str=$str."\n".$gkey.":$exists";
-	  }
-      }
-      
-    }
-  }
-  $rpc->rpc_logout;
-  return $str;
+	my ($login, $password, $user) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+
+	if(!$status)
+	{
+		return $str;
+	}
+	$str="";
+
+	my $cmdres_all_tasks;
+	my $msg;
+	($status,$cmdres_all_tasks, $msg)=execCommand('cipux_task_list_tasks');
+	if(!$status)
+	{
+		return $msg;
+	}
+
+	while( my ($key, $value) = each (%$cmdres_all_tasks))
+	{
+		if($key =~ m/list/ && $key =~ m/accounts/ && 
+		   $key ne "cipux_task_list_user_accounts" &&
+		   $key ne "cipux_task_list_role_accounts" &&
+		   $key ne "cipux_task_list_skel_accounts")
+		{
+			my $cmdres;
+			($status,$cmdres, $msg)=execCommand($key);
+			if(!$status)
+			{
+				return $msg;
+			}
+			while( my ($gkey, $gvalue) = each (%$cmdres))
+			{
+				my $aref=$gvalue->{'memberUid'};
+				my $exists='0';
+
+				if( grep { $_ eq $user} @$aref)
+				{
+					$exists='1';
+				}
+				$str=$str."\n".$gkey.":$exists";
+			}
+		}
+		if($key =~ m/list/ && $key =~ m/shares/)
+		{
+			my $cmdres;
+			($status,$cmdres, $msg)=execCommand($key);
+			if(!$status)
+			{
+				return $msg;
+			}
+			while( my ($gkey, $gvalue) = each (%$cmdres))
+			{
+				my $sharetype=(split("_",$key))[3];
+
+				my $cmdshareres;
+				($status,$cmdshareres, $msg)=execCommand("cipux_task_list_members_of_$sharetype"."_share", $gkey);
+				if(!$status)
+				{
+					return $msg;
+				}
+				while( my ($gkey, $gvalue) = each (%$cmdshareres))
+				{
+					my $aref=$gvalue->{'memberUid'};
+					my $exists='0';
+
+					if( grep { $_ eq $user} @$aref)
+					{
+						$exists='1';
+					}
+					$str=$str."\n".$gkey.":$exists";
+				}
+			}
+		}
+	}
+	$rpc->rpc_logout;
+	return $str;
 }
 
 sub removeUsers
 {
-  my ($login, $password, $users) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  my @ulist=split(";",$users);
-  foreach(@ulist)
-  {
-          my ($tstatus,$res, $msg)=execCommand("cipux_task_destroy_user_account", $_);
-          if(!$tstatus)
-          {
-	      return $msg;
-          }
-  }
-  $rpc->rpc_logout;
-  return "OK";
+	my ($login, $password, $users) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	my @ulist=split(";",$users);
+	foreach(@ulist)
+	{
+		my ($tstatus,$res, $msg)=execCommand("cipux_task_destroy_user_account", $_);
+		if(!$tstatus)
+		{
+			return $msg;
+		}
+	}
+	$rpc->rpc_logout;
+	return "OK";
 }
 
 sub removeGroups
 {
-  my ($login, $password, $groups) = @_;
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  
-  my @rolegroups;
-  my $msg;
-  ($status, $msg, @rolegroups)=getRoleGroups;
-  if(!$status)
-  {
-    return $str;
-  }
-  
-  my @glist=split(";",$groups);
-  foreach(@glist)
-  {
-      my $grp=$_;
-      if( grep { $_ eq $grp} @rolegroups)
-      {
-	#skip role group
-      }
-      else
-      {
-	my ($tstatus,$res, $msg)=execCommand("cipux_task_destroy_class_share", $grp);
-        if(!$tstatus)
-        {
-	      return $msg;
-        }
-      }
-  }
-  $rpc->rpc_logout;
-  return "OK";
+	my ($login, $password, $groups) = @_;
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+
+	my @rolegroups;
+	my $msg;
+	($status, $msg, @rolegroups)=getRoleGroups;
+	if(!$status)
+	{
+		return $str;
+	}
+
+	my @glist=split(";",$groups);
+	foreach(@glist)
+	{
+		my $grp=$_;
+		if( grep { $_ eq $grp} @rolegroups)
+		{
+			#skip role group
+		}
+		else
+		{
+			my ($tstatus,$res, $msg)=execCommand("cipux_task_destroy_class_share", $grp);
+			if(!$tstatus)
+			{
+				return $msg;
+			}
+		}
+	}
+	$rpc->rpc_logout;
+	return "OK";
 }
 
 
 sub modifyGroup
 {
- 
-  my ($login,$password,$group, at args)=@_;
-  my $retmsg="OK";
-
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  return changeGroup($group, at args);
+	my ($login,$password,$group, at args)=@_;
+	my $retmsg="OK";
+
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	return changeGroup($group, at args);
 }
 
 sub addGroup
 {
- 
-  my ($login,$password,$group, at args)=@_;
-  my $retmsg="OK";
-
-  my ($status,$str)=getServerInfo($login, $password);
-  if(!$status)
-  {
-    return $str;
-  }
-  my $type;
-  foreach (@args)
-  {
-      my @cmd=split(":",$_);
-      if(@cmd[0] eq "type")
-      {
-         $type=@cmd[1];
-      }
-  }
-  my $res;
-  my $msg;
-  ($status,$res, $msg)=execCommand('cipux_task_create_'.$type,$group);
-  if(!$status)
-  {
-    return $msg;
-  }   
-  return $retmsg;
+	my ($login,$password,$group, at args)=@_;
+	my $retmsg="OK";
+
+	my ($status,$str)=getServerInfo($login, $password);
+	if(!$status)
+	{
+		return $str;
+	}
+	my $type;
+	foreach (@args)
+	{
+		my @cmd=split(":",$_);
+		if(@cmd[0] eq "type")
+		{
+			$type=@cmd[1];
+		}
+	}
+	my $res;
+	my $msg;
+	($status,$res, $msg)=execCommand('cipux_task_create_'.$type,$group);
+	if(!$status)
+	{
+		return $msg;
+	}
+	return $retmsg;
 }
 
 
 
 sub changeGroup
 {
-  my ($group, at args)=@_;
-  my @newusers;
-  my @obsusers;
-  my $type;
-  my $password;
-  my $str="OK";
-  foreach (@args)
-  {
-      my @cmd=split(":",$_);
-      if(@cmd[0] eq "password")
-      {
-	$password=@cmd[1];
-      }
-      if(@cmd[0] eq "type")
-      {
-	$type=@cmd[1];
-
-      }
-      if(@cmd[0] eq "newmembers")
-      {
-	@newusers=split(";", at cmd[1]);
-      }
-      if(@cmd[0] eq "obsoletemembers")
-      {
-	@obsusers=split(";", at cmd[1]);
-
-      }
-  }    
-  if($password && $type ne 'role')
-  {
-    	my ($status,$cmdres, $msg)=execCommand('cipux_task_change_'.$type.'_password',$group,$password);
-        if(!$status)
-	{
-	  return $msg;
-	}
-  }
-  foreach(@obsusers)
-  {
-	my ($status,$cmdres, $msg);
-	if($type eq 'role' )
-	{
-	    ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_role_account',$group,$_);
-	}
-	else
+	my ($group, at args)=@_;
+	my @newusers;
+	my @obsusers;
+	my $type;
+	my $password;
+	my $str="OK";
+	foreach (@args)
 	{
-	    ($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_'.$type,$group,$_);
+		my @cmd=split(":",$_);
+		if(@cmd[0] eq "password")
+		{
+			$password=@cmd[1];
+		}
+		if(@cmd[0] eq "type")
+		{
+			$type=@cmd[1];
+		}
+		if(@cmd[0] eq "newmembers")
+		{
+			@newusers=split(";", at cmd[1]);
+		}
+		if(@cmd[0] eq "obsoletemembers")
+		{
+			@obsusers=split(";", at cmd[1]);
+		}
 	}
-	if(!$status)
-	{
-	  return $msg;
-	}		
-  }
-  foreach(@newusers)
-  {
-	my ($status,$cmdres, $msg);
-	if($type eq 'role' )
+	if($password && $type ne 'role')
 	{
-	  ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_role_account',$group,$_);
-	}	
-	else
+		my ($status,$cmdres, $msg)=execCommand('cipux_task_change_'.$type.'_password',$group,$password);
+		if(!$status)
+		{
+			return $msg;
+		}
+	}
+	foreach(@obsusers)
 	{
-	  ($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_'.$type,$group,$_);
+		my ($status,$cmdres, $msg);
+		if($type eq 'role' )
+		{
+			($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_role_account',$group,$_);
+		}
+		else
+		{
+			($status,$cmdres, $msg)=execCommand('cipux_task_remove_member_from_'.$type,$group,$_);
+		}
+		if(!$status)
+		{
+			return $msg;
+		}
 	}
-	if(!$status)
+	foreach(@newusers)
 	{
-	  return $msg;
-	}		
-  }
-  $rpc->rpc_logout;
-  return $str;
-}  
+		my ($status,$cmdres, $msg);
+		if($type eq 'role' )
+		{
+			($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_role_account',$group,$_);
+		}
+		else
+		{
+			($status,$cmdres, $msg)=execCommand('cipux_task_add_member_to_'.$type,$group,$_);
+		}
+		if(!$status)
+		{
+			return $msg;
+		}
+	}
+	$rpc->rpc_logout;
+	return $str;
+}


hooks/post-receive
-- 
x2goadmincenter.git (X2go Administration Center)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goadmincenter.git" (X2go Administration Center).




More information about the x2go-commits mailing list