Skip to content

Commit

Permalink
Fix a permission bug in admin manage roles and manage permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Jul 11, 2014
1 parent 76ba374 commit 55c915a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions application/controllers/account/manage_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,16 @@ function save($id=null)
redirect('account/sign_in/?continue='.urlencode(base_url().'account/manage_permissions'));
}

// Redirect unauthorized users to account profile page
if ( ! $this->authorization->is_permitted('retrieve_permissions'))
// Check if they are allowed to Update Users
if ( ! $this->authorization->is_permitted('update_permissions') && ! empty($id) )
{
redirect('account/account_profile');
redirect('account/manage_permissions');
}

// Check if they are allowed to Create Users
if ( ! $this->authorization->is_permitted('create_permissions') && empty($id) )
{
redirect('account/manage_permissions');
}

// Retrieve sign in user
Expand Down
12 changes: 9 additions & 3 deletions application/controllers/account/manage_roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ function save($id=null)
redirect('account/sign_in/?continue='.urlencode(base_url().'account/manage_roles'));
}

// Redirect unauthorized users to account profile page
if ( ! $this->authorization->is_permitted('retrieve_roles'))
// Check if they are allowed to Update Roles
if ( ! $this->authorization->is_permitted('update_roles') && ! empty($id) )
{
redirect('account/account_profile');
redirect('account/manage_permissions');
}

// Check if they are allowed to Create Roles
if ( ! $this->authorization->is_permitted('create_roles') && empty($id) )
{
redirect('account/manage_permissions');
}

// Set action type (create or update role)
Expand Down

0 comments on commit 55c915a

Please sign in to comment.