Project

General

Profile

« Previous | Next » 

Revision 2846

Added by sgarg about 19 years ago

Added setaccess method

View differences:

Metacat.pm
247 247
}
248 248

  
249 249
#############################################################
250
# subroutine to set access for an XML document in Metacat
251
# If success, return 1, else return 0
252
#############################################################
253
sub setaccess {
254
  my $self = shift;
255
  my $docid = shift;
256
  my $principal = shift;
257
  my $permission = shift;
258
  my $permType = shift;
259
  my $permOrder = shift;
260

  
261
  my $returnval = 0;
262

  
263
  my %postData = ( action => 'setaccess',
264
                   docid => $docid,
265
		   principal => $principal,
266
		   permission => $permission,
267
		   permType => $permType,
268
		   permOrder => $permOrder
269
                 );
270

  
271
  my $response = $self->sendData(%postData);
272
  if (($response) && $response->content =~ /<success>/) {
273
    $returnval = 1;
274
  }
275

  
276
  return $returnval;
277
}
278

  
279

  
280
#############################################################
250 281
# subroutine to read an XML document from Metacat
251 282
# returns the XML from Metacat, which may be an error response
252 283
#############################################################
......
368 399
  $resultset = $metacat->squery($pathquery); 
369 400
  print $resultset;
370 401
  $response = $metacat->delete($docid); 
402
  $response = $metacat->setaccess($docid,$principal,$permission,$permType,$permOrder); 
371 403
  my $lastid = $metacat->getLastId("obfs");
372 404
  print $metacat->getMessage();
373 405
  $response = $metacat->getCookies(); 

Also available in: Unified diff