public function removeadminAction() { $this->doNotRender(); $id = (int) $this->getParam('id'); $user = \Entity\User::find($id); $user->podcasts->removeElement($this->podcast); $user->save(); return $this->redirectFromHere(array('action' => 'index', 'id' => NULL)); }
public function impersonateAction() { $id = (int) $this->getParam('id'); $user = User::find($id); if (!$user instanceof User) { throw new \DF\Exception\DisplayOnly('User not found!'); } // Set new identity in Zend_Auth $this->auth->masqueradeAsUser($user); $this->alert('<b>Logged in as ' . $user->firstname . ' ' . $user->lastname . '.</b>', 'green'); $this->redirectHome(); return; }
public function isMasqueraded() { if (!$this->isLoggedIn()) { $this->_masqueraded_user = FALSE; return NULL; } if ($this->_masqueraded_user === NULL) { if (!$this->_session->masquerade_user_id) { $this->_masqueraded_user = FALSE; } else { $mask_user_id = (int) $this->_session->masquerade_user_id; if ($mask_user_id != 0) { $user = User::find($mask_user_id); } else { $user = NULL; } if ($user instanceof User) { $this->_masqueraded_user = $user; } else { unset($this->_session->user_id); unset($this->_session->masquerade_user_id); $this->_masqueraded_user = FALSE; } } } return $this->_masqueraded_user; }