Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
[Upg] fix permissions in profile view
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJuliuss committed Jul 8, 2014
1 parent 2b4b052 commit 9384181
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
17 changes: 16 additions & 1 deletion docs/changelogs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#Versions

##1.2.8

* Bootstrap 3.2 upgrade
* Fix favicon
* jQuery 2.1.1
* Fix item lists views not in config

##1.1.23

* Bootstrap 3.2 upgrade
* Fix favicon
* jQuery 2.1.1
* Bulgarian support
* Fix item lists views not in config

##1.2.7

* Laravel 4.2 support
Expand Down Expand Up @@ -202,4 +217,4 @@ Same as 1.1.17

##1.0

* First release
* First release
14 changes: 9 additions & 5 deletions src/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,15 @@ public function putShow($userId)
$user->first_name = Input::get('first_name');
$user->permissions = $permissions;

$currentUser = Sentry::getUser();
$permissions = (empty($permissions)) ? '' : json_encode($permissions);
// delete permissions in db
DB::table('users')
->where('id', $userId)
->update(array('permissions' => $permissions));
$hasPermissionManagement = $currentUser->hasAccess('permissions-management') || $currentUser->hasAccess('superuser');
if($hasPermissionManagement === true)
{
DB::table('users')
->where('id', $userId)
->update(array('permissions' => $permissions));
}

$pass = Input::get('pass');
if(!empty($pass))
Expand All @@ -358,7 +362,7 @@ public function putShow($userId)
$this->_banUser($userId, $banned);
}

if(Sentry::getUser()->hasAccess('user-group-management'))
if($currentUser->hasAccess('user-group-management'))
{
$groups = (Input::get('groups') === null) ? array() : Input::get('groups');
$userGroups = $user->getGroups()->toArray();
Expand Down

0 comments on commit 9384181

Please sign in to comment.