/** * Custom access check to be called by parent class. Returns the value of * config key "account.editOwnAccount" if set; false otherwise. * * @return boolean */ protected function customAccessCheck() { $parent_value = parent::customAccessCheck(); $config = Zend_Registry::get('Zend_Config'); if (!isset($config) or !isset($config->account->editOwnAccount)) { return false; } return $parent_value and $config->account->editOwnAccount; }
/** * Setup module. Check privileges. */ public function init() { parent::init(); // Highlight menu entries. if (true === Opus_Security_Realm::getInstance()->checkModule('admin')) { $this->getHelper('MainMenu')->setActive('admin'); } else { $this->getHelper('MainMenu')->setActive('review'); } $this->loggedUser = new Publish_Model_LoggedUser(); $this->view->title = $this->view->translate('review_index_title'); }
/** * Initializes controller. */ public function init() { parent::init(); $this->__documentsHelper = $this->_helper->getHelper('Documents'); $this->__workflowHelper = $this->_helper->getHelper('Workflow'); $config = Zend_Registry::get('Zend_Config'); if (isset($config->confirmation->document->statechange->enabled)) { $this->__confirmChanges = $config->confirmation->document->statechange->enabled == 1 ? true : false; } else { $this->__confirmChanges = true; } }
/** * Initializes controller. */ public function init() { parent::init(); $config = Zend_Registry::get('Zend_Config'); if (!isset($config->enrichmentkey->protected->modules)) { throw new Opus_Exception("config key 'enrichmentkey.protected.modules' is not defined in config file"); } foreach (explode(',', $config->enrichmentkey->protected->modules) as $protectedEnrichmentkey) { array_push($this->protectedEnrichmentkeys, $protectedEnrichmentkey); } if (!isset($config->enrichmentkey->protected->migration)) { throw new Opus_Exception("config key 'enrichmentkey.protected.migration' is not defined in config file"); } foreach (explode(',', $config->enrichmentkey->protected->migration) as $protectedEnrichmentkey) { array_push($this->protectedEnrichmentkeys, $protectedEnrichmentkey); } }
public function init() { parent::init(); $this->model = new Admin_Model_IndexMaintenance($this->_logger); // TODO features will be enabled in later version $this->view->disabledFeatureFulltextExtractionCheck = true; // TODO OPUSVIER-2955 $this->view->disabledFeatureIndexOptimization = true; // TODO OPUSVIER-2956 if ($this->model->getFeatureDisabled()) { $this->view->featureDisabled = true; } else { $this->view->allowConsistencyCheck = $this->model->allowConsistencyCheck(); $this->view->allowFulltextExtractionCheck = $this->model->allowFulltextExtractionCheck(); $this->view->allowIndexOptimization = $this->model->allowIndexOptimization(); } }
/** * Authenticate the user * * @var Controller_Action * @var Username * @var Password * @return if success user's object otherwise NULL. */ public function authenticate(Controller_Action $controller, $username, $password) { $user = NULL; if (!$this->ldapConnect()) { $controller->setError('Could not connect to the LDAP Server.'); return $user; } //If the login id is not the COMMON_NAME_ATTRIBUTE, find the value to bind if (defined('LDAP_ALT_LOGIN_ATTRIBUTE') && LDAP_ALT_LOGIN_ATTRIBUTE !== false) { $ldap_commonName = $this->getLdapCommonName(LDAP_ALT_LOGIN_ATTRIBUTE . '=' . $username); } else { $ldap_commonName = $username; } $ldap_username = $this->getLdapUsername($ldap_commonName); error_log("Ldap: {$ldap_commonName} : {$ldap_username}"); $login_status = $this->ldapBind($ldap_username, $password); if ($login_status) { // if ($sr=ldap_read($this->ldap_connection, LDAP_USER_DN,"(objectclass=*)",array('samaccountname'))) { // error_log("LdapDump: ".json_encode(ldap_get_entries($this->ldap_connection,$sr))); // } $ldapEmail = $this->getLdapEmail(LDAP_COMMON_NAME_ATTRIBUTE . "=" . $ldap_commonName); if ($this->user->loadByUsername($ldapEmail)) { if ($this->user->isActive()) { $user = $this->user; } else { $controller->setError("User is deactivated."); } } else { //Ldap users are already authenticated. If they don't exist yet, take care of it. $user = new LoveUser(); $data = array("Username" => $ldapEmail, "Password" => 'LDAP', "Nickname" => array_shift(split('@', $ldapEmail)), "Active" => 1, "Confirmed" => 1, "Removed" => 0, "Admin" => 0, "Token" => '', "DateAdded" => 0, "DateModified" => 0); $user->loadData($data); try { $id = $user->save(); $result = $id; } catch (Exception $e) { $controller->setError($e->getMessage()); } } } else { $controller->setError("Invalid login"); } $this->ldapClose(); return $user; }
public function init() { parent::init(); $this->_config = Zend_Registry::get("Zend_Config"); if (isset($this->_config->admin->documents->linkToAuthorSearch)) { $this->view->linkToAuthorSearch = $this->_config->admin->documents->linkToAuthorSearch; } else { $this->view->linkToAuthorSearch = 0; } if (isset($this->_config->admin->documents->maxDocsDefault)) { $this->_maxDocsDefault = $this->_config->admin->documents->maxDocsDefault; } else { $this->_maxDocsDefault = 10; } if (isset($this->_config->admin->documents->defaultview)) { $default = $this->_config->admin->documents->defaultview; if (!in_array($default, $this->docOptions)) { $this->getLogger()->err("Option 'admin.documents.defaultview' hat ungegueltigen Wert '{$default}'."); } $this->_stateOptionDefault = $default; } }
/** * The home module is the place for all custom static pages. This function * catches all action calls, thus making a new page available via * http://.../home/index/page by simply placing it in * modules/home/views/scripts/index/page.phtml * * @param string $action The name of the action that was called. * @param array $parameters The parameters passed to the action. * @return void */ public function __call($action, $parameters) { if (!'Action' == substr($action, -6)) { $this->_logger->info(__METHOD__ . ' undefined method: ' . $action); parent::__call($action, $parameters); } // it should be checked if the requested static page exists at all, as // otherwise this controller will not throw exceptions of type NO_ACTION $actionName = $this->getRequest()->getActionName(); $phtmlFilesAvailable = $this->getViewScripts(); if (array_search($actionName, $phtmlFilesAvailable) === FALSE) { $this->_logger->info(__METHOD__ . ' requested file ' . $actionName . '.phtml is not readable or does not exist'); parent::__call($action, $parameters); } $translation = $this->view->translate('help_content_' . $actionName); $helpFilesAvailable = Home_Model_HelpFiles::getFiles(); $pos = array_search($translation, $helpFilesAvailable); if ($pos === FALSE) { $this->view->text = $translation; } else { $this->view->text = Home_Model_HelpFiles::getFileContent($helpFilesAvailable[$pos]); } }
public function init() { parent::init(); $this->_helper->mainMenu('browsing'); }
/** * Initializes controller. */ public function init() { parent::init(); $this->documentsHelper = $this->_helper->getHelper('Documents'); }
public function init() { parent::init(); $this->facetMenu = new Solrsearch_Model_FacetMenu(); $this->_helper->mainMenu('search'); }
public function init() { parent::init(); $this->statisticsModel = new Admin_Model_Statistics(); }
/** * Initialisiert den Controller. */ public function init() { parent::init(); $this->loadDefaultMessages(); }
public function adminresettoken(Controller_Action $controller, $user_id, $admin_id) { $result = NULL; if ($this->user->loadById($admin_id)) { if ($this->user->isActive()) { if ($this->user->isNotRemoved()) { if ($this->user->isAdmin()) { if ($this->user->loadById($user_id)) { $this->user->setToken(uniqid()); try { if ($this->user->save()) { $result = $this->user; } else { $controller->setError("Unable to save new user data."); } } catch (Exception $e) { $controller->setError($e->getMessage()); } $result = $this->user; } else { $controller->setError("User doesn't exist."); } } else { $controller->setError("You are not admin user."); } } else { $controller->setError("Admin user is removed."); } } else { $controller->setError("Admin user is deactivated."); } } else { $controller->setError("Admin user doesn't exist."); } return $result; }
public function init() { parent::init(); $this->documentTypesHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('DocumentTypes'); }
public function init() { $this->session = new Zend_Session_Namespace('Publish'); parent::init(); }
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { $this->log = Zend_Registry::get('Zend_Log'); $this->session = new Zend_Session_Namespace('Publish'); parent::__construct($request, $response, $invokeArgs); }
/** * Setup theme path * * @return void */ public function init() { parent::init(); }
/** * Common init function. */ public function init() { parent::init(); // $this->_helper->layout->setLayout('client-admin-default'); }