|
@@ -2,6 +2,7 @@
|
2
|
2
|
|
3
|
3
|
namespace Luticate\Auth\DataAccess;
|
4
|
4
|
|
|
5
|
+use Luticate\Auth\DataAccess\Models\LuticateUsers;
|
5
|
6
|
use Luticate\Utils\LuDataAccess;
|
6
|
7
|
use Luticate\Auth\DataAccess\Models\LuticatePermissionsUsers;
|
7
|
8
|
use Luticate\Auth\DBO\LuticatePermissionsUsersDbo;
|
|
@@ -17,6 +18,11 @@ class LuticatePermissionsUsersDataAccess extends LuDataAccess {
|
17
|
18
|
return LuticatePermissionsUsers::where("name", "=", $permission_name)->where("user_id", "=", $user_id)->first();
|
18
|
19
|
}
|
19
|
20
|
|
|
21
|
+ public static function getAllByUser($user_id, $page = 0, $perPage = PHP_INT_MAX)
|
|
22
|
+ {
|
|
23
|
+ return self::getMultiple(array(array('user_id', '=', $user_id)), array(array("name", "ASC")), $page, $perPage);
|
|
24
|
+ }
|
|
25
|
+
|
20
|
26
|
public static function getByName($user_id, $permission_name)
|
21
|
27
|
{
|
22
|
28
|
$perm = self::getModelByName($user_id, $permission_name);
|
|
@@ -26,25 +32,8 @@ class LuticatePermissionsUsersDataAccess extends LuDataAccess {
|
26
|
32
|
return $perm->toDbo();
|
27
|
33
|
}
|
28
|
34
|
|
29
|
|
- public static function getAllByUser($user_id, $page = 0, $perPage = PHP_INT_MAX)
|
30
|
|
- {
|
31
|
|
- return self::getMultiple(array(array('user_id', '=', $user_id)), array(array("name", "ASC")), $page, $perPage);
|
32
|
|
- }
|
33
|
|
-
|
34
|
35
|
public static function delete($user_id, $permission_name)
|
35
|
36
|
{
|
36
|
|
- $perm = self::getModelByName($user_id, $permission_name);
|
37
|
|
- if (is_null($perm))
|
38
|
|
- return;
|
39
|
|
- $perm->delete();
|
40
|
|
- }
|
41
|
|
-
|
42
|
|
- public static function edit($user_id, $permission_name, $permission_value)
|
43
|
|
- {
|
44
|
|
- $perm = self::getModelByName($user_id, $permission_name);
|
45
|
|
- if (is_null($perm))
|
46
|
|
- return;
|
47
|
|
- $perm->value = $permission_value;
|
48
|
|
- $perm->save();
|
|
37
|
+ LuticateUsers::find($user_id)->permissions()->detach($permission_name);
|
49
|
38
|
}
|
50
|
39
|
}
|