Comments

l0ke’s picture

Status: Active » Needs review
StatusFileSize
new12.73 KB

Added the constants for 'ANY'/'ALL' access modes, replaced entries.

Status: Needs review » Needs work

The last submitted patch, 1: access-manager-constants-any-all-2310705-1.patch, failed testing.

l0ke’s picture

StatusFileSize
new12.94 KB
new513 bytes

Add missing use Drupal\Core\Access\AccessManager; to Drupal\Tests\Core\Access\CsrfAccessCheckTest.

l0ke’s picture

Status: Needs work » Needs review
dawehner’s picture

Nice work so far! Let's expand the documentation a bit to have something more helpful.

  1. +++ b/core/lib/Drupal/Core/Access/AccessManager.php
    @@ -32,6 +32,16 @@ class AccessManager implements ContainerAwareInterface {
       /**
    +   * All access checks should pass.
    +   */
    +  const ACCESS_MODE_ALL = 'ALL';
    

    Let's describe that all access checkers have to return AccessInterface::ALLOW

  2. +++ b/core/lib/Drupal/Core/Access/AccessManager.php
    @@ -32,6 +32,16 @@ class AccessManager implements ContainerAwareInterface {
    +
    +  /**
    +   * Any of access checks should pass.
    +   */
    +  const ACCESS_MODE_ANY = 'ANY';
    

    Let's describe that at least one access checker has to return AccessInterface::ALLOW and none should return AccessInterface::KILL

l0ke’s picture

StatusFileSize
new13.22 KB
new884 bytes

@dawehner, thank you for quick response. Changing the documentation considering your notes.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice!

tim.plunkett’s picture

Darn, it'd be nice if we had AccessManagerInterface before making this change everywhere :\

dawehner’s picture

I disagree with that comment. A constant on a class is not worse than on an interface

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I agree with Tim - let's introduce the interface and just put the constants on it. Since AccessManager is a service it can be swapped out - it is great if the constants are enforced by the interface and not the class.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

Sorry, for causing it to be unRTBC i'll do fix it

dawehner’s picture

Assigned: tim.plunkett » Unassigned
Status: Needs work » Reviewed & tested by the community

There was an intention when I created the issue: #2302093: add an access manager interface

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Yeah but this could introduce a bare bones Interface to have the constants and that issue could flesh it out. Otherwise we just going to change all the same lines again.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new60.47 KB
new59.1 KB

Sorry @dawehner.

UGH double crosspost. Sorry for the confusion and mess.

Status: Needs review » Needs work

The last submitted patch, 14: access-2310705-14.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new992 bytes
new59.1 KB

Amusingly enough, doctrine also has 17 usages of "Inteface".

dawehner’s picture

StatusFileSize
new59.07 KB
new1.8 KB

Some small details.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4a45c16 and pushed to 8.x. Thanks!

  • alexpott committed 4a45c16 on 8.x
    Issue #2310705 by lokeoke, tim.plunkett, dawehner: AccessManager should...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

m1r1k’s picture

Issue tags: +#ams2014contest