Project

General

Profile

« Previous | Next » 

Revision 2684

Added by sgarg about 19 years ago

Modified the login method in the perl metacat client so that status of the user logging is also returned
Earlier if login info was not valid, 0 was returned. And 1 is sent back if login info was valid.

Now, if valid then following values are returned to indicate user status
1 - user
2 - moderator
3 - administrator
4 - moderator and administrator

View differences:

src/perl/Metacat/Metacat.pm
124 124

  
125 125
#############################################################
126 126
# subroutine to log into Metacat and save the cookie if the
127
# login is valid.  If valid, return 1, else return 0
127
# login is valid.  If not valid, return 0. If valid then send 
128
# following values to indicate user status
129
# 1 - user
130
# 2 - moderator
131
# 3 - administrator
132
# 4 - moderator and administrator
128 133
#############################################################
129 134
sub login {
130 135
  my $self = shift;
......
143 148
    $returnval = 1;
144 149
  }
145 150

  
151
  if (($response) && $response->content =~ /<isAdministrator>/) {
152
	if (($response) && $response->content =~ /<isModerator>/) {
153
    		$returnval = 4;
154
	} else {
155
		$returnval = 3;
156
	}
157
  } elsif (($response) && $response->content =~ /<isModerator>/){
158
	$returnval = 2;
159
  }
160

  
146 161
  return $returnval;
147 162
}
148 163

  

Also available in: Unified diff