Skip to content

Commit 0f2d7d5

Browse files
authored
Merge pull request #361 from LavaLite/develop
Minor fixes
2 parents 4dd4fff + 90bd0cb commit 0f2d7d5

19 files changed

+110
-834
lines changed

app/Forms/Permission.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace App\Forms;
44

5-
use Litepie\Roles\Forms\Role as BaseForm;
5+
use Litepie\Roles\Forms\Permission as BaseForm;
66

77
class Permission extends BaseForm
88
{
9-
}
9+
}

app/Http/Controllers/Litepie/ClientResourceController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function index(ClientRequest $request)
6868
*/
6969
public function show(ClientRequest $request, ClientRepositoryInterface $repository)
7070
{
71-
dd($repository);
7271
$form = $this->form;
7372
$modules = $this->modules;
7473
$data = $repository->toArray();

app/Http/Controllers/Litepie/PermissionResourceController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(PermissionRepositoryInterface $permission)
2727
{
2828
parent::__construct();
2929
$this->form = PermissionForm::setAttributes()->toArray();
30-
$this->modules = $this->modules(config('app.role.modules'), 'role', guard_url('role'));
30+
$this->modules = $this->modules(config('role.modules'), 'role', guard_url('role'), '.');
3131
$this->repository = $permission;
3232
}
3333

@@ -38,7 +38,6 @@ public function __construct(PermissionRepositoryInterface $permission)
3838
*/
3939
public function index(PermissionRequest $request)
4040
{
41-
4241
$pageLimit = $request->input('pageLimit', config('database.pagination.limit'));
4342
$data = $this->repository
4443
->pushFilter(RequestFilter::class)

app/Http/Controllers/Litepie/RoleResourceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(RoleRepositoryInterface $role)
2727
{
2828
parent::__construct();
2929
$this->form = RoleForm::setAttributes()->toArray();
30-
$this->modules = $this->modules(config('app.role.modules'), 'role', guard_url('role'));
30+
$this->modules = $this->modules(config('role.modules'), 'role', guard_url('role'), '.');
3131
$this->repository = $role;
3232
}
3333

app/Http/Controllers/Litepie/TeamResourceController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(TeamRepositoryInterface $team)
2727
{
2828
parent::__construct();
2929
$this->form = TeamForm::setAttributes()->toArray();
30-
$this->modules = $this->modules(config('team.modules'), 'team', guard_url('team'));
30+
$this->modules = $this->modules(config('team.modules'), '', guard_url('team'), '');
3131
$this->repository = $team;
3232
}
3333

@@ -52,7 +52,7 @@ public function index(TeamRequest $request)
5252
$form = $this->form;
5353
$modules = $this->modules;
5454

55-
return $this->response->setMetaTitle(trans('team.team.names'))
55+
return $this->response->setMetaTitle(trans('team.names'))
5656
->view('litepie.team.team.index')
5757
->data(compact('data', 'meta', 'links', 'modules', 'form'))
5858
->output();

app/Http/Controllers/Litepie/UserResourceController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ public function store(UserRequest $request, UserRepositoryInterface $repository)
115115
->code(204)
116116
->data(compact('data'))
117117
->status('success')
118-
->url(guard_url('users/user/' . $data['id']))
118+
->url(guard_url('user/user/' . $data['id']))
119119
->redirect();
120120
} catch (Exception $e) {
121121
return $this->response->message($e->getMessage())
122122
->code(400)
123123
->status('error')
124-
->url(guard_url('/users/user'))
124+
->url(guard_url('/user/user'))
125125
->redirect();
126126
}
127127

@@ -166,13 +166,13 @@ public function update(UserRequest $request, UserRepositoryInterface $repository
166166
->code(204)
167167
->status('success')
168168
->data(compact('data'))
169-
->url(guard_url('users/user/' . $data['id']))
169+
->url(guard_url('user/user/' . $data['id']))
170170
->redirect();
171171
} catch (Exception $e) {
172172
return $this->response->message($e->getMessage())
173173
->code(400)
174174
->status('error')
175-
->url(guard_url('users/user/' . $data['id']))
175+
->url(guard_url('user/user/' . $data['id']))
176176
->redirect();
177177
}
178178

@@ -195,15 +195,15 @@ public function destroy(UserRequest $request, UserRepositoryInterface $repositor
195195
->code(202)
196196
->status('success')
197197
->data(compact('data'))
198-
->url(guard_url('users/user/0'))
198+
->url(guard_url('user/user/0'))
199199
->redirect();
200200

201201
} catch (Exception $e) {
202202

203203
return $this->response->message($e->getMessage())
204204
->code(400)
205205
->status('error')
206-
->url(guard_url('users/user/' . $data['id']))
206+
->url(guard_url('user/user/' . $data['id']))
207207
->redirect();
208208
}
209209

app/Policies/ClientPolicy.php

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,9 @@
22

33
namespace App\Policies;
44

5-
use Litepie\User\Interfaces\UserPolicyInterface;
6-
use App\Repositories\Eloquent\ClientRepository;
5+
use Litepie\User\Policies\ClientPolicy as LitepiePolicy;
76

8-
class ClientPolicy
7+
class ClientPolicy extends LitepiePolicy
98
{
109

11-
/**
12-
* Determine if the given user can view the client.
13-
*
14-
* @param UserPolicyInterface $authUser
15-
* @param ClientRepository $client
16-
*
17-
* @return bool
18-
*/
19-
public function view(UserPolicyInterface $authUser, ClientRepository $client)
20-
{
21-
if ($authUser->canDo('users.client.view')) {
22-
return true;
23-
}
24-
25-
return $client->user_id == user_id() && $client->user_type == user_type();
26-
}
27-
28-
/**
29-
* Determine if the given user can create a client.
30-
*
31-
* @param UserPolicyInterface $authUser
32-
*
33-
* @return bool
34-
*/
35-
public function create(UserPolicyInterface $authUser)
36-
{
37-
return $authUser->canDo('users.client.create');
38-
}
39-
40-
/**
41-
* Determine if the given user can update the given client.
42-
*
43-
* @param UserPolicyInterface $authUser
44-
* @param ClientRepository $client
45-
*
46-
* @return bool
47-
*/
48-
public function update(UserPolicyInterface $authUser, ClientRepository $client)
49-
{
50-
if ($authUser->canDo('users.client.edit')) {
51-
return true;
52-
}
53-
54-
return $client->user_id == user_id() && $client->user_type == user_type();
55-
}
56-
57-
/**
58-
* Determine if the given user can delete the given client.
59-
*
60-
* @param UserPolicyInterface $authUser
61-
*
62-
* @return bool
63-
*/
64-
public function destroy(UserPolicyInterface $authUser, ClientRepository $client)
65-
{
66-
return $client->user_id == user_id() && $client->user_type == user_type();
67-
}
68-
69-
/**
70-
* Determine if the given user can verify the given client.
71-
*
72-
* @param UserPolicyInterface $authUser
73-
*
74-
* @return bool
75-
*/
76-
public function verify(UserPolicyInterface $authUser, ClientRepository $client)
77-
{
78-
if ($authUser->canDo('users.client.verify')) {
79-
return true;
80-
}
81-
82-
return false;
83-
}
84-
85-
/**
86-
* Determine if the given user can approve the given client.
87-
*
88-
* @param UserPolicyInterface $authUser
89-
*
90-
* @return bool
91-
*/
92-
public function approve(UserPolicyInterface $authUser, ClientRepository $client)
93-
{
94-
if ($authUser->canDo('users.client.approve')) {
95-
return true;
96-
}
97-
98-
return false;
99-
}
100-
101-
/**
102-
* Determine if the user can perform a given action ve.
103-
*
104-
* @param [type] $authUser [description]
105-
* @param [type] $ability [description]
106-
*
107-
* @return [type] [description]
108-
*/
109-
public function before($authUser, $ability)
110-
{
111-
if ($authUser->isSuperuser()) {
112-
return true;
113-
}
114-
}
115-
}
10+
}

app/Policies/MasterPolicy.php

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,9 @@
22

33
namespace App\Policies;
44

5-
use Litepie\User\Interfaces\UserPolicyInterface;
6-
use App\Repositories\Eloquent\MasterRepository;
5+
use Litepie\Master\Policies\MasterPolicy as LitepiePolicy;
76

8-
class MasterPolicy
7+
class MasterPolicy extends LitepiePolicy
98
{
109

11-
/**
12-
* Determine if the given user can view the master.
13-
*
14-
* @param UserPolicyInterface $authUser
15-
* @param MasterRepository $master
16-
*
17-
* @return bool
18-
*/
19-
public function view(UserPolicyInterface $authUser, MasterRepository $master)
20-
{
21-
if ($authUser->canDo('master.master.view')) {
22-
return true;
23-
}
24-
25-
return $master->user_id == user_id() && $master->user_type == user_type();
26-
}
27-
28-
/**
29-
* Determine if the given user can create a master.
30-
*
31-
* @param UserPolicyInterface $authUser
32-
*
33-
* @return bool
34-
*/
35-
public function create(UserPolicyInterface $authUser)
36-
{
37-
return $authUser->canDo('master.master.create');
38-
}
39-
40-
/**
41-
* Determine if the given user can update the given master.
42-
*
43-
* @param UserPolicyInterface $authUser
44-
* @param MasterRepository $master
45-
*
46-
* @return bool
47-
*/
48-
public function update(UserPolicyInterface $authUser, MasterRepository $master)
49-
{
50-
if ($authUser->canDo('master.master.edit')) {
51-
return true;
52-
}
53-
54-
return $master->user_id == user_id() && $master->user_type == user_type();
55-
}
56-
57-
/**
58-
* Determine if the given user can delete the given master.
59-
*
60-
* @param UserPolicyInterface $authUser
61-
*
62-
* @return bool
63-
*/
64-
public function destroy(UserPolicyInterface $authUser, MasterRepository $master)
65-
{
66-
return $master->user_id == user_id() && $master->user_type == user_type();
67-
}
68-
69-
/**
70-
* Determine if the given user can verify the given master.
71-
*
72-
* @param UserPolicyInterface $authUser
73-
*
74-
* @return bool
75-
*/
76-
public function verify(UserPolicyInterface $authUser, MasterRepository $master)
77-
{
78-
if ($authUser->canDo('master.master.verify')) {
79-
return true;
80-
}
81-
82-
return false;
83-
}
84-
85-
/**
86-
* Determine if the given user can approve the given master.
87-
*
88-
* @param UserPolicyInterface $authUser
89-
*
90-
* @return bool
91-
*/
92-
public function approve(UserPolicyInterface $authUser, MasterRepository $master)
93-
{
94-
if ($authUser->canDo('master.master.approve')) {
95-
return true;
96-
}
97-
98-
return false;
99-
}
100-
101-
/**
102-
* Determine if the user can perform a given action ve.
103-
*
104-
* @param [type] $authUser [description]
105-
* @param [type] $ability [description]
106-
*
107-
* @return [type] [description]
108-
*/
109-
public function before($authUser, $ability)
110-
{
111-
if ($authUser->isSuperuser()) {
112-
return true;
113-
}
114-
}
11510
}

0 commit comments

Comments
 (0)