public function getId() { if ($this->hasState('id')) { return $this->getState('id'); } return parent::getId(); }
/** * @runInSeparateProcess * @outputBuffering enabled * @dataProvider booleanProvider */ public function testLoginLogout($destroySession) { $identity = new CUserIdentity('testUser', 'testPassword'); $user = new CWebUser(); $user->init(); // be guest before login $this->assertTrue($user->isGuest); // do a login $this->assertTrue($user->login($identity)); // don't be guest after login $this->assertFalse($user->isGuest); $this->assertEquals('testUser', $user->getId()); $this->assertEquals('testUser', $user->getName()); $user->logout($destroySession); // be guest after logout $this->assertNull($user->getId()); $this->assertEquals($user->guestName, $user->getName()); }
/** * @param CWebUser $c * @return bool */ public function kannLoeschen($c) { if ($this->getVeranstaltung()->isAdminCurUser()) { return true; } if (!is_null($this->verfasserIn->auth) && $c->getId() == $this->verfasserIn->auth) { return true; } return false; }
public function getId() { return !$this->isGuest ? parent::getId() : 0; }