/**
  * @todo Implement testFromURI().
  */
 public function testFromURI()
 {
     // empty uri
     $this->rodsAcct = $this->rodsAcct->fromURI("");
     $this->assertEquals("", $this->rodsAcct->user);
     //invalid format uri
     $this->rodsAcct = $this->rodsAcct->fromURI("wrongformat");
     $this->assertEquals("", $this->rodsAcct->user);
     //valid uri
     $this->rodsAcct = $this->rodsAcct->fromURI("notme.myZone@myirods.myhost.mycom:1111/myZone/home/notme");
     $this->assertEquals("notme", $this->rodsAcct->user);
 }
if (!empty($sid)) {
    session_id($sid);
}
session_start();
if (!isset($_SESSION['acct_manager'])) {
    $_SESSION['acct_manager'] = new RODSAcctManager();
}
$ruri = "";
if (isset($_REQUEST['ruri'])) {
    $ruri = $_REQUEST['ruri'];
} else {
    $response = array('success' => false, 'error' => 'required RODS URI not found');
    echo json_encode($response);
    exit(0);
}
$account = RODSAccount::fromURI($ruri, false);
if (empty($account->pass)) {
    $acct = $_SESSION['acct_manager']->findAcct($account);
    if (empty($acct)) {
        $response = array('success' => false, 'error' => 'Authentication Required');
        echo json_encode($response);
        exit(0);
    }
    $account = $acct;
}
try {
    $temppass = $account->getTempPassword();
    $response = array('success' => true, 'temppass' => $temppass);
    echo json_encode($response);
} catch (Exception $e) {
    $response = array('success' => false, 'errmsg' => $e->getMessage(), 'errcode' => $e->getCode());
Example #3
0
}
$files = array();
$dirs = array();
if (isset($_REQUEST['files'])) {
    $files = $_REQUEST['files'];
}
if (isset($_REQUEST['dirs'])) {
    $dirs = $_REQUEST['dirs'];
}
if (empty($files) && empty($dirs)) {
    $response = array('success' => false, 'errmsg' => 'No files or collections specified');
    echo json_encode($response);
    exit(0);
}
try {
    $account = RODSAccount::fromURI($ruri);
    $acct = $_SESSION['acct_manager']->findAcct($account);
    if (empty($acct)) {
        if (empty($account->pass)) {
            $response = array('success' => false, 'errmsg' => 'Authentication Required');
            echo json_encode($response);
            exit(0);
        } else {
            $_SESSION['acct_manager']->add($account);
        }
    }
    $account = $acct;
    $mservices = array();
    $input_params = array("*desc_resc" => $resc);
    $num_files = 0;
    foreach ($files as $fileuri) {