/**
  * Simple test.  Return NON-NULL if valid logged in.
  */
 public function testCreatePersonValidUser()
 {
     $accountName = 'foo-' . rand();
     $accountPassword = '******' . rand();
     $this->setZendAuthIdentity($accountName);
     $account = new Opus_Account();
     $account->setLogin($accountName)->setPassword($accountPassword)->store();
     $model = new Publish_Model_LoggedUser();
     $this->assertNotNull($model->getUserId());
     $person = $model->createPerson();
     $this->assertNotNull($person);
     $this->assertEquals($account->getId(), $model->getUserId());
 }
Example #2
0
 public function testEditValidationSameAccount()
 {
     $user = new Opus_Account(null, null, 'user');
     $form = new Admin_Form_Account($user->getId());
     // check that form was populated
     $this->assertEquals('user', $form->getElement('username')->getValue());
     $postData = array('username' => 'user', 'oldLogin' => 'user', 'roleguest' => '1', 'password' => 'notchanged', 'confirmPassword' => 'notchanged');
     $this->assertTrue($form->isValid($postData));
 }
 public function testHideDeleteLinkForCurrentUser()
 {
     $this->enableSecurity();
     $this->loginUser('security4', 'security4pwd');
     $this->dispatch('/admin/account');
     $this->assertResponseCode(200, $this->getResponse()->getBody());
     $this->logoutUser();
     $this->restoreSecuritySetting();
     $user = new Opus_Account(null, null, 'security4');
     $this->assertQueryCount("a[@href='" . $this->getRequest()->getBaseUrl() . "/admin/account/delete/id/" . $user->getId() . "']", 0, "There should be no delete link for current user'.");
 }
Example #4
0
 public function getSubmitter()
 {
     $return = array();
     foreach ($this->document->getEnrichment() as $e) {
         if ($e->getKeyName() != 'submitter.user_id') {
             continue;
         }
         $user_id = $e->getValue();
         $account = new Opus_Account($user_id);
         $return[$account->getId()] = strtolower($account->getLogin());
     }
     return $return;
 }