Skip to content

Commit

Permalink
Improve admin operation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjinghua committed Nov 9, 2016
1 parent 5e90800 commit d6dd8da
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function show($id)
$user = User::findOrFail($id);
$topics = Topic::whose($user->id)->withoutBoardTopics()->recent()->limit(20)->get();
$replies = Reply::whose($user->id)->recent()->limit(20)->get();

return view('users.show', compact('user', 'topics', 'replies'));
}

Expand Down
2 changes: 1 addition & 1 deletion config/administrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}
}

if (!Auth::check() || !Auth::user()->can('visit_admin')) {
if (!Auth::check() || !Auth::user()->can('visit_admin') || Auth::user()->roles->count() > 5) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/partials/basicinfo.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
</a>
@endif

@if ($currentUser && Entrust::can('manage_users') && ($currentUser->id != $user->id))
@if ($currentUser && Entrust::can('manage_users') && ($currentUser->id != $user->id) && $currentUser->roles->count() < 5)
<a data-method="post" class="btn btn-{{ $user->is_banned == 'yes' ? 'warning' : 'danger' }} btn-block" href="javascript:void(0);" data-url="{{ route('users.blocking', $user->id) }}" id="user-edit-button" onclick=" return confirm('{{ lang('Are you sure want to '. ($user->is_banned == 'yes' ? 'unblock' : 'block') . ' this User?') }}')">
<i class="fa fa-times"></i> {{ $user->is_banned == 'yes' ? lang('Unblock User') : lang('Block User') }}
</a>
Expand Down

0 comments on commit d6dd8da

Please sign in to comment.