Fixes #1996 - replace old Sentry methods with laravel native

This commit is contained in:
snipe 2016-05-09 15:40:27 -07:00
parent a144fb77cd
commit c56c398d4c
2 changed files with 39 additions and 13 deletions

View file

@ -63,6 +63,7 @@ class UsersController extends Controller
*/
public function getCreate()
{
$user = new User;
// Selected groups
if (Input::has('groups')) {
@ -70,11 +71,11 @@ class UsersController extends Controller
} else {
$userGroups = collect();
}
$permissions = config('permissions');
$groups = Group::pluck('name', 'id');
$userPermissions = Helper::selectedPermissionsArray($permissions, Input::old('groups', array()));
$userGroups = $user->groups()->pluck('name', 'id');
$userPermissions = Helper::selectedPermissionsArray($permissions, Input::old('permissions', array()));
$location_list = Helper::locationsList();
$manager_list = Helper::managerList();
@ -197,13 +198,7 @@ class UsersController extends Controller
$location_list = Helper::locationsList();
$company_list = Helper::companyList();
$manager_list = array('' => 'Select a User') + DB::table('users')
->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))
->whereNull('deleted_at')
->where('id', '!=', $id)
->orderBy('last_name', 'asc')
->orderBy('first_name', 'asc')
->lists('full_name', 'id');
$manager_list = Helper::managerList();
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = trans('admin/users/message.user_not_found', compact('id'));
@ -260,7 +255,10 @@ class UsersController extends Controller
$user->first_name = e(Input::get('first_name'));
$user->last_name = e(Input::get('last_name'));
$user->locale = e(Input::get('locale'));
$user->username = e(Input::get('username'));
if (Input::has('username')) {
$user->username = e(Input::get('username'));
}
$user->email = e(Input::get('email'));
$user->employee_num = e(Input::get('employee_num'));
$user->activated = e(Input::get('activated', $user->activated));
@ -270,6 +268,7 @@ class UsersController extends Controller
$user->company_id = e(Company::getIdForUser(Input::get('company_id')));
$user->manager_id = e(Input::get('manager_id'));
$user->notes = e(Input::get('notes'));
$user->permissions = json_encode(Input::get('permission'));
if ($user->manager_id == "") {
$user->manager_id = null;

View file

@ -34,7 +34,7 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
</style>
<div class="row">
<div class="col-md-9">
<div class="col-md-8 col-md-offset-2">
<form class="form-horizontal" method="post" action="" autocomplete="off">
@ -294,7 +294,34 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
</div>
</div><!-- /.tab-pane -->
<div class="tab-pane" id="tab_2">
Permission stuff goes here
<div class="col-md-10 col-md-offset-2">
@foreach ($permissions as $area => $permission)
@for ($i = 0; $i < count($permission); $i++)
<?php
$permission_name = $permission[$i]['permission'];
?>
@if ($permission[$i]['display'])
<h3>{{ $area }}: {{ $permission[$i]['label'] }}</h3>
<p>{{ $permission[$i]['note'] }}</p>
<!-- radio -->
<div class="form-group" style="padding-left: 15px;">
<label class="radio-padding">
{{ Form::radio('permission['.$permission_name.']', 1, $userPermissions[$permission_name], ['class' => 'minimal']) }}
Grant</label>
<label class="radio-padding">
{{ Form::radio('permission['.$permission_name.']', 0, !$userPermissions[$permission_name], ['class' => 'minimal']) }}
Deny</label>
</div>
<hr>
@endif
@endfor
@endforeach
</div>
</div><!-- /.tab-pane -->
</div><!-- /.tab-content -->