Browse Source

updated generator

tags/0.1.2
Robin Thoni 9 years ago
parent
commit
0aa1b8e6bd

+ 234
- 11
composer.lock View File

@@ -51,13 +51,187 @@
51 51
             "homepage": "https://github.com/firebase/php-jwt",
52 52
             "time": "2015-06-22 23:26:39"
53 53
         },
54
+        {
55
+            "name": "guzzlehttp/guzzle",
56
+            "version": "6.1.1",
57
+            "source": {
58
+                "type": "git",
59
+                "url": "https://github.com/guzzle/guzzle.git",
60
+                "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c"
61
+            },
62
+            "dist": {
63
+                "type": "zip",
64
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/c6851d6e48f63b69357cbfa55bca116448140e0c",
65
+                "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c",
66
+                "shasum": ""
67
+            },
68
+            "require": {
69
+                "guzzlehttp/promises": "~1.0",
70
+                "guzzlehttp/psr7": "~1.1",
71
+                "php": ">=5.5.0"
72
+            },
73
+            "require-dev": {
74
+                "ext-curl": "*",
75
+                "phpunit/phpunit": "~4.0",
76
+                "psr/log": "~1.0"
77
+            },
78
+            "type": "library",
79
+            "extra": {
80
+                "branch-alias": {
81
+                    "dev-master": "6.1-dev"
82
+                }
83
+            },
84
+            "autoload": {
85
+                "files": [
86
+                    "src/functions_include.php"
87
+                ],
88
+                "psr-4": {
89
+                    "GuzzleHttp\\": "src/"
90
+                }
91
+            },
92
+            "notification-url": "https://packagist.org/downloads/",
93
+            "license": [
94
+                "MIT"
95
+            ],
96
+            "authors": [
97
+                {
98
+                    "name": "Michael Dowling",
99
+                    "email": "mtdowling@gmail.com",
100
+                    "homepage": "https://github.com/mtdowling"
101
+                }
102
+            ],
103
+            "description": "Guzzle is a PHP HTTP client library",
104
+            "homepage": "http://guzzlephp.org/",
105
+            "keywords": [
106
+                "client",
107
+                "curl",
108
+                "framework",
109
+                "http",
110
+                "http client",
111
+                "rest",
112
+                "web service"
113
+            ],
114
+            "time": "2015-11-23 00:47:50"
115
+        },
116
+        {
117
+            "name": "guzzlehttp/promises",
118
+            "version": "1.0.3",
119
+            "source": {
120
+                "type": "git",
121
+                "url": "https://github.com/guzzle/promises.git",
122
+                "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
123
+            },
124
+            "dist": {
125
+                "type": "zip",
126
+                "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
127
+                "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
128
+                "shasum": ""
129
+            },
130
+            "require": {
131
+                "php": ">=5.5.0"
132
+            },
133
+            "require-dev": {
134
+                "phpunit/phpunit": "~4.0"
135
+            },
136
+            "type": "library",
137
+            "extra": {
138
+                "branch-alias": {
139
+                    "dev-master": "1.0-dev"
140
+                }
141
+            },
142
+            "autoload": {
143
+                "psr-4": {
144
+                    "GuzzleHttp\\Promise\\": "src/"
145
+                },
146
+                "files": [
147
+                    "src/functions_include.php"
148
+                ]
149
+            },
150
+            "notification-url": "https://packagist.org/downloads/",
151
+            "license": [
152
+                "MIT"
153
+            ],
154
+            "authors": [
155
+                {
156
+                    "name": "Michael Dowling",
157
+                    "email": "mtdowling@gmail.com",
158
+                    "homepage": "https://github.com/mtdowling"
159
+                }
160
+            ],
161
+            "description": "Guzzle promises library",
162
+            "keywords": [
163
+                "promise"
164
+            ],
165
+            "time": "2015-10-15 22:28:00"
166
+        },
167
+        {
168
+            "name": "guzzlehttp/psr7",
169
+            "version": "1.2.1",
170
+            "source": {
171
+                "type": "git",
172
+                "url": "https://github.com/guzzle/psr7.git",
173
+                "reference": "4d0bdbe1206df7440219ce14c972aa57cc5e4982"
174
+            },
175
+            "dist": {
176
+                "type": "zip",
177
+                "url": "https://api.github.com/repos/guzzle/psr7/zipball/4d0bdbe1206df7440219ce14c972aa57cc5e4982",
178
+                "reference": "4d0bdbe1206df7440219ce14c972aa57cc5e4982",
179
+                "shasum": ""
180
+            },
181
+            "require": {
182
+                "php": ">=5.4.0",
183
+                "psr/http-message": "~1.0"
184
+            },
185
+            "provide": {
186
+                "psr/http-message-implementation": "1.0"
187
+            },
188
+            "require-dev": {
189
+                "phpunit/phpunit": "~4.0"
190
+            },
191
+            "type": "library",
192
+            "extra": {
193
+                "branch-alias": {
194
+                    "dev-master": "1.0-dev"
195
+                }
196
+            },
197
+            "autoload": {
198
+                "psr-4": {
199
+                    "GuzzleHttp\\Psr7\\": "src/"
200
+                },
201
+                "files": [
202
+                    "src/functions_include.php"
203
+                ]
204
+            },
205
+            "notification-url": "https://packagist.org/downloads/",
206
+            "license": [
207
+                "MIT"
208
+            ],
209
+            "authors": [
210
+                {
211
+                    "name": "Michael Dowling",
212
+                    "email": "mtdowling@gmail.com",
213
+                    "homepage": "https://github.com/mtdowling"
214
+                }
215
+            ],
216
+            "description": "PSR-7 message implementation",
217
+            "keywords": [
218
+                "http",
219
+                "message",
220
+                "stream",
221
+                "uri"
222
+            ],
223
+            "time": "2015-11-03 01:34:55"
224
+        },
54 225
         {
55 226
             "name": "luticate/utils",
56
-            "version": "0.1.1",
227
+            "version": "0.1.3",
57 228
             "source": {
58 229
                 "type": "git",
59 230
                 "url": "https://git.rthoni.com/luticate/utils.git",
60
-                "reference": "8965564e6a6b329918ba7e4e9ebcfc9e98f71edc"
231
+                "reference": "c76d9e46c4388bbecf6274f5361d8e71df79bfda"
232
+            },
233
+            "require": {
234
+                "guzzlehttp/guzzle": "^6.1"
61 235
             },
62 236
             "type": "library",
63 237
             "autoload": {
@@ -72,17 +246,66 @@
72 246
                 }
73 247
             ],
74 248
             "description": "Luticate user management system utils",
75
-            "time": "2015-11-12 14:55:00"
249
+            "time": "2016-01-10 23:00:22"
250
+        },
251
+        {
252
+            "name": "psr/http-message",
253
+            "version": "1.0",
254
+            "source": {
255
+                "type": "git",
256
+                "url": "https://github.com/php-fig/http-message.git",
257
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
258
+            },
259
+            "dist": {
260
+                "type": "zip",
261
+                "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
262
+                "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
263
+                "shasum": ""
264
+            },
265
+            "require": {
266
+                "php": ">=5.3.0"
267
+            },
268
+            "type": "library",
269
+            "extra": {
270
+                "branch-alias": {
271
+                    "dev-master": "1.0.x-dev"
272
+                }
273
+            },
274
+            "autoload": {
275
+                "psr-4": {
276
+                    "Psr\\Http\\Message\\": "src/"
277
+                }
278
+            },
279
+            "notification-url": "https://packagist.org/downloads/",
280
+            "license": [
281
+                "MIT"
282
+            ],
283
+            "authors": [
284
+                {
285
+                    "name": "PHP-FIG",
286
+                    "homepage": "http://www.php-fig.org/"
287
+                }
288
+            ],
289
+            "description": "Common interface for HTTP messages",
290
+            "keywords": [
291
+                "http",
292
+                "http-message",
293
+                "psr",
294
+                "psr-7",
295
+                "request",
296
+                "response"
297
+            ],
298
+            "time": "2015-05-04 20:22:00"
76 299
         }
77 300
     ],
78 301
     "packages-dev": [
79 302
         {
80 303
             "name": "luticate/generator",
81
-            "version": "0.1.2",
304
+            "version": "0.1.3",
82 305
             "source": {
83 306
                 "type": "git",
84 307
                 "url": "https://git.rthoni.com/luticate/generator.git",
85
-                "reference": "5940633ab6ea37df3999e00d0819ead21925e710"
308
+                "reference": "c279bf6e2e92789be374012ff49fb38f531dfd76"
86 309
             },
87 310
             "require": {
88 311
                 "luticate/utils": "0.1.x",
@@ -102,20 +325,20 @@
102 325
                 }
103 326
             ],
104 327
             "description": "Luticate user management system code generator",
105
-            "time": "2015-11-12 15:21:28"
328
+            "time": "2016-01-13 22:10:56"
106 329
         },
107 330
         {
108 331
             "name": "twig/twig",
109
-            "version": "v1.23.1",
332
+            "version": "v1.23.3",
110 333
             "source": {
111 334
                 "type": "git",
112 335
                 "url": "https://github.com/twigphp/Twig.git",
113
-                "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6"
336
+                "reference": "ae53fc2c312fdee63773b75cb570304f85388b08"
114 337
             },
115 338
             "dist": {
116 339
                 "type": "zip",
117
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
118
-                "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
340
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/ae53fc2c312fdee63773b75cb570304f85388b08",
341
+                "reference": "ae53fc2c312fdee63773b75cb570304f85388b08",
119 342
                 "shasum": ""
120 343
             },
121 344
             "require": {
@@ -163,7 +386,7 @@
163 386
             "keywords": [
164 387
                 "templating"
165 388
             ],
166
-            "time": "2015-11-05 12:49:06"
389
+            "time": "2016-01-11 14:02:19"
167 390
         },
168 391
         {
169 392
             "name": "vlucas/phpdotenv",

+ 20
- 0
src/Auth/DBO/LuticateGroupsDbo.php View File

@@ -19,6 +19,26 @@ class LuticateGroupsDbo extends LuDbo {
19 19
         );
20 20
     }
21 21
 
22
+    public static function jsonDeserialize($json)
23
+    {
24
+        $dbo = new LuticateGroupsDbo();
25
+        if (isset($json["Id"])) {
26
+            $dbo->setId($json["Id"]);
27
+        }
28
+        if (isset($json["Name"])) {
29
+            $dbo->setName($json["Name"]);
30
+        }
31
+        return $dbo;
32
+    }
33
+
34
+    public static function generateSample()
35
+    {
36
+        $dbo = new LuticateGroupsDbo();
37
+        $dbo->setId(42);
38
+        $dbo->setName("sample string");
39
+        return $dbo;
40
+    }
41
+
22 42
     /**
23 43
      * @var integer
24 44
      */

+ 20
- 0
src/Auth/DBO/LuticatePermissionsDbo.php View File

@@ -19,6 +19,26 @@ class LuticatePermissionsDbo extends LuDbo {
19 19
         );
20 20
     }
21 21
 
22
+    public static function jsonDeserialize($json)
23
+    {
24
+        $dbo = new LuticatePermissionsDbo();
25
+        if (isset($json["Name"])) {
26
+            $dbo->setName($json["Name"]);
27
+        }
28
+        if (isset($json["Value"])) {
29
+            $dbo->setValue($json["Value"]);
30
+        }
31
+        return $dbo;
32
+    }
33
+
34
+    public static function generateSample()
35
+    {
36
+        $dbo = new LuticatePermissionsDbo();
37
+        $dbo->setName("sample string");
38
+        $dbo->setValue(true);
39
+        return $dbo;
40
+    }
41
+
22 42
     /**
23 43
      * @var string
24 44
      */

+ 24
- 0
src/Auth/DBO/LuticatePermissionsGroupsDbo.php View File

@@ -20,6 +20,30 @@ class LuticatePermissionsGroupsDbo extends LuDbo {
20 20
         );
21 21
     }
22 22
 
23
+    public static function jsonDeserialize($json)
24
+    {
25
+        $dbo = new LuticatePermissionsGroupsDbo();
26
+        if (isset($json["Name"])) {
27
+            $dbo->setName($json["Name"]);
28
+        }
29
+        if (isset($json["Value"])) {
30
+            $dbo->setValue($json["Value"]);
31
+        }
32
+        if (isset($json["GroupId"])) {
33
+            $dbo->setGroupId($json["GroupId"]);
34
+        }
35
+        return $dbo;
36
+    }
37
+
38
+    public static function generateSample()
39
+    {
40
+        $dbo = new LuticatePermissionsGroupsDbo();
41
+        $dbo->setName("sample string");
42
+        $dbo->setValue(true);
43
+        $dbo->setGroupId(42);
44
+        return $dbo;
45
+    }
46
+
23 47
     /**
24 48
      * @var string
25 49
      */

+ 24
- 0
src/Auth/DBO/LuticatePermissionsUsersDbo.php View File

@@ -20,6 +20,30 @@ class LuticatePermissionsUsersDbo extends LuDbo {
20 20
         );
21 21
     }
22 22
 
23
+    public static function jsonDeserialize($json)
24
+    {
25
+        $dbo = new LuticatePermissionsUsersDbo();
26
+        if (isset($json["Name"])) {
27
+            $dbo->setName($json["Name"]);
28
+        }
29
+        if (isset($json["Value"])) {
30
+            $dbo->setValue($json["Value"]);
31
+        }
32
+        if (isset($json["UserId"])) {
33
+            $dbo->setUserId($json["UserId"]);
34
+        }
35
+        return $dbo;
36
+    }
37
+
38
+    public static function generateSample()
39
+    {
40
+        $dbo = new LuticatePermissionsUsersDbo();
41
+        $dbo->setName("sample string");
42
+        $dbo->setValue(true);
43
+        $dbo->setUserId(42);
44
+        return $dbo;
45
+    }
46
+
23 47
     /**
24 48
      * @var string
25 49
      */

+ 44
- 0
src/Auth/DBO/LuticateUsersDbo.php View File

@@ -25,6 +25,50 @@ class LuticateUsersDbo extends LuDbo {
25 25
         );
26 26
     }
27 27
 
28
+    public static function jsonDeserialize($json)
29
+    {
30
+        $dbo = new LuticateUsersDbo();
31
+        if (isset($json["Id"])) {
32
+            $dbo->setId($json["Id"]);
33
+        }
34
+        if (isset($json["Username"])) {
35
+            $dbo->setUsername($json["Username"]);
36
+        }
37
+        if (isset($json["Email"])) {
38
+            $dbo->setEmail($json["Email"]);
39
+        }
40
+        if (isset($json["Password"])) {
41
+            $dbo->setPassword($json["Password"]);
42
+        }
43
+        if (isset($json["Salt"])) {
44
+            $dbo->setSalt($json["Salt"]);
45
+        }
46
+        if (isset($json["ProfileId"])) {
47
+            $dbo->setProfileId($json["ProfileId"]);
48
+        }
49
+        if (isset($json["Firstname"])) {
50
+            $dbo->setFirstname($json["Firstname"]);
51
+        }
52
+        if (isset($json["Lastname"])) {
53
+            $dbo->setLastname($json["Lastname"]);
54
+        }
55
+        return $dbo;
56
+    }
57
+
58
+    public static function generateSample()
59
+    {
60
+        $dbo = new LuticateUsersDbo();
61
+        $dbo->setId(42);
62
+        $dbo->setUsername("sample string");
63
+        $dbo->setEmail("sample string");
64
+        $dbo->setPassword("sample string");
65
+        $dbo->setSalt("sample string");
66
+        $dbo->setProfileId(42);
67
+        $dbo->setFirstname("sample string");
68
+        $dbo->setLastname("sample string");
69
+        return $dbo;
70
+    }
71
+
28 72
     /**
29 73
      * @var integer
30 74
      */

+ 18
- 1
src/Auth/DataAccess/SP/SpLuGetAllUserPermission.php View File

@@ -8,6 +8,8 @@
8 8
 namespace Luticate\Auth\DataAccess\SP;
9 9
 
10 10
 use Luticate\Utils\LuSpModel;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
11 13
 use Illuminate\Support\Facades\DB;
12 14
 
13 15
 class SpLuGetAllUserPermission extends LuSpModel {
@@ -24,15 +26,30 @@ class SpLuGetAllUserPermission extends LuSpModel {
24 26
         return $dbo;
25 27
     }
26 28
 
29
+
27 30
     public static function execute($_user_id)
28 31
     {
29
-        $values = DB::select('SELECT * FROM sp_lu_get_all_user_permission(?)', array($_user_id));
32
+        $values = DB::select('SELECT * FROM sp_lu_get_all_user_permission(:_user_id)', array(":_user_id" => $_user_id));
30 33
         $dboValues = array();
31 34
         foreach ($values as $value)
32 35
             $dboValues[] = self::damToDbo($value);
33 36
         return $dboValues;
34 37
     }
35 38
 
39
+    public static function getMultipleJson($_user_id, $page, $perPage)
40
+    {
41
+        $values = DB::select('SELECT (SELECT count(*) FROM sp_lu_get_all_user_permission(:_user_id)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_lu_get_all_user_permission(:_user_id) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
42
+            array(":_user_id" => $_user_id, ":page" => $page, ":perPage" => $perPage));
43
+        $value = $values[0];
44
+        if (is_null($value->data))
45
+        {
46
+            $value->data = '[]';
47
+        }
48
+        $data = LuStringUtils::convertJsonString($value->data);
49
+        return new LuMultipleDbo($value->count, $data);
50
+    }
51
+
52
+
36 53
     /**
37 54
     * @var string
38 55
     */

+ 6
- 1
src/Auth/DataAccess/SP/SpLuGetUserPermission.php View File

@@ -8,6 +8,8 @@
8 8
 namespace Luticate\Auth\DataAccess\SP;
9 9
 
10 10
 use Luticate\Utils\LuSpModel;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
11 13
 use Illuminate\Support\Facades\DB;
12 14
 
13 15
 class SpLuGetUserPermission extends LuSpModel {
@@ -23,12 +25,15 @@ class SpLuGetUserPermission extends LuSpModel {
23 25
         return $dbo;
24 26
     }
25 27
 
28
+
26 29
     public static function execute($_user_id, $_permisson_name)
27 30
     {
28
-        $values = DB::select('SELECT * FROM sp_lu_get_user_permission(?, ?)', array($_user_id, $_permisson_name));
31
+        $values = DB::select('SELECT * FROM sp_lu_get_user_permission(:_user_id, :_permisson_name)', array(":_user_id" => $_user_id, ":_permisson_name" => $_permisson_name));
29 32
         return self::damToDbo($values[0]);
30 33
     }
31 34
 
35
+
36
+
32 37
     /**
33 38
     * @var boolean
34 39
     */

Loading…
Cancel
Save