@@ -5,24 +5,24 @@ |
||
5 | 5 | protected $title; |
6 | 6 | protected $controller; |
7 | 7 | |
8 | - public function initialize(){ |
|
8 | + public function initialize() { |
|
9 | 9 | $this->model = "Acl"; |
10 | 10 | $this->title = "Acl"; |
11 | - $this->controller= "Acl"; |
|
11 | + $this->controller = "Acl"; |
|
12 | 12 | } |
13 | 13 | |
14 | - public function frmAction(){ |
|
14 | + public function frmAction() { |
|
15 | 15 | $typesUser = TypeUser::find(); |
16 | 16 | $operations = Operation::find(); |
17 | 17 | $ressources = Ressource::find(); |
18 | 18 | |
19 | - $this->view->setVar("operations",$operations); |
|
20 | - $this->view->setVar("ressources",$ressources); |
|
21 | - $this->view->setVar("typesUser",$typesUser); |
|
19 | + $this->view->setVar("operations", $operations); |
|
20 | + $this->view->setVar("ressources", $ressources); |
|
21 | + $this->view->setVar("typesUser", $typesUser); |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | |
25 | - public function updateAction(){ |
|
25 | + public function updateAction() { |
|
26 | 26 | parent::updateAction(); |
27 | 27 | $this->response->redirect("$this->controller/index"); |
28 | 28 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $this->view->setVar("title", $this->title); |
24 | 24 | } |
25 | 25 | |
26 | - public function frmAction(){ |
|
26 | + public function frmAction() { |
|
27 | 27 | |
28 | 28 | } |
29 | 29 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->view->setVar("object", $object); |
67 | 67 | $this->view->pick("main/read"); |
68 | 68 | } |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function soloUpdateAction() |
111 | 111 | { |
112 | 112 | if ($this->verifyAccessAction($this->controller, "write")) { |
113 | - if($this->session->has("user") && ($this->session->get("user")->getId() == $this->request->getPost('pk', 'int')) || $this->session->get("user")->getIdTypeUser() == 0){ |
|
113 | + if ($this->session->has("user") && ($this->session->get("user")->getId() == $this->request->getPost('pk', 'int')) || $this->session->get("user")->getIdTypeUser() == 0) { |
|
114 | 114 | $name = $this->request->getPost('name', 'string'); |
115 | 115 | //Créer la fonction variable 'set' en fonction du name en POST |
116 | 116 | $func = 'set' . ucfirst($name); |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | |
176 | 176 | $aclsBdd = Acl::find(); |
177 | 177 | foreach ($aclsBdd as $aclBdd) { |
178 | - $typeUserBdd = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser()); |
|
179 | - $ressourceBdd = Ressource::findFirst("id = ".$aclBdd->getIdRessource()); |
|
180 | - $operationBdd = Operation::findFirst("id = ".$aclBdd->getIdOperation()); |
|
178 | + $typeUserBdd = TypeUser::findFirst("id = " . $aclBdd->getIdTypeUser()); |
|
179 | + $ressourceBdd = Ressource::findFirst("id = " . $aclBdd->getIdRessource()); |
|
180 | + $operationBdd = Operation::findFirst("id = " . $aclBdd->getIdOperation()); |
|
181 | 181 | $acl->allow($typeUserBdd->getLibelle(), $ressourceBdd->getLibelle(), $operationBdd->getOperation()); |
182 | 182 | } |
183 | 183 | |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | public function verifyAccessAction($activeResource, $activeOperation) { |
188 | - if($this->session->has("user")){ |
|
188 | + if ($this->session->has("user")) { |
|
189 | 189 | $user = $this->session->get("user"); |
190 | - $typeUser = TypeUser::findFirst("id = ".$user->getIdTypeUser()); |
|
190 | + $typeUser = TypeUser::findFirst("id = " . $user->getIdTypeUser()); |
|
191 | 191 | $typeUserSession = $user->getIdTypeUser(); |
192 | 192 | $acl = $this->loadAclAction($typeUserSession); |
193 | 193 | if ($acl->isAllowed($typeUser->getLibelle(), $activeResource, $activeOperation)) { |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | } else { |
196 | 196 | return 0; |
197 | 197 | } |
198 | - }else{ |
|
198 | + } else { |
|
199 | 199 | return 0; |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | - public function moreAction(){ |
|
204 | + public function moreAction() { |
|
205 | 205 | $this->view->pick("main/more"); |
206 | 206 | } |
207 | 207 | |
@@ -267,27 +267,27 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | |
270 | - public function isAdmin($userId){ |
|
270 | + public function isAdmin($userId) { |
|
271 | 271 | $user = User::findFirst($userId); |
272 | - if($user->getTypeUser() == 0){ |
|
272 | + if ($user->getTypeUser() == 0) { |
|
273 | 273 | return true; |
274 | - }else{ |
|
274 | + } else { |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - public function isActual($user){ |
|
280 | - if($this->session->has("user") || $user == $this->session->get("user")->getId()){ |
|
279 | + public function isActual($user) { |
|
280 | + if ($this->session->has("user") || $user == $this->session->get("user")->getId()) { |
|
281 | 281 | return true; |
282 | - }else{ |
|
282 | + } else { |
|
283 | 283 | return false; |
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | - public function isAdminAndActual($user){ |
|
288 | - if($this->isAdmin($user) || $this->isActual($user)){ |
|
287 | + public function isAdminAndActual($user) { |
|
288 | + if ($this->isAdmin($user) || $this->isActual($user)) { |
|
289 | 289 | return true; |
290 | - }else{ |
|
290 | + } else { |
|
291 | 291 | return false; |
292 | 292 | } |
293 | 293 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->view->setVar("object", $object); |
67 | 67 | $this->view->pick("main/read"); |
68 | 68 | } |
69 | - }else{ |
|
69 | + } else{ |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } else { |
196 | 196 | return 0; |
197 | 197 | } |
198 | - }else{ |
|
198 | + } else{ |
|
199 | 199 | return 0; |
200 | 200 | } |
201 | 201 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $user = User::findFirst($userId); |
272 | 272 | if($user->getTypeUser() == 0){ |
273 | 273 | return true; |
274 | - }else{ |
|
274 | + } else{ |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function isActual($user){ |
280 | 280 | if($this->session->has("user") || $user == $this->session->get("user")->getId()){ |
281 | 281 | return true; |
282 | - }else{ |
|
282 | + } else{ |
|
283 | 283 | return false; |
284 | 284 | } |
285 | 285 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | public function isAdminAndActual($user){ |
288 | 288 | if($this->isAdmin($user) || $this->isActual($user)){ |
289 | 289 | return true; |
290 | - }else{ |
|
290 | + } else{ |
|
291 | 291 | return false; |
292 | 292 | } |
293 | 293 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $buttonFrm->onClick($dialog->jsShow()); |
33 | 33 | |
34 | 34 | $this->jquery->compile($this->view); |
35 | - }else { |
|
35 | + } else { |
|
36 | 36 | $this->view->pick("main/error"); |
37 | 37 | } |
38 | 38 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | )); |
48 | 48 | $idproj = $projet->getId(); |
49 | 49 | $this->response->redirect("Projets/read/$idproj"); |
50 | - }else { |
|
50 | + } else { |
|
51 | 51 | $this->view->pick("main/error"); |
52 | 52 | } |
53 | 53 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | //Compilation de Jquery dans la vue |
110 | 110 | $this->jquery->compile($this->view); |
111 | - }else { |
|
111 | + } else { |
|
112 | 112 | $this->view->pick("main/error"); |
113 | 113 | } |
114 | 114 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $contributor = array_unique($contributor, SORT_REGULAR); |
244 | 244 | |
245 | 245 | $this->view->setVar("contributors", $contributor); |
246 | - $this->view->setVar("usecases", $usecases);; |
|
246 | + $this->view->setVar("usecases", $usecases); ; |
|
247 | 247 | |
248 | 248 | } |
249 | 249 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $buttonFrm->onClick($dialog->jsShow()); |
33 | 33 | |
34 | 34 | $this->jquery->compile($this->view); |
35 | - }else { |
|
35 | + } else { |
|
36 | 36 | $this->view->pick("main/error"); |
37 | 37 | } |
38 | 38 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | )); |
48 | 48 | $idproj = $projet->getId(); |
49 | 49 | $this->response->redirect("Projets/read/$idproj"); |
50 | - }else { |
|
50 | + } else { |
|
51 | 51 | $this->view->pick("main/error"); |
52 | 52 | } |
53 | 53 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | //Compilation de Jquery dans la vue |
110 | 110 | $this->jquery->compile($this->view); |
111 | - }else { |
|
111 | + } else { |
|
112 | 112 | $this->view->pick("main/error"); |
113 | 113 | } |
114 | 114 | } |
@@ -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 |
@@ -24,30 +24,30 @@ discard block |
||
24 | 24 | public function signInAction() { |
25 | 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())) { |
|
33 | + if ($userPseudo != NULL && password_verify($_POST['password'], $userPseudo->getPassword())) { |
|
34 | 34 | $this->session->set("user", $userPseudo); |
35 | 35 | $this->response->redirect("Index/index"); |
36 | 36 | $this->loadAclAction($userPseudo->getIdTypeUser()); |
37 | - } else if($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) { |
|
37 | + } else if ($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) { |
|
38 | 38 | $this->session->set("user", $userMail); |
39 | 39 | $this->response->redirect("Index/index"); |
40 | 40 | $this->loadAclAction($userMail->getIdTypeUser()); |
41 | 41 | } else { |
42 | - echo $bootstrap->htmlAlert("alert1","L'identifiant ou le mot de passe est incorrecte."); |
|
42 | + echo $bootstrap->htmlAlert("alert1", "L'identifiant ou le mot de passe est incorrecte."); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 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"); |
|
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 | 51 | echo $accordion; |
52 | 52 | } |
53 | 53 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->jquery->compile($this->view); |
76 | 76 | |
77 | - }else { |
|
77 | + } else { |
|
78 | 78 | $this->view->pick("main/error"); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - public function passwordAction(){ |
|
82 | + public function passwordAction() { |
|
83 | 83 | $password = password_hash("password", PASSWORD_DEFAULT); |
84 | 84 | echo $password; |
85 | 85 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | |
75 | 75 | $this->jquery->compile($this->view); |
76 | 76 | |
77 | - }else { |
|
77 | + } else { |
|
78 | 78 | $this->view->pick("main/error"); |
79 | 79 | } |
80 | 80 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | return parent::findFirst($parameters); |
162 | 162 | } |
163 | 163 | |
164 | - public function toString(){ |
|
165 | - return " ".$this->getRessource()->getLibelle()." accessible par ".$this->getTypeUser()->getLibelle()." en droit '".$this->getOperation()->getOperation()."'"; |
|
164 | + public function toString() { |
|
165 | + return " " . $this->getRessource()->getLibelle() . " accessible par " . $this->getTypeUser()->getLibelle() . " en droit '" . $this->getOperation()->getOperation() . "'"; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | \ No newline at end of file |