Ejemplo n.º 1
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $oAclTipoUsuarioRota = AclTipoUsuarioRota::model()->findByAttributes(array('acl_rota_id' => $this->acl_rota_id, 'acl_tipo_usuario_id' => $this->acl_tipo_usuario_id));
         if (!empty($oAclTipoUsuarioRota)) {
             return false;
         }
     }
     return parent::beforeSave();
 }
Ejemplo n.º 2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return AclTipoUsuarioRota the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = AclTipoUsuarioRota::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
 public function carregarPermissoes()
 {
     $oAclTipoUsuarioRota = AclTipoUsuarioRota::model()->naoExcluido()->findAllByAttributes(array('acl_tipo_usuario_id' => $this->acl_tipo_usuario_id));
     $_aPermissoes = array();
     if (!empty($oAclTipoUsuarioRota)) {
         if (!empty($_SESSION[base64_encode(Yii::app()->params['projeto'] . '_PermissoesAcesso')][base64_encode('PermissoesAcessoUsuario')])) {
             unset($_SESSION[base64_encode(Yii::app()->params['projeto'] . '_PermissoesAcesso')][base64_encode('PermissoesAcessoUsuario')]);
         }
         foreach ($oAclTipoUsuarioRota as $aclTipoUsuarioRota) {
             $_aPermissoes[base64_encode(Yii::app()->params['projeto'] . '_PermissoesAcesso')][base64_encode('PermissoesAcessoUsuario')][base64_encode($aclTipoUsuarioRota->rota->controller)][base64_encode('actions')][] = base64_encode($aclTipoUsuarioRota->rota->action);
         }
         Yii::app()->user->setState('__' . base64_encode(Yii::app()->params['projeto'] . '_PermissoesAcessoUsuario'), $_aPermissoes);
     }
 }