Parcourir la source

switching gorup permissions to pivot

tags/0.1.0
Robin Thoni il y a 8 ans
Parent
révision
2d4a6052f4

+ 2
- 2
src/Auth/DataAccess/LuticatePermissionsGroupsDataAccess.php Voir le fichier

@@ -43,10 +43,10 @@ class LuticatePermissionsGroupsDataAccess extends LuDataAccess {
43 43
 
44 44
     public static function edit($group_id, $permission_name, $permission_value)
45 45
     {
46
-        $perm = self::getModelByName($group_id, $permission_name);
46
+        /*$perm = self::getModelByName($group_id, $permission_name);
47 47
         if (is_null($perm))
48 48
             return;
49 49
         $perm->value = $permission_value;
50
-        $perm->save();
50
+        $perm->save();*/
51 51
     }
52 52
 }

+ 9
- 0
src/Auth/DataAccess/Models/LuticatePermissionsGroups.php Voir le fichier

@@ -0,0 +1,9 @@
1
+<?php
2
+
3
+namespace Luticate\Auth\DataAccess\Models;
4
+
5
+use Luticate\Auth\DBO\LuticatePermissionsGroupsDbo;
6
+
7
+class LuticatePermissionsGroups extends LuticatePermissionsGroupsModel
8
+{
9
+}

+ 51
- 0
src/Auth/DataAccess/Models/LuticatePermissionsGroupsModel.php Voir le fichier

@@ -0,0 +1,51 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ * DO NOT DIRECTLY USE THIS FILE
7
+ * USE LuticatePermissionsGroups.php
8
+ * TO MAKE YOUR CHANGES AND DATABASE ACCESS
9
+*/
10
+
11
+namespace Luticate\Auth\DataAccess\Models;
12
+
13
+use Luticate\Utils\LuModel;
14
+use Luticate\Auth\DBO\LuticatePermissionsGroupsDbo;
15
+
16
+class LuticatePermissionsGroupsModel extends LuModel
17
+{
18
+    function __construct()
19
+    {
20
+        parent::__construct();
21
+        $this->timestamps = false;
22
+    }
23
+
24
+    public function toDbo()
25
+    {
26
+        $dbo = new LuticatePermissionsGroupsDbo();
27
+
28
+        $dbo->setName($this->name);
29
+        $dbo->setValue($this->value);
30
+        $dbo->setGroupId($this->group_id);
31
+
32
+        return $dbo;
33
+    }
34
+
35
+    /**
36
+     * @param $dbo LuticatePermissionsGroupsDbo
37
+     * @param $model LuModel|null
38
+     * @return LuticatePermissionsGroups
39
+     */
40
+    public function fromDbo($dbo, $model = null)
41
+    {
42
+        if (is_null($model))
43
+            $model = new LuticatePermissionsGroups();
44
+
45
+        $model->name = $dbo->getName();
46
+        $model->value = $dbo->getValue();
47
+        $model->group_id = $dbo->getGroupId();
48
+
49
+        return $model;
50
+    }
51
+}

+ 9
- 0
src/Auth/DataAccess/Models/LuticatePermissionsUsers.php Voir le fichier

@@ -0,0 +1,9 @@
1
+<?php
2
+
3
+namespace Luticate\Auth\DataAccess\Models;
4
+
5
+use Luticate\Auth\DBO\LuticatePermissionsUsersDbo;
6
+
7
+class LuticatePermissionsUsers extends LuticatePermissionsUsersModel
8
+{
9
+}

+ 51
- 0
src/Auth/DataAccess/Models/LuticatePermissionsUsersModel.php Voir le fichier

@@ -0,0 +1,51 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ * DO NOT DIRECTLY USE THIS FILE
7
+ * USE LuticatePermissionsUsers.php
8
+ * TO MAKE YOUR CHANGES AND DATABASE ACCESS
9
+*/
10
+
11
+namespace Luticate\Auth\DataAccess\Models;
12
+
13
+use Luticate\Utils\LuModel;
14
+use Luticate\Auth\DBO\LuticatePermissionsUsersDbo;
15
+
16
+class LuticatePermissionsUsersModel extends LuModel
17
+{
18
+    function __construct()
19
+    {
20
+        parent::__construct();
21
+        $this->timestamps = false;
22
+    }
23
+
24
+    public function toDbo()
25
+    {
26
+        $dbo = new LuticatePermissionsUsersDbo();
27
+
28
+        $dbo->setName($this->name);
29
+        $dbo->setValue($this->value);
30
+        $dbo->setUserId($this->user_id);
31
+
32
+        return $dbo;
33
+    }
34
+
35
+    /**
36
+     * @param $dbo LuticatePermissionsUsersDbo
37
+     * @param $model LuModel|null
38
+     * @return LuticatePermissionsUsers
39
+     */
40
+    public function fromDbo($dbo, $model = null)
41
+    {
42
+        if (is_null($model))
43
+            $model = new LuticatePermissionsUsers();
44
+
45
+        $model->name = $dbo->getName();
46
+        $model->value = $dbo->getValue();
47
+        $model->user_id = $dbo->getUserId();
48
+
49
+        return $model;
50
+    }
51
+}

Chargement…
Annuler
Enregistrer