Completed
Branch users (0e1b94)
by Hugo
02:37
created
app/config/services.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@
 block discarded – undo
63 63
         'username' => $config->database->username,
64 64
         'password' => $config->database->password,
65 65
         'dbname' => $config->database->dbname,
66
-    		'options' => array(
67
-    				PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
68
-    		)
66
+      'options' => array(
67
+        PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
68
+      )
69 69
     ));
70 70
 });
71 71
 
Please login to merge, or discard this patch.
app/models/TypeUser.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
     }
104 104
     
105 105
     public function toString() {
106
-    	return $this->libelle;
106
+     return $this->libelle;
107 107
     }
108 108
 
109 109
 }
Please login to merge, or discard this patch.
app/models/Operation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
     }
103 103
     
104 104
     public function toString() {
105
-    	return $this->operation;
105
+     return $this->operation;
106 106
     }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
app/models/Ressource.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
     }
103 103
     
104 104
     public function toString() {
105
-    	return $this->libelle;
105
+     return $this->libelle;
106 106
     }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
app/controllers/UsersController.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,47 +21,47 @@
 block discarded – undo
21 21
     }
22 22
     
23 23
     public function signInAction() {
24
-    	$bootstrap = $this->jquery->bootstrap();
24
+     $bootstrap = $this->jquery->bootstrap();
25 25
     	 
26
-    	if(!empty($_POST['identite']) && !empty($_POST['password'])) {
26
+     if(!empty($_POST['identite']) && !empty($_POST['password'])) {
27 27
     		
28
-    		$userPseudo = User::findFirst("identite = '".$_POST['identite']."'");
28
+      $userPseudo = User::findFirst("identite = '".$_POST['identite']."'");
29 29
 
30
-    		$userMail = User::findFirst("mail = '".$_POST['identite']."'");
30
+      $userMail = User::findFirst("mail = '".$_POST['identite']."'");
31 31
     	
32
-    		if($userPseudo != NULL && password_verify($_POST['password'], $userPseudo->getPassword())) {
33
-    			$this->session->set("user", $userPseudo);
34
-    			$this->response->redirect("Index/index");
35
-    			$this->loadAclAction($userPseudo->getRole());
36
-    		} else if($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) {
37
-    			$this->session->set("user", $userMail);
38
-    			$this->response->redirect("Index/index");
39
-    			$this->loadAclAction($userMail->getRole());
40
-    		} else {
41
-    			echo $bootstrap->htmlAlert("alert1","L'identifiant ou le mot de passe est incorrecte.");
42
-    		}
43
-    	}
32
+      if($userPseudo != NULL && password_verify($_POST['password'], $userPseudo->getPassword())) {
33
+       $this->session->set("user", $userPseudo);
34
+       $this->response->redirect("Index/index");
35
+       $this->loadAclAction($userPseudo->getRole());
36
+      } else if($userMail != NULL && password_verify($_POST['password'], $userMail->getPassword())) {
37
+       $this->session->set("user", $userMail);
38
+       $this->response->redirect("Index/index");
39
+       $this->loadAclAction($userMail->getRole());
40
+      } else {
41
+       echo $bootstrap->htmlAlert("alert1","L'identifiant ou le mot de passe est incorrecte.");
42
+      }
43
+     }
44 44
     }
45 45
     
46 46
     public function loadAclAction($typeUser) {
47
-    	$acl = new AclList();
48
-    	$acl->setDefaultAction(Phalcon\Acl::DENY);
49
-    	$roleBdd = TypeUser::findFirst("id = ".$typeUser);
47
+     $acl = new AclList();
48
+     $acl->setDefaultAction(Phalcon\Acl::DENY);
49
+     $roleBdd = TypeUser::findFirst("id = ".$typeUser);
50 50
     	
51
-    	$aclsBdd = Acl::find("idTypeUser = ".$typeUser);
52
-    	foreach ($aclsBdd as $aclBdd) {
53
-    		$role = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser());
54
-    		$ressource = Ressource::findFirst("id = ".$aclBdd->getIdRessource());
55
-    		$operation = Operation::findFirst("id = ".$aclBdd->getIdOperation());
56
-    		$acl->addRole(new Role($role->getLibelle()));
57
-    		$acl->addResource(new Resource($ressource->getLibelle(), $operation->getOperation()));
58
-    	}
51
+     $aclsBdd = Acl::find("idTypeUser = ".$typeUser);
52
+     foreach ($aclsBdd as $aclBdd) {
53
+      $role = TypeUser::findFirst("id = ".$aclBdd->getIdTypeUser());
54
+      $ressource = Ressource::findFirst("id = ".$aclBdd->getIdRessource());
55
+      $operation = Operation::findFirst("id = ".$aclBdd->getIdOperation());
56
+      $acl->addRole(new Role($role->getLibelle()));
57
+      $acl->addResource(new Resource($ressource->getLibelle(), $operation->getOperation()));
58
+     }
59 59
     	
60
-	}
60
+ }
61 61
 	
62
-	public function readAction($id = NULL) {
62
+ public function readAction($id = NULL) {
63 63
 		
64
-	}
64
+ }
65 65
 
66 66
  
67 67
 
Please login to merge, or discard this patch.
app/controllers/TestController.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,25 +3,25 @@
 block discarded – undo
3 3
 class TestController extends \Phalcon\Mvc\Controller
4 4
 {
5 5
 
6
-	protected $model;
7
-	protected $title;
8
-	protected $controller;
6
+ protected $model;
7
+ protected $title;
8
+ protected $controller;
9 9
 	
10 10
     public function indexAction()
11 11
     {
12
-    	$operationsBdd = Operation::find();
13
-    	foreach ($operationsBdd as $operation) {
14
-    		$operations[] = $operation->getOperation();
15
-    	}
16
-    	foreach ($operations as $operation) {
17
-    		echo $operation;
18
-    	}
12
+     $operationsBdd = Operation::find();
13
+     foreach ($operationsBdd as $operation) {
14
+      $operations[] = $operation->getOperation();
15
+     }
16
+     foreach ($operations as $operation) {
17
+      echo $operation;
18
+     }
19 19
     }
20 20
 
21 21
     public function initialize() {
22
-    	$this->model="Test";
23
-    	$this->title="Test";
24
-    	$this->controller="Test";
22
+     $this->model="Test";
23
+     $this->title="Test";
24
+     $this->controller="Test";
25 25
     }
26 26
     
27 27
 }
Please login to merge, or discard this patch.