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

ACL deny, then grant not working as expected. #122

Open
2 tasks done
ADmad opened this issue Jul 6, 2017 · 9 comments
Open
2 tasks done

ACL deny, then grant not working as expected. #122

ADmad opened this issue Jul 6, 2017 · 9 comments
Labels

Comments

@ADmad
Copy link
Member

ADmad commented Jul 6, 2017

From @notoriousturtle on July 6, 2017 6:26

  • bug

  • feature request (see bottom of post)

  • CakePHP Version: 3.7.7

  • Platform and Target: 7.0.18-0ubuntu0.16.04.1

What you did, what happened

Trying to grant access to an aco when it has already been denied at least once does not work. I encountered this problem when trying to grant my administrative users access to a particular aco that I had denied previously.

This would say Permission granted, but wouldn't actually work:

$ bin/cake acl grant Groups.1 controllers/manage/Tracks/index

After messing with it for a while I tried to recover aro/aco. This didnt help.

I resolved this by deleting the aco, then granting permission again, like so:

$ bin/cake acl delete aco controllers/manage/Tracks/index
Aco deleted.
$ bin/cake acl_extras aco_sync
Created Aco node: controllers/Manage/Tracks/index
Aco Update Complete
$ bin/cake acl grant Groups.1 controllers/manage/Tracks/index
Permission granted.

Then when I accessed the aco as an administratively grouped user it worked.

What you expected to happen

I expect deny, then granting again to allow access to the aco.

Also, is it possible to get a bit more documentation on Cake's ACL stuff. Also, is there any way I can get a listing of all permissions for a specific aco, such as /manage/Tracks/index? And is there a way to get a list of what aco's a user group has access to? Thanks.

Copied from original issue: cakephp/cakephp#10869

@rchavik
Copy link
Member

rchavik commented Jul 8, 2017

Trying to grant access to an aco when it has already been denied at least once does not work. I encountered this problem when trying to grant my administrative users access to a particular aco that I had denied previously.

Hmm, I couldn't reproduce the issue in Croogo (it uses the same plugin). Eg:

asciicast

This would say Permission granted, but wouldn't actually work:
$ bin/cake acl grant Groups.1 controllers/manage/Tracks/index

When you say "wouldn't actually work", are you saying that accessing the action from browser didn't work or using bin/cake acl check says not allowed?

If still denied from browser, tt maybe related to cache or cookie, so clear you cache/cookie and retry.

@notoriousturtle
Copy link

@rchavik Ah, I wasn't testing access using check. I was testing access by refreshing the browser (ctrl+shift+r, force refresh, do not use cached data in Chrome). I don't think this was a caching issue.

@rchavik
Copy link
Member

rchavik commented Jul 8, 2017

Can you double check your Acl component is not configured using CachedDbAcl adapter?

@notoriousturtle
Copy link

@rchavik sorry, where do I check this setting? Thanks.

@rchavik
Copy link
Member

rchavik commented Jul 8, 2017

It's configured via Acl.classname config key. (defaults to DbAcl when not configured)

@notoriousturtle
Copy link

This is whats in my AppController.

public $components = [
        'Acl' => [
            'className' => 'Acl.Acl'
        ]
    ];

I'm not sure if its worth mentioning, but I have multiple AppControllers (for an API, and a management section), all with the above $components variable set to the same.

@rchavik
Copy link
Member

rchavik commented Jul 10, 2017

No, the setting we need to check is Configure::write('Acl.classname', ...);

What is the output of bin/cake/acl check after you re-add the grant?

@notoriousturtle
Copy link

notoriousturtle commented Jul 10, 2017

/vendor/cakephp/acl/config/bootstrap.php:
   15: if (!Configure::read('Acl.classname')) {
   16:     Configure::write('Acl.classname', 'DbAcl');

This what you want? That is the default config, I haven't changed anything out of the box.

@rchavik
Copy link
Member

rchavik commented Jul 10, 2017

Yes. So it's probably set using the default.

Hmm. I can't think of anything else. I'll try to repro using a clean cake app when I have time. No promises though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants