@@ -10,6 +10,10 @@ |
||
| 10 | 10 | private $timerInterval; |
| 11 | 11 | private $dismissable; |
| 12 | 12 | private $visible; |
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param string $content |
|
| 16 | + */ |
|
| 13 | 17 | public function DisplayedMessage($content,$type="success",$timerInterval=0,$dismissable=true,$visible=true){ |
| 14 | 18 | $this->content=$content; |
| 15 | 19 | $this->type=$type; |
@@ -31,7 +31,6 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Method to set the value of field objet |
| 33 | 33 | * |
| 34 | - * @param string $objet |
|
| 35 | 34 | * @return $this |
| 36 | 35 | */ |
| 37 | 36 | public function setLibelle($libelle) |
@@ -94,7 +93,7 @@ discard block |
||
| 94 | 93 | /** |
| 95 | 94 | * Allows to query the first record that match the specified conditions |
| 96 | 95 | * |
| 97 | - * @param mixed $parameters |
|
| 96 | + * @param string $parameters |
|
| 98 | 97 | * @return TypeUser |
| 99 | 98 | */ |
| 100 | 99 | public static function findFirst($parameters = null) |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function toString() { |
| 105 | - return $this->libelle; |
|
| 105 | + return $this->libelle; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function toString() { |
| 105 | - return $this->operation; |
|
| 105 | + return $this->operation; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function toString() { |
| 105 | - return $this->libelle; |
|
| 105 | + return $this->libelle; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | } |
@@ -171,6 +171,10 @@ discard block |
||
| 171 | 171 | return $acl; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | + /** |
|
| 175 | + * @param string $activeResource |
|
| 176 | + * @param string $activeOperation |
|
| 177 | + */ |
|
| 174 | 178 | public function verifyAccessAction($activeResource, $activeOperation) { |
| 175 | 179 | if($this->session->has("user")){ |
| 176 | 180 | $user = $this->session->get("user"); |
@@ -200,7 +204,7 @@ discard block |
||
| 200 | 204 | * Affiche un message Alert bootstrap |
| 201 | 205 | * @param string $message texte du message |
| 202 | 206 | * @param string $type type du message (info, success, warning ou danger) |
| 203 | - * @param number $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 207 | + * @param integer $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 204 | 208 | * @param string $dismissable si vrai, l'alert dispose d'une croix de fermeture |
| 205 | 209 | */ |
| 206 | 210 | public function _showMessage($message, $type = "success", $timerInterval = 0, $dismissable = true, $visible = true) |
@@ -218,7 +222,7 @@ discard block |
||
| 218 | 222 | /** |
| 219 | 223 | * Affiche un message Alert bootstrap de type warning |
| 220 | 224 | * @param string $message texte du message |
| 221 | - * @param number $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 225 | + * @param integer $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 222 | 226 | * @param string $dismissable si vrai, l'alert dispose d'une croix de fermeture |
| 223 | 227 | */ |
| 224 | 228 | public function messageWarning($message, $timerInterval = 0, $dismissable = true) |
@@ -229,7 +233,7 @@ discard block |
||
| 229 | 233 | /** |
| 230 | 234 | * Affiche un message Alert bootstrap de type danger |
| 231 | 235 | * @param string $message texte du message |
| 232 | - * @param number $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 236 | + * @param integer $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 233 | 237 | * @param string $dismissable si vrai, l'alert dispose d'une croix de fermeture |
| 234 | 238 | */ |
| 235 | 239 | public function messageDanger($message, $timerInterval = 0, $dismissable = true) |
@@ -240,7 +244,7 @@ discard block |
||
| 240 | 244 | /** |
| 241 | 245 | * Affiche un message Alert bootstrap de type info |
| 242 | 246 | * @param string $message texte du message |
| 243 | - * @param number $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 247 | + * @param integer $timerInterval durée en millisecondes d'affichage du message (0 pour que le message reste affiché) |
|
| 244 | 248 | * @param string $dismissable si vrai, l'alert dispose d'une croix de fermeture |
| 245 | 249 | */ |
| 246 | 250 | public function messageInfo($message, $timerInterval = 0, $dismissable = true) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $this->view->pick("main/index"); |
| 44 | 44 | } else { |
| 45 | 45 | $this->view->pick("main/error"); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function getInstance($id = NULL) |
@@ -141,34 +141,34 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function loadAclAction($typeUser) { |
| 144 | - $acl = new AclList(); |
|
| 145 | - $acl->setDefaultAction(Phalcon\Acl::DENY); |
|
| 144 | + $acl = new AclList(); |
|
| 145 | + $acl->setDefaultAction(Phalcon\Acl::DENY); |
|
| 146 | 146 | |
| 147 | - $roles = TypeUser::find(); |
|
| 148 | - foreach ($roles as $role) { |
|
| 149 | - $acl->addRole($role->getLibelle()); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - $operationsBdd = Operation::find(); |
|
| 153 | - $operations = array(); |
|
| 154 | - foreach ($operationsBdd as $operation) { |
|
| 155 | - $operations[] = $operation->getOperation(); |
|
| 156 | - } |
|
| 147 | + $roles = TypeUser::find(); |
|
| 148 | + foreach ($roles as $role) { |
|
| 149 | + $acl->addRole($role->getLibelle()); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + $operationsBdd = Operation::find(); |
|
| 153 | + $operations = array(); |
|
| 154 | + foreach ($operationsBdd as $operation) { |
|
| 155 | + $operations[] = $operation->getOperation(); |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - $ressources = Ressource::find(); |
|
| 159 | - foreach ($ressources as $ressource) { |
|
| 160 | - $acl->addResource($ressource->getLibelle(), $operations); |
|
| 161 | - } |
|
| 158 | + $ressources = Ressource::find(); |
|
| 159 | + foreach ($ressources as $ressource) { |
|
| 160 | + $acl->addResource($ressource->getLibelle(), $operations); |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - $aclsBdd = Acl::find(); |
|
| 164 | - foreach ($aclsBdd as $aclBdd) { |
|
| 165 | - $typeUserBdd = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser()); |
|
| 166 | - $ressourceBdd = Ressource::findFirst("id = ".$aclBdd->getIdRessource()); |
|
| 167 | - $operationBdd = Operation::findFirst("id = ".$aclBdd->getIdOperation()); |
|
| 168 | - $acl->allow($typeUserBdd->getLibelle(), $ressourceBdd->getLibelle(), $operationBdd->getOperation()); |
|
| 169 | - } |
|
| 163 | + $aclsBdd = Acl::find(); |
|
| 164 | + foreach ($aclsBdd as $aclBdd) { |
|
| 165 | + $typeUserBdd = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser()); |
|
| 166 | + $ressourceBdd = Ressource::findFirst("id = ".$aclBdd->getIdRessource()); |
|
| 167 | + $operationBdd = Operation::findFirst("id = ".$aclBdd->getIdOperation()); |
|
| 168 | + $acl->allow($typeUserBdd->getLibelle(), $ressourceBdd->getLibelle(), $operationBdd->getOperation()); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - return $acl; |
|
| 171 | + return $acl; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public function verifyAccessAction($activeResource, $activeOperation) { |
@@ -89,7 +89,6 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * Method to set the value of field role |
| 91 | 91 | * |
| 92 | - * @param string $role |
|
| 93 | 92 | * @return $this |
| 94 | 93 | */ |
| 95 | 94 | public function setIdTypeUser($idTypeUser) |
@@ -150,7 +149,7 @@ discard block |
||
| 150 | 149 | /** |
| 151 | 150 | * Returns the value of field role |
| 152 | 151 | * |
| 153 | - * @return string |
|
| 152 | + * @return integer |
|
| 154 | 153 | */ |
| 155 | 154 | public function getIdTypeUser() |
| 156 | 155 | { |
@@ -22,34 +22,34 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function signInAction() { |
| 25 | - $bootstrap = $this->jquery->bootstrap(); |
|
| 25 | + $bootstrap = $this->jquery->bootstrap(); |
|
| 26 | 26 | |
| 27 | - if(!empty($_POST['identite']) && !empty($_POST['password'])) { |
|
| 27 | + if(!empty($_POST['identite']) && !empty($_POST['password'])) { |
|
| 28 | 28 | |
| 29 | - $userPseudo = User::findFirst("identite = '".$_POST['identite']."'"); |
|
| 29 | + $userPseudo = User::findFirst("identite = '".$_POST['identite']."'"); |
|
| 30 | 30 | |
| 31 | - $userMail = User::findFirst("mail = '".$_POST['identite']."'"); |
|
| 31 | + $userMail = User::findFirst("mail = '".$_POST['identite']."'"); |
|
| 32 | 32 | |
| 33 | - if($userPseudo != NULL && password_verify($_POST['password'], $userPseudo->getPassword())) { |
|
| 34 | - $this->session->set("user", $userPseudo); |
|
| 35 | - $this->response->redirect("Index/index"); |
|
| 36 | - $this->loadAclAction($userPseudo->getIdTypeUser()); |
|
| 37 | - } else if($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) { |
|
| 38 | - $this->session->set("user", $userMail); |
|
| 39 | - $this->response->redirect("Index/index"); |
|
| 40 | - $this->loadAclAction($userMail->getIdTypeUser()); |
|
| 41 | - } else { |
|
| 42 | - echo $bootstrap->htmlAlert("alert1","L'identifiant ou le mot de passe est incorrecte."); |
|
| 43 | - } |
|
| 44 | - } |
|
| 33 | + if($userPseudo != NULL && password_verify($_POST['password'], $userPseudo->getPassword())) { |
|
| 34 | + $this->session->set("user", $userPseudo); |
|
| 35 | + $this->response->redirect("Index/index"); |
|
| 36 | + $this->loadAclAction($userPseudo->getIdTypeUser()); |
|
| 37 | + } else if($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) { |
|
| 38 | + $this->session->set("user", $userMail); |
|
| 39 | + $this->response->redirect("Index/index"); |
|
| 40 | + $this->loadAclAction($userMail->getIdTypeUser()); |
|
| 41 | + } else { |
|
| 42 | + echo $bootstrap->htmlAlert("alert1","L'identifiant ou le mot de passe est incorrecte."); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function rulesAction() { |
|
| 48 | - $accordion=$this->jquery->bootstrap()->htmlAccordion("accordion1"); |
|
| 49 | - $accordion->addPanel("Panel 1","Contenu du panel 1"); |
|
| 50 | - $accordion->addPanel("Panel 2","Contenu du panel 2"); |
|
| 51 | - echo $accordion; |
|
| 52 | - } |
|
| 47 | + public function rulesAction() { |
|
| 48 | + $accordion=$this->jquery->bootstrap()->htmlAccordion("accordion1"); |
|
| 49 | + $accordion->addPanel("Panel 1","Contenu du panel 1"); |
|
| 50 | + $accordion->addPanel("Panel 2","Contenu du panel 2"); |
|
| 51 | + echo $accordion; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |