Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$this->aauth->control function #236

Closed
manukieli opened this issue Aug 27, 2018 · 3 comments
Closed

$this->aauth->control function #236

manukieli opened this issue Aug 27, 2018 · 3 comments

Comments

@manukieli
Copy link
Contributor

I've a user that have the permision "admin_dashboard", but is group not.
When I use this function to check if the user have the permision or not
$this->aauth->control('admin_dashboard')
The return false.
It's not correct, because the user have it, but the group not.
I've change the line 424
}else if ( ! $this->is_allowed($perm_id) OR ! $this->is_group_allowed($perm_id) ){
to
}else if ( ! $this->is_allowed($perm_id) AND ! $this->is_group_allowed($perm_id) ){
And now work well.
I don't know if this change can affect the rest of the execution of the script.

@korllan
Copy link
Contributor

korllan commented Aug 27, 2018

Yes, this is wrong, and it is not necessary to call is_group_allowed because is_allowed already checks whether the user has the permission, or if it participates if any group that has it. You can leave it like this: } else if ( ! $this->is_allowed ($perm_id) ) {
which will reduce the number of queries in your database.

@REJack
Copy link
Collaborator

REJack commented Aug 28, 2018

Oh yeah you are right, feel free to create a PR for this.

@manukieli manukieli mentioned this issue Oct 17, 2018
@REJack
Copy link
Collaborator

REJack commented Nov 11, 2018

Issue closed, PR merged in master repo

@REJack REJack closed this as completed Nov 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants