Beispiel #1
0
 /**
  * Process
  *
  * @return	boolean	false if the process is aborted
  * @access	public
  */
 function process()
 {
     if (!$this->_application->canViewPage()) {
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     $this->processChilds();
 }
Beispiel #2
0
 static function reset($type = NULL)
 {
     $messages =& org_glizy_Session::get('org.glizy.application.MessageStack', array());
     if (is_null($type) || $type == 'ALL') {
         $messages = array();
     } else {
         $messages[$type] = array();
     }
     org_glizy_Session::set('org.glizy.application.MessageStack', $messages);
 }
Beispiel #3
0
 public function logout()
 {
     org_glizy_Session::start();
     $evt = array('type' => GLZ_EVT_USERLOGOUT, 'data' => '');
     $this->dispatchEvent($evt);
     if (org_glizy_Config::get('USER_LOG')) {
         $user = org_glizy_Session::get('glizy.user');
         $arLog =& org_glizy_ObjectFactory::createModel('org.glizy.models.UserLog');
         $arLog->load($user['logId']);
         $arLog->delete();
     }
     org_glizy_Session::removeAll();
     setcookie("glizy_username", "", time() - 3600);
     setcookie("glizy_password", "", time() - 3600);
 }
Beispiel #4
0
 protected function loadContentFromDB()
 {
     if (!$this->_application->canViewPage()) {
         //$this->setAttribute('templateFileName', 'accessDenaied' );
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     // if ($this->_user->backEndAccess && org_glizy_Request::get( 'draft', '' ) == '1')
     // {
     // 	$versionStatus = 'DRAFT';
     // }
     // TODO gestire lo stato PUBLISHED E DRAFT
     $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy');
     $this->_content = $contentProxy->readContentFromMenu($this->_application->getPageId(), org_glizy_ObjectValues::get('org.glizy', 'languageId'));
 }
Beispiel #5
0
 function process()
 {
     $allowGroups = $this->getAttribute('allowGroups') != '' ? explode(',', $this->getAttribute('allowGroups')) : array();
     if ((!org_glizy_Session::get('glizy.userLogged') || !(count($allowGroups) ? in_array($this->_user->groupId, $allowGroups) : true)) && $this->getAttribute('enabled')) {
         if (org_glizy_helpers_Link::scriptUrl() != org_glizy_helpers_Link::makeUrl('link', array('pageId' => org_glizy_Config::get('START_PAGE')))) {
             if ($this->getAttribute('showErrorMessage')) {
                 org_glizy_Session::set('glizy.loginError', org_glizy_locale_Locale::get('GLZ_LOGIN_NOACCESS'));
             }
             org_glizy_Session::set('glizy.loginUrl', __Request::get('__url__'));
         }
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('link', array('pageId' => $this->getAttribute('accessPageId'))));
         exit;
     }
     if ($this->getAttribute('checkAcl') && !$this->_user->acl($this->_application->getPageId(), 'visible')) {
         header('HTTP/1.0 403 Forbidden');
         exit;
     }
 }
Beispiel #6
0
 function __construct($id, $groupId)
 {
     parent::__construct($id, $groupId);
     $this->roles = array();
     $this->aclMatrix = array();
     if ($id) {
         // TODO ora la matrice è memorizzata nella sessione
         // e non può essere invalidata dal gestore dei ruoli per tutti gli utenti
         $roles = org_glizy_Session::exists('glizy.roles');
         if (!empty($roles)) {
             $this->roles = org_glizy_Session::get('glizy.roles');
             $this->aclMatrix = org_glizy_Session::get('glizy.aclMatrix');
         } else {
             $it = org_glizy_ObjectFactory::createModelIterator('org.glizy.models.Role', 'getPermissions', array('params' => array('id' => $id, 'groupId' => $groupId)));
             foreach ($it as $ar) {
                 // se il ruolo non è attivo passa al prossimo
                 if (!$ar->role_active) {
                     continue;
                 }
                 // se il ruolo non è stato ancora processato
                 if (!$this->roles[$ar->role_id]) {
                     $this->roles[$ar->role_id] = true;
                     $permissions = unserialize($ar->role_permissions);
                     // unione delle matrici dei permessi
                     foreach ($permissions as $name => $actions) {
                         foreach ((array) $actions as $action => $value) {
                             $this->aclMatrix[strtolower($name)][$action] |= $value;
                         }
                     }
                 }
             }
             org_glizy_Session::set('glizy.roles', $this->roles);
             org_glizy_Session::set('glizy.aclMatrix', $this->aclMatrix);
         }
     }
 }
Beispiel #7
0
 /**
  * @param bool $init
  * @return mixed
  */
 function &_getValuesArray($init = false)
 {
     if (!$init) {
         org_glizy_Session::init();
     }
     return $_SESSION;
 }
Beispiel #8
0
 protected function setSession($user)
 {
     org_glizy_Session::set('glizy.userLogged', true);
     org_glizy_Session::set('glizy.user', $user);
 }
Beispiel #9
0
 function executeLater_new($oldState)
 {
     // controlla se � stato ftto submit
     if (strtolower(__Request::get('action', '')) == 'next') {
         if ($this->_parent->validate()) {
             $roleId = __Request::get('roleId');
             $roleName = __Request::get('roleName');
             $groups = __Request::get('groups');
             $users = __Request::get('users');
             $roleActive = __Request::get('roleActive');
             $permissions = __Request::get('permissions');
             $aclPageTypes = __Request::get('aclPageTypes');
             foreach ((array) $aclPageTypes as $masterPage => $pages) {
                 $pages = explode(',', $pages);
                 foreach ($pages as $page) {
                     $page = strtolower($page);
                     // se già sono settati permessi specifici non vengon copiati dal pagetype master
                     if ($permissions[$page]) {
                         continue;
                     }
                     // copia i permessi del pagetype master
                     $permissions[$page] = $permissions[$masterPage];
                 }
             }
             $ar = org_glizy_ObjectFactory::createModel('org.glizycms.roleManager.models.Role');
             if ($roleId) {
                 $ar->load($roleId);
             }
             $ar->role_name = $roleName;
             $ar->role_active = $roleActive;
             $ar->role_permissions = serialize($permissions);
             if ($roleId) {
                 $ar->save();
             } else {
                 $roleId = $ar->save();
             }
             $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.Join');
             $ar->delete(array('join_FK_source_id' => $roleId, 'join_objectName' => 'roles2usergroups'));
             $ar->delete(array('join_FK_source_id' => $roleId, 'join_objectName' => 'roles2users'));
             if ($groups != '') {
                 $groups = explode(',', $groups);
                 foreach ($groups as $groupId) {
                     $ar->join_FK_source_id = $roleId;
                     $ar->join_FK_dest_id = $groupId;
                     $ar->join_objectName = 'roles2usergroups';
                     $ar->save(null, true);
                 }
             }
             if ($users != '') {
                 $users = explode(',', $users);
                 foreach ($users as $userId) {
                     $ar->join_FK_source_id = $roleId;
                     $ar->join_FK_dest_id = $userId;
                     $ar->join_objectName = 'roles2users';
                     $ar->save(null, true);
                 }
             }
             org_glizy_Session::remove('glizy.roles');
             $this->_parent->refreshToState('reset');
         }
     }
 }
Beispiel #10
0
 private function checkSwitchLanguage()
 {
     $language = org_glizy_Request::get('language', NULL);
     if (!is_null($language) && $language != $this->_language) {
         // cambio lingua
         $this->log("change language", GLZ_LOG_SYSTEM);
         $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language');
         $ar->language_code = $language;
         $ar->find();
         org_glizy_Session::set('glizy.language', $ar->language_code);
         org_glizy_Session::set('glizy.languageId', $ar->language_id);
         org_glizy_ObjectValues::set('org.glizy', 'languageId', $ar->language_id);
         $this->_languageId = $ar->language_id;
         $this->_language = $ar->language_code;
         // ricarica la struttura del sito per avere i titoli aggiornati
         $this->_initSiteMap(true);
         // controlla se il routing ha definito un urlResolver
         $speakingUrlManager = $this->retrieveProxy('org.glizycms.speakingUrl.Manager');
         $urlResolver = $speakingUrlManager->getResolver(__Request::get('cms:urlResolver', 'org.glizycms.core.models.Content'));
         $url = $urlResolver->makeUrlFromRequest();
         org_glizy_helpers_Navigation::gotoUrl($url);
     }
 }
Beispiel #11
0
 function getEditingLanguageIsDefault()
 {
     return org_glizy_Session::get('glizy.editingLanguageIsDefault');
 }
Beispiel #12
0
 function set($name, $value, $type = GLZ_SESSION_EX_VOLATILE)
 {
     $name = $this->_componentId . '_' . $name;
     if (!array_key_exists($name, $this->_values)) {
         $tempValue = array();
         $tempValue['value'] = $value;
         $tempValue['type'] = $type;
         $this->_values[$name] = $tempValue;
     } else {
         $this->_values[$name]['value'] = $value;
     }
     org_glizy_Session::set(GLZ_SESSION_EX_PREFIX, $this->_allValues);
 }
Beispiel #13
0
 private function redirectAfterLogin()
 {
     $destPage = '';
     $accessPageId = $this->getAttribute('accessPageId');
     if ($accessPageId && $accessPageId != $this->_application->getPageId()) {
         $destPage = strpos($accessPageId, 'http') !== false ? $accessPageId : org_glizy_helpers_Link::makeUrl('link', array('pageId' => $this->getAttribute('accessPageId')));
     }
     $url = org_glizy_Session::get('glizy.loginUrl', $destPage);
     if ($url) {
         org_glizy_Session::remove('glizy.loginUrl');
         org_glizy_helpers_Navigation::gotoUrl($url);
     }
 }
Beispiel #14
0
 function login()
 {
     $this->log("login", GLZ_LOG_SYSTEM);
     if (org_glizy_Session::get('glizy.userLogged')) {
         $this->log("user is logged", GLZ_LOG_SYSTEM);
         $user = org_glizy_Session::get('glizy.user');
         // crea l'utente
         $this->_user =& org_glizy_ObjectFactory::createObject('org.glizy.application.User', $user);
         org_glizy_ObjectValues::setByReference('org.glizy', 'user', $this->_user);
         org_glizy_ObjectValues::set('org.glizy', 'userId', $this->_user->id);
         if (org_glizy_Config::get('USER_LOG')) {
             $this->log("log user access", GLZ_LOG_SYSTEM);
             $arLog =& org_glizy_ObjectFactory::createModel('org.glizy.models.UserLog');
             $arLog->load($user['logId']);
             $arLog->userlog_FK_user_id = $user['id'];
             $arLog->save();
         }
     } else {
         $this->log("user not logged", GLZ_LOG_SYSTEM);
         // utente finto
         $user = 0;
         // crea l'utente
         $this->_user =& org_glizy_ObjectFactory::createObject('org.glizy.application.User', $user);
         org_glizy_ObjectValues::setByReference('org.glizy', 'user', $this->_user);
         org_glizy_ObjectValues::set('org.glizy', 'userId', 0);
     }
 }