|
@@ -8,11 +8,8 @@
|
8
|
8
|
|
9
|
9
|
namespace Luticate\Auth\Business;
|
10
|
10
|
|
11
|
|
-use Illuminate\Http\Request;
|
12
|
11
|
use Luticate\Auth\DBO\LuticatePermissions;
|
13
|
12
|
use Luticate\Auth\DBO\LuticateUsersDbo;
|
14
|
|
-use Luticate\Doc\Business\LuDocBusiness;
|
15
|
|
-use Luticate\Utils\LuController;
|
16
|
13
|
use Luticate\Utils\LuRoute;
|
17
|
14
|
|
18
|
15
|
class LuticateBusiness
|
|
@@ -43,13 +40,12 @@ class LuticateBusiness
|
43
|
40
|
*/
|
44
|
41
|
public static function setupRoutes($prefix = "/luticate")
|
45
|
42
|
{
|
46
|
|
- $ns = 'Luticate\Auth\Business\\';
|
|
43
|
+ $ns = 'Luticate\Auth\Controller\\';
|
47
|
44
|
|
48
|
45
|
$int = "[0-9]+";
|
49
|
46
|
$name = "[A-Z0-9_]+";
|
50
|
47
|
$bool = "true|false";
|
51
|
48
|
|
52
|
|
- $id = "{id:$int}";
|
53
|
49
|
$group_id = "{group_id:$int}";
|
54
|
50
|
$user_id = "{user_id:$int}";
|
55
|
51
|
$permission_name = "{permission_name:$name}";
|
|
@@ -57,73 +53,73 @@ class LuticateBusiness
|
57
|
53
|
|
58
|
54
|
$route = LuRoute::getInstance();
|
59
|
55
|
|
60
|
|
- $route->post("$prefix/users/login", "${ns}LuticateUsersBusiness", "login");
|
61
|
|
- $route->post("$prefix/users/logout", "${ns}LuticateUsersBusiness", "logout");
|
62
|
|
- $route->post("$prefix/users/$id", "${ns}LuticateUsersBusiness", "getById", LuticatePermissions::USER_GET);
|
63
|
|
- $route->post("$prefix/users", "${ns}LuticateUsersBusiness", "getAll", LuticatePermissions::USER_GET);
|
64
|
|
- $route->post("$prefix/users/add", "${ns}LuticateUsersBusiness", "add",
|
|
56
|
+ $route->post("$prefix/users/login", "${ns}LuticateUsersController", "login");
|
|
57
|
+ $route->post("$prefix/users/logout", "${ns}LuticateUsersController", "logout");
|
|
58
|
+ $route->get("$prefix/users/$user_id", "${ns}LuticateUsersController", "getById", LuticatePermissions::USER_GET);
|
|
59
|
+ $route->get("$prefix/users", "${ns}LuticateUsersController", "getAll", LuticatePermissions::USER_GET);
|
|
60
|
+ $route->post("$prefix/users/add", "${ns}LuticateUsersController", "add",
|
65
|
61
|
array(LuticatePermissions::USER_ADD, LuticatePermissions::USER_GET));
|
66
|
|
- $route->post("$prefix/users/$user_id/del", "${ns}LuticateUsersBusiness", "del",
|
|
62
|
+ $route->post("$prefix/users/$user_id/del", "${ns}LuticateUsersController", "del",
|
67
|
63
|
array(LuticatePermissions::USER_DEL, LuticatePermissions::USER_GET));
|
68
|
|
- $route->post("$prefix/users/$user_id/edit", "${ns}LuticateUsersBusiness", "edit",
|
|
64
|
+ $route->post("$prefix/users/$user_id/edit", "${ns}LuticateUsersController", "edit",
|
69
|
65
|
array(LuticatePermissions::USER_EDIT, LuticatePermissions::USER_GET));
|
70
|
|
- $route->post("$prefix/users/me/edit", "${ns}LuticateUsersBusiness", "editMe",
|
|
66
|
+ $route->post("$prefix/users/me/edit", "${ns}LuticateUsersController", "editMe",
|
71
|
67
|
LuticatePermissions::USER_EDIT_ME);
|
72
|
|
- $route->post("$prefix/users/$user_id/setPassword", "${ns}LuticateUsersBusiness", "setPassword",
|
|
68
|
+ $route->post("$prefix/users/$user_id/setPassword", "${ns}LuticateUsersController", "setPassword",
|
73
|
69
|
array(LuticatePermissions::USER_SET_PASSWORD, LuticatePermissions::USER_GET));
|
74
|
|
- $route->post("$prefix/users/me/setPassword", "${ns}LuticateUsersBusiness", "setPasswordMe",
|
|
70
|
+ $route->post("$prefix/users/me/setPassword", "${ns}LuticateUsersController", "setPasswordMe",
|
75
|
71
|
LuticatePermissions::USER_SET_PASSWORD_ME);
|
76
|
72
|
|
77
|
73
|
|
78
|
|
- $route->post("$prefix/groups/$id", "${ns}LuticateGroupsBusiness", "getById", LuticatePermissions::GROUP_GET);
|
79
|
|
- $route->post("$prefix/groups", "${ns}LuticateGroupsBusiness", "getAll", LuticatePermissions::GROUP_GET);
|
80
|
|
- $route->post("$prefix/groups/add", "${ns}LuticateGroupsBusiness", "add",
|
|
74
|
+ $route->get("$prefix/groups/$group_id", "${ns}LuticateGroupsController", "getById", LuticatePermissions::GROUP_GET);
|
|
75
|
+ $route->get("$prefix/groups", "${ns}LuticateGroupsController", "getAll", LuticatePermissions::GROUP_GET);
|
|
76
|
+ $route->post("$prefix/groups/add", "${ns}LuticateGroupsController", "add",
|
81
|
77
|
array(LuticatePermissions::GROUP_ADD, LuticatePermissions::GROUP_GET));
|
82
|
|
- $route->post("$prefix/groups/$group_id/del", "${ns}LuticateGroupsBusiness", "del",
|
|
78
|
+ $route->post("$prefix/groups/$group_id/del", "${ns}LuticateGroupsController", "del",
|
83
|
79
|
array(LuticatePermissions::GROUP_DEL, LuticatePermissions::GROUP_GET));
|
84
|
|
- $route->post("$prefix/groups/$group_id/edit", "${ns}LuticateGroupsBusiness", "edit",
|
|
80
|
+ $route->post("$prefix/groups/$group_id/edit", "${ns}LuticateGroupsController", "edit",
|
85
|
81
|
array(LuticatePermissions::GROUP_EDIT, LuticatePermissions::GROUP_GET));
|
86
|
|
- $route->post("$prefix/groups/$group_id/addUser/$user_id", "${ns}LuticateGroupsBusiness", "addUser",
|
|
82
|
+ $route->post("$prefix/groups/$group_id/addUser/$user_id", "${ns}LuticateGroupsController", "addUser",
|
87
|
83
|
array(LuticatePermissions::GROUP_ADD_USER, LuticatePermissions::GROUP_GET));
|
88
|
|
- $route->post("$prefix/groups/$group_id/delUser/$user_id", "${ns}LuticateGroupsBusiness", "delUser",
|
|
84
|
+ $route->post("$prefix/groups/$group_id/delUser/$user_id", "${ns}LuticateGroupsController", "delUser",
|
89
|
85
|
array(LuticatePermissions::GROUP_DEL_USER, LuticatePermissions::GROUP_GET));
|
90
|
86
|
|
91
|
87
|
|
92
|
|
- $route->post("$prefix/permissions/effective/$user_id/$permission_name", "${ns}LuticatePermissionsBusiness",
|
|
88
|
+ $route->get("$prefix/permissions/effective/$user_id/$permission_name", "${ns}LuticatePermissionsController",
|
93
|
89
|
"getEffectivePermission", LuticatePermissions::PERM_EFFECTIVE_GET);
|
94
|
|
- $route->post("$prefix/permissions/effective/me/$permission_name", "${ns}LuticatePermissionsBusiness",
|
|
90
|
+ $route->get("$prefix/permissions/effective/me/$permission_name", "${ns}LuticatePermissionsController",
|
95
|
91
|
"getEffectivePermissionMe");
|
96
|
92
|
|
97
|
|
- $route->post("$prefix/permissions/$permission_name", "${ns}LuticatePermissionsBusiness", "get",
|
|
93
|
+ $route->get("$prefix/permissions/$permission_name", "${ns}LuticatePermissionsController", "get",
|
98
|
94
|
LuticatePermissions::PERM_GET);
|
99
|
|
- $route->post("$prefix/permissions/add/$permission_name/$permission_value", "${ns}LuticatePermissionsBusiness",
|
|
95
|
+ $route->post("$prefix/permissions/add/$permission_name/$permission_value", "${ns}LuticatePermissionsController",
|
100
|
96
|
"add", array(LuticatePermissions::PERM_ADD, LuticatePermissions::PERM_GET));
|
101
|
|
- $route->post("$prefix/permissions/$permission_name/del", "${ns}LuticatePermissionsBusiness", "del",
|
|
97
|
+ $route->post("$prefix/permissions/$permission_name/del", "${ns}LuticatePermissionsController", "del",
|
102
|
98
|
array(LuticatePermissions::PERM_DEL, LuticatePermissions::PERM_GET));
|
103
|
|
- $route->post("$prefix/permissions/$permission_name/edit/$permission_value", "${ns}LuticatePermissionsBusiness",
|
|
99
|
+ $route->post("$prefix/permissions/$permission_name/edit/$permission_value", "${ns}LuticatePermissionsController",
|
104
|
100
|
"edit", array(LuticatePermissions::PERM_EDIT, LuticatePermissions::PERM_GET));
|
105
|
101
|
|
106
|
|
- $route->post("$prefix/permissions/group/$group_id/$permission_name", "${ns}LuticatePermissionsGroupsBusiness",
|
|
102
|
+ $route->get("$prefix/permissions/group/$group_id/$permission_name", "${ns}LuticatePermissionsGroupsController",
|
107
|
103
|
"get", LuticatePermissions::PERM_GROUP_GET);
|
108
|
104
|
$route->post("$prefix/permissions/group/$group_id/add/$permission_name/$permission_value",
|
109
|
|
- "${ns}LuticatePermissionsGroupsBusiness", "add", array(LuticatePermissions::PERM_GROUP_ADD,
|
|
105
|
+ "${ns}LuticatePermissionsGroupsController", "add", array(LuticatePermissions::PERM_GROUP_ADD,
|
110
|
106
|
LuticatePermissions::PERM_GROUP_GET));
|
111
|
107
|
$route->post("$prefix/permissions/group/$group_id/$permission_name/del",
|
112
|
|
- "${ns}LuticatePermissionsGroupsBusiness", "del", array(LuticatePermissions::PERM_GROUP_DEL,
|
|
108
|
+ "${ns}LuticatePermissionsGroupsController", "del", array(LuticatePermissions::PERM_GROUP_DEL,
|
113
|
109
|
LuticatePermissions::PERM_GROUP_GET));
|
114
|
110
|
$route->post("$prefix/permissions/group/$group_id/$permission_name/edit/$permission_value",
|
115
|
|
- "${ns}LuticatePermissionsGroupsBusiness", "edit", array(LuticatePermissions::PERM_GROUP_EDIT,
|
|
111
|
+ "${ns}LuticatePermissionsGroupsController", "edit", array(LuticatePermissions::PERM_GROUP_EDIT,
|
116
|
112
|
LuticatePermissions::PERM_GROUP_GET));
|
117
|
113
|
|
118
|
|
- $route->post("$prefix/permissions/user/$user_id/$permission_name", "${ns}LuticatePermissionsUsersBusiness",
|
|
114
|
+ $route->post("$prefix/permissions/user/$user_id/$permission_name", "${ns}LuticatePermissionsUsersController",
|
119
|
115
|
"get", LuticatePermissions::PERM_USER_GET);
|
120
|
116
|
$route->post("$prefix/permissions/user/$user_id/add/$permission_name/$permission_value",
|
121
|
|
- "${ns}LuticatePermissionsUsersBusiness", "add", array(LuticatePermissions::PERM_USER_ADD,
|
|
117
|
+ "${ns}LuticatePermissionsUsersController", "add", array(LuticatePermissions::PERM_USER_ADD,
|
122
|
118
|
LuticatePermissions::PERM_USER_GET));
|
123
|
|
- $route->post("$prefix/permissions/user/$user_id/$permission_name/del", "${ns}LuticatePermissionsUsersBusiness",
|
|
119
|
+ $route->post("$prefix/permissions/user/$user_id/$permission_name/del", "${ns}LuticatePermissionsUsersController",
|
124
|
120
|
"del", array(LuticatePermissions::PERM_USER_DEL, LuticatePermissions::PERM_USER_GET));
|
125
|
121
|
$route->post("$prefix/permissions/user/$user_id/$permission_name/edit/$permission_value",
|
126
|
|
- "${ns}LuticatePermissionsUsersBusiness", "edit", array(LuticatePermissions::PERM_USER_EDIT,
|
|
122
|
+ "${ns}LuticatePermissionsUsersController", "edit", array(LuticatePermissions::PERM_USER_EDIT,
|
127
|
123
|
LuticatePermissions::PERM_USER_GET));
|
128
|
124
|
}
|
129
|
125
|
}
|