Browse Source

users filter

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
c4d93b938a

+ 19
- 19
composer.lock View File

@@ -73,7 +73,7 @@
73 73
             },
74 74
             "dist": {
75 75
                 "type": "zip",
76
-                "url": "https://api.github.com/repos/doctrine/inflector/zipball/097e7ba84f64a427e55008117ef2bb94096731dc",
76
+                "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
77 77
                 "reference": "097e7ba84f64a427e55008117ef2bb94096731dc",
78 78
                 "shasum": ""
79 79
             },
@@ -184,7 +184,7 @@
184 184
             },
185 185
             "dist": {
186 186
                 "type": "zip",
187
-                "url": "https://api.github.com/repos/illuminate/auth/zipball/2f690d900e495bda1a06510679ca28a52da46886",
187
+                "url": "https://api.github.com/repos/illuminate/auth/zipball/afa17b2822548b6e9a9be194026cf26e7483edfc",
188 188
                 "reference": "2f690d900e495bda1a06510679ca28a52da46886",
189 189
                 "shasum": ""
190 190
             },
@@ -234,7 +234,7 @@
234 234
             },
235 235
             "dist": {
236 236
                 "type": "zip",
237
-                "url": "https://api.github.com/repos/illuminate/broadcasting/zipball/380fc9abf16c7deba4a21d834e8b6c97bf0a5fe5",
237
+                "url": "https://api.github.com/repos/illuminate/broadcasting/zipball/1fc8d3f26e72ee7efb0f514666caa2e5b178641f",
238 238
                 "reference": "380fc9abf16c7deba4a21d834e8b6c97bf0a5fe5",
239 239
                 "shasum": ""
240 240
             },
@@ -326,7 +326,7 @@
326 326
             },
327 327
             "dist": {
328 328
                 "type": "zip",
329
-                "url": "https://api.github.com/repos/illuminate/cache/zipball/152e05d328cb4f1e86a6eca2d3240f74087895f1",
329
+                "url": "https://api.github.com/repos/illuminate/cache/zipball/16629fa6feb7ad787447b280b8a553a6d94f0647",
330 330
                 "reference": "152e05d328cb4f1e86a6eca2d3240f74087895f1",
331 331
                 "shasum": ""
332 332
             },
@@ -421,7 +421,7 @@
421 421
             },
422 422
             "dist": {
423 423
                 "type": "zip",
424
-                "url": "https://api.github.com/repos/illuminate/console/zipball/eaaa4da6e32a96e1b2498d8a13102691b56c4bb3",
424
+                "url": "https://api.github.com/repos/illuminate/console/zipball/591f4b6e462ec1526d1b0a87671a8862ff414884",
425 425
                 "reference": "eaaa4da6e32a96e1b2498d8a13102691b56c4bb3",
426 426
                 "shasum": ""
427 427
             },
@@ -756,7 +756,7 @@
756 756
             },
757 757
             "dist": {
758 758
                 "type": "zip",
759
-                "url": "https://api.github.com/repos/illuminate/filesystem/zipball/7946418d6a31222627504e7aa84c1f8671c9b315",
759
+                "url": "https://api.github.com/repos/illuminate/filesystem/zipball/e57f55dc8c791022dd5bb3dcff00ed718383763f",
760 760
                 "reference": "7946418d6a31222627504e7aa84c1f8671c9b315",
761 761
                 "shasum": ""
762 762
             },
@@ -1092,7 +1092,7 @@
1092 1092
             },
1093 1093
             "dist": {
1094 1094
                 "type": "zip",
1095
-                "url": "https://api.github.com/repos/illuminate/support/zipball/c8e9aad1e06cb159e5f082b16037366b7a0409c6",
1095
+                "url": "https://api.github.com/repos/illuminate/support/zipball/122ae4aef069eb951033e59f98d8025864584578",
1096 1096
                 "reference": "c8e9aad1e06cb159e5f082b16037366b7a0409c6",
1097 1097
                 "shasum": ""
1098 1098
             },
@@ -1146,7 +1146,7 @@
1146 1146
             },
1147 1147
             "dist": {
1148 1148
                 "type": "zip",
1149
-                "url": "https://api.github.com/repos/illuminate/translation/zipball/36d05eccee1f9f6692cc5126c60873d02452fb21",
1149
+                "url": "https://api.github.com/repos/illuminate/translation/zipball/2e1e15c1dc4409ac7d4ecddc6f4118d192443720",
1150 1150
                 "reference": "36d05eccee1f9f6692cc5126c60873d02452fb21",
1151 1151
                 "shasum": ""
1152 1152
             },
@@ -1191,7 +1191,7 @@
1191 1191
             },
1192 1192
             "dist": {
1193 1193
                 "type": "zip",
1194
-                "url": "https://api.github.com/repos/illuminate/validation/zipball/f2234790f5d4e638763a30f56d0eda9cb2eefed6",
1194
+                "url": "https://api.github.com/repos/illuminate/validation/zipball/69601ff9aeec665981f30ee3f6be9d2a9de93779",
1195 1195
                 "reference": "f2234790f5d4e638763a30f56d0eda9cb2eefed6",
1196 1196
                 "shasum": ""
1197 1197
             },
@@ -1288,7 +1288,7 @@
1288 1288
             },
1289 1289
             "dist": {
1290 1290
                 "type": "zip",
1291
-                "url": "https://api.github.com/repos/laravel/lumen-framework/zipball/caf37c0b556f3bb52dad3ef0efff7b297c9ad6cd",
1291
+                "url": "https://api.github.com/repos/laravel/lumen-framework/zipball/07d00687ab1566165c7206b0c38ca78c0b7171ea",
1292 1292
                 "reference": "caf37c0b556f3bb52dad3ef0efff7b297c9ad6cd",
1293 1293
                 "shasum": ""
1294 1294
             },
@@ -1370,7 +1370,7 @@
1370 1370
             "source": {
1371 1371
                 "type": "git",
1372 1372
                 "url": "https://git.rthoni.com/luticate/utils.git",
1373
-                "reference": "1231cd8daf04eca735d08da6c0a786623fa91af8"
1373
+                "reference": "90cb2dc56aacf32443c2bfcbfb7fa80d8d54fb2e"
1374 1374
             },
1375 1375
             "require": {
1376 1376
                 "laravel/lumen-framework": "5.1.x-dev"
@@ -1388,7 +1388,7 @@
1388 1388
                 }
1389 1389
             ],
1390 1390
             "description": "Luticate user management system utils",
1391
-            "time": "2015-10-31 15:42:26"
1391
+            "time": "2015-11-08 13:38:43"
1392 1392
         },
1393 1393
         {
1394 1394
             "name": "monolog/monolog",
@@ -1702,7 +1702,7 @@
1702 1702
             },
1703 1703
             "dist": {
1704 1704
                 "type": "zip",
1705
-                "url": "https://api.github.com/repos/symfony/console/zipball/f7416ccdb605b70c69a3a38b7330c0bc535ebffa",
1705
+                "url": "https://api.github.com/repos/symfony/console/zipball/7fc7b396907eb49d3a64028678a49586f6f2e7f9",
1706 1706
                 "reference": "f7416ccdb605b70c69a3a38b7330c0bc535ebffa",
1707 1707
                 "shasum": ""
1708 1708
             },
@@ -1818,7 +1818,7 @@
1818 1818
             },
1819 1819
             "dist": {
1820 1820
                 "type": "zip",
1821
-                "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/06ecd0c8344cd197501c28b945a902092bd7f637",
1821
+                "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b33593cbfe1d81b50d48353f338aca76a08658d8",
1822 1822
                 "reference": "06ecd0c8344cd197501c28b945a902092bd7f637",
1823 1823
                 "shasum": ""
1824 1824
             },
@@ -1982,7 +1982,7 @@
1982 1982
             },
1983 1983
             "dist": {
1984 1984
                 "type": "zip",
1985
-                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/4f092d8e5838064449201d8e9210026f6f40c43b",
1985
+                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a77de50e508b2c1eeac5f2f552f135fff25e7019",
1986 1986
                 "reference": "4f092d8e5838064449201d8e9210026f6f40c43b",
1987 1987
                 "shasum": ""
1988 1988
             },
@@ -2037,7 +2037,7 @@
2037 2037
             },
2038 2038
             "dist": {
2039 2039
                 "type": "zip",
2040
-                "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1a56b4dd82f3f8675820dca8b15097a9674d0353",
2040
+                "url": "https://api.github.com/repos/symfony/http-kernel/zipball/cd4550722340132bbee1cc0e27aa7651f66c49fd",
2041 2041
                 "reference": "1a56b4dd82f3f8675820dca8b15097a9674d0353",
2042 2042
                 "shasum": ""
2043 2043
             },
@@ -2168,7 +2168,7 @@
2168 2168
             },
2169 2169
             "dist": {
2170 2170
                 "type": "zip",
2171
-                "url": "https://api.github.com/repos/symfony/security-core/zipball/09c3c237338c6d269aae2293fe4095d8372ace0a",
2171
+                "url": "https://api.github.com/repos/symfony/security-core/zipball/cbac0669e396e0f792958bca49f5286690707a39",
2172 2172
                 "reference": "09c3c237338c6d269aae2293fe4095d8372ace0a",
2173 2173
                 "shasum": ""
2174 2174
             },
@@ -2296,7 +2296,7 @@
2296 2296
             },
2297 2297
             "dist": {
2298 2298
                 "type": "zip",
2299
-                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7c795c531087200ec1427a8fc5825af6f68352a7",
2299
+                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c45956dcc15f0687339f2ccdb885aaf27e5ee4d2",
2300 2300
                 "reference": "7c795c531087200ec1427a8fc5825af6f68352a7",
2301 2301
                 "shasum": ""
2302 2302
             },
@@ -2386,7 +2386,7 @@
2386 2386
             },
2387 2387
             "dist": {
2388 2388
                 "type": "zip",
2389
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/b9b6f367e10ad4d05adae41013446338927b7ac2",
2389
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/b7c124bae00ab0a019a084c6b99f1df023bcb996",
2390 2390
                 "reference": "b9b6f367e10ad4d05adae41013446338927b7ac2",
2391 2391
                 "shasum": ""
2392 2392
             },

+ 6
- 7
src/Auth/Business/LuticateUsersBusiness.php View File

@@ -101,14 +101,13 @@ class LuticateUsersBusiness extends LuBusiness {
101 101
         return true;
102 102
     }
103 103
 
104
-    public static function getAllLight($page = 0, $perPage = PHP_INT_MAX)
104
+    public static function getAllLight($page = 0, $perPage = PHP_INT_MAX, $query = "")
105 105
     {
106
-        $users = self::getAll($page, $perPage);
107
-        $usersLight = array();
108
-        foreach ($users->getData() as $user) {
109
-            $usersLight[] = LuticateUsersLightDbo::fromUserDbo($user);
110
-        }
111
-        return new LuMultipleDbo($users->getCount(), $usersLight);
106
+        $users = self::getAll($page, $perPage, $query);
107
+        return $users->map(function($user)
108
+        {
109
+            return LuticateUsersLightDbo::fromUserDbo($user);
110
+        });
112 111
     }
113 112
 
114 113
     public static function getLightById($user_id)

+ 3
- 2
src/Auth/Controller/LuticateUsersController.php View File

@@ -47,11 +47,12 @@ class LuticateUsersController extends LuController {
47 47
      * Get all users
48 48
      * @param int $page The page number, 0 based
49 49
      * @param int $perPage The number of items per page
50
+     * @param string $query The filter query
50 51
      * @return array
51 52
      */
52
-    public function getAllLight($page = 0, $perPage = PHP_INT_MAX)
53
+    public function getAllLight($page = 0, $perPage = PHP_INT_MAX, $query = "")
53 54
     {
54
-        return LuticateUsersBusiness::getAllLight($page, $perPage);
55
+        return LuticateUsersBusiness::getAllLight($page, $perPage, $query);
55 56
     }
56 57
 
57 58
     /**

+ 7
- 0
src/Auth/DataAccess/LuticateUsersDataAccess.php View File

@@ -17,6 +17,13 @@ class LuticateUsersDataAccess extends LuDataAccess {
17 17
         return array(array("username", "ASC"));
18 18
     }
19 19
 
20
+    protected static function getQueryPredicate($query)
21
+    {
22
+        return array(array("username", "ilike", $query, "or"),
23
+            array("firstname", "ilike", $query, "or"),
24
+            array("lastname", "ilike", $query, "or"));
25
+    }
26
+
20 27
     /**
21 28
      * @param $username string
22 29
      * @return LuticateUsersDbo|null

Loading…
Cancel
Save