Browse Source

regenerated business and data access

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
14fa75e2e7

+ 2
- 2
src/Auth/Business/LuticateGroupsBusiness.php View File

@@ -7,8 +7,8 @@ use Luticate\Auth\DataAccess\LuticateGroupsDataAccess;
7 7
 use Luticate\Auth\DBO\LuticateGroupsDbo;
8 8
 
9 9
 class LuticateGroupsBusiness extends LuBusiness {
10
-    public function __construct()
10
+    protected static function getDataAccess()
11 11
     {
12
-        $this->dataAccess = new LuticateGroupsDataAccess();
12
+        return new LuticateGroupsDataAccess();
13 13
     }
14 14
 }

+ 2
- 2
src/Auth/Business/LuticatePermissionsBusiness.php View File

@@ -7,9 +7,9 @@ use Luticate\Auth\DataAccess\LuticatePermissionsDataAccess;
7 7
 use Luticate\Auth\DBO\LuticatePermissionsDbo;
8 8
 
9 9
 class LuticatePermissionsBusiness extends LuBusiness {
10
-    public function __construct()
10
+    protected static function getDataAccess()
11 11
     {
12
-        $this->dataAccess = new LuticatePermissionsDataAccess();
12
+        return new LuticatePermissionsDataAccess();
13 13
     }
14 14
 
15 15
     public static function getUserPermission($user_id, $permission_name)

+ 2
- 2
src/Auth/Business/LuticatePermissionsGroupsBusiness.php View File

@@ -7,8 +7,8 @@ use Luticate\Auth\DataAccess\LuticatePermissionsGroupsDataAccess;
7 7
 use Luticate\Auth\DBO\LuticatePermissionsGroupsDbo;
8 8
 
9 9
 class LuticatePermissionsGroupsBusiness extends LuBusiness {
10
-    public function __construct()
10
+    protected static function getDataAccess()
11 11
     {
12
-        $this->dataAccess = new LuticatePermissionsGroupsDataAccess();
12
+        return new LuticatePermissionsGroupsDataAccess();
13 13
     }
14 14
 }

+ 2
- 2
src/Auth/Business/LuticatePermissionsUsersBusiness.php View File

@@ -7,8 +7,8 @@ use Luticate\Auth\DataAccess\LuticatePermissionsUsersDataAccess;
7 7
 use Luticate\Auth\DBO\LuticatePermissionsUsersDbo;
8 8
 
9 9
 class LuticatePermissionsUsersBusiness extends LuBusiness {
10
-    public function __construct()
10
+    protected static function getDataAccess()
11 11
     {
12
-        $this->dataAccess = new LuticatePermissionsUsersDataAccess();
12
+        return new LuticatePermissionsUsersDataAccess();
13 13
     }
14 14
 }

+ 5
- 4
src/Auth/Business/LuticateUsersBusiness.php View File

@@ -15,9 +15,9 @@ class LuticateUsersBusiness extends LuBusiness {
15 15
 
16 16
     const TOKEN_HEADER = "X-Authentication";
17 17
 
18
-    public function __construct()
18
+    protected static function getDataAccess()
19 19
     {
20
-        $this->dataAccess = new LuticateUsersDataAccess();
20
+        return new LuticateUsersDataAccess();
21 21
     }
22 22
 
23 23
     public static function getCurrentUser()
@@ -37,7 +37,7 @@ class LuticateUsersBusiness extends LuBusiness {
37 37
             $data = JwtHelper::decode($token);
38 38
             if ($data != null) {
39 39
                 $user_id = $data[JwtHelper::USER_KEY];
40
-                self::$_currentUser = LuticateUsersBusiness::getById($user_id);
40
+                self::$_currentUser = self::getById($user_id);
41 41
             }
42 42
         }
43 43
 
@@ -46,7 +46,8 @@ class LuticateUsersBusiness extends LuBusiness {
46 46
         }
47 47
 
48 48
         foreach ($permissions as $permission) {
49
-            if (!LuticatePermissionsBusiness::getUserPermission(self::$_currentUser->getId(), $permission)) {
49
+            $value = LuticatePermissionsBusiness::getUserPermission(self::$_currentUser->getId(), $permission);
50
+            if (!$value->getVal()) {
50 51
                 return false;
51 52
             }
52 53
         }

+ 2
- 3
src/Auth/DataAccess/LuticateGroupsDataAccess.php View File

@@ -7,9 +7,8 @@ use Luticate\Auth\DataAccess\Models\LuticateGroups;
7 7
 use Luticate\Auth\DBO\LuticateGroupsDbo;
8 8
 
9 9
 class LuticateGroupsDataAccess extends LuDataAccess {
10
-    public function __construct()
10
+    protected static function getModel()
11 11
     {
12
-        parent::__construct();
13
-        $this->model = new LuticateGroups();
12
+        return new LuticateGroups();
14 13
     }
15 14
 }

+ 2
- 3
src/Auth/DataAccess/LuticatePermissionsDataAccess.php View File

@@ -8,10 +8,9 @@ use Luticate\Auth\DataAccess\Models\LuticatePermissions;
8 8
 use Luticate\Auth\DBO\LuticatePermissionsDbo;
9 9
 
10 10
 class LuticatePermissionsDataAccess extends LuDataAccess {
11
-    public function __construct()
11
+    protected static function getModel()
12 12
     {
13
-        parent::__construct();
14
-        $this->model = new LuticatePermissions();
13
+        return new LuticatePermissions();
15 14
     }
16 15
 
17 16
     public static function getUserPermission($user_id, $permission_name)

+ 2
- 3
src/Auth/DataAccess/LuticatePermissionsGroupsDataAccess.php View File

@@ -7,9 +7,8 @@ use Luticate\Auth\DataAccess\Models\LuticatePermissionsGroups;
7 7
 use Luticate\Auth\DBO\LuticatePermissionsGroupsDbo;
8 8
 
9 9
 class LuticatePermissionsGroupsDataAccess extends LuDataAccess {
10
-    public function __construct()
10
+    protected static function getModel()
11 11
     {
12
-        parent::__construct();
13
-        $this->model = new LuticatePermissionsGroups();
12
+        return new LuticatePermissionsGroups();
14 13
     }
15 14
 }

+ 2
- 3
src/Auth/DataAccess/LuticatePermissionsUsersDataAccess.php View File

@@ -7,9 +7,8 @@ use Luticate\Auth\DataAccess\Models\LuticatePermissionsUsers;
7 7
 use Luticate\Auth\DBO\LuticatePermissionsUsersDbo;
8 8
 
9 9
 class LuticatePermissionsUsersDataAccess extends LuDataAccess {
10
-    public function __construct()
10
+    protected static function getModel()
11 11
     {
12
-        parent::__construct();
13
-        $this->model = new LuticatePermissionsUsers();
12
+        return new LuticatePermissionsUsers();
14 13
     }
15 14
 }

+ 2
- 3
src/Auth/DataAccess/LuticateUsersDataAccess.php View File

@@ -7,9 +7,8 @@ use Luticate\Auth\DataAccess\Models\LuticateUsers;
7 7
 use Luticate\Auth\DBO\LuticateUsersDbo;
8 8
 
9 9
 class LuticateUsersDataAccess extends LuDataAccess {
10
-    public function __construct()
10
+    protected static function getModel()
11 11
     {
12
-        parent::__construct();
13
-        $this->model = new LuticateUsers();
12
+        return new LuticateUsers();
14 13
     }
15 14
 }

Loading…
Cancel
Save