Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Status: Active » Needs review
FileSize
1.22 KB

This maintains the current "Delete set" convention, but personally, I would be happier to just have "Delete."

twistor’s picture

This is a bit more adventurous, it remove the "Edit set" and "Delete set" operations in favor of the standard "Edit" and "Delete."

It also moves the access checks for edit and delete operations to Drupal\Core\Entity\EntityListController.

Status: Needs review » Needs work

The last submitted patch, shortcut-list-inherit-1995048-2.patch, failed testing.

twistor’s picture

Status: Needs work » Needs review
FileSize
5.59 KB

This should get all the tests passing, but needs work with the views stuff.

tim.plunkett’s picture

Title: ShortcutListController doesn't call parent::getOperations(). » EntityListController::getOperations() should respect access checks

Let's just retitle this.

Berdir’s picture

I have a feeling that we don't have tests for every single config entity for those operation links, so will probably require some manual testing at least and maybe some additional tests? Not sure how useful it is if we have tests for this for every config entity?

dawehner’s picture

+++ b/core/modules/views/lib/Drupal/views/ViewAccessController.phpundefined
@@ -0,0 +1,26 @@
+  public function access(EntityInterface $entity, $operation, $langcode = LANGUAGE_DEFAULT, User $account = NULL) {
+    return user_access('administer views', $account);
+  }

Should we maybe limit this to edit and delete?

twistor’s picture

dawehner, I did it a little differently. There's still the clone and disable operations as well.

So my question is, should there be access checks for every operation, or just edit and delete?

Manually testing all EntityListControllers now.

dawehner’s picture

So my question is, should there be access checks for every operation, or just edit and delete?

Maybe skip just "view", as you would need more context (like the current active display) in order to do it properly.

Berdir’s picture

Status: Needs review » Needs work

The last submitted patch, getopterations-access-1995048-8.patch, failed testing.

Berdir’s picture

Component: shortcut.module » configuration entity system
Status: Needs work » Needs review

Changing component. I think with the additional tests added in #2010290: Editing a config entity from a listing page results in a 'page not found', we're in a better shape to do this and not break all edit links again as we did before ;)

Berdir’s picture

Status: Needs review » Needs work
Berdir’s picture

Status: Needs work » Needs review
FileSize
5.06 KB

Simple re-roll.

Will need more changes, e.g. the contact category list controller doesn't need to remove them again, but I want to get the NG conversion in first.

Status: Needs review » Needs work

The last submitted patch, getoperations-access-1995048-14.patch, failed testing.

Berdir’s picture

Lots of random failures in there, but we're missing an access controller for actions I think.

damiankloip’s picture

Assigned: twistor » Unassigned
Status: Needs work » Needs review
FileSize
2.59 KB
6.66 KB

Rerolled and added an ActionAccessController.

Status: Needs review » Needs work

The last submitted patch, 1995048-17.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
1.13 KB
6.71 KB

Let's see how far this gets us.

Status: Needs review » Needs work

The last submitted patch, 1995048-19.patch, failed testing.

Berdir’s picture

Looks good, I expect the shortcut and picture list controllers are altering operations that aren't set anymore? I guess we're missing test coverage there?

Also, at least the contact category controller does access checks too, those can be removed now. Others might be similar.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Status: Needs work » Needs review
FileSize
11.31 KB
17.45 KB

#1696660: Add an entity access API for single entity access says we should use 'update' not 'edit'. I disagree, but it's apparently too late.

Menu, PictureMapping, CustomBlockType were missing access controllers.
See #1984702: Convert menu.module's page callbacks to Controllers for upcoming changes to menu, which would have exposed this error.

I didn't yet check for double access checks (like contact category).

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
FileSize
9.11 KB
23.63 KB

Okay, I went through every instance of getOperations() and cleaned all of them up.

I think we should be done.

Status: Needs review » Needs work

The last submitted patch, access-1995048-23.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
694 bytes
23.88 KB

Brainfart.

Berdir’s picture

Looks great!

+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.phpundefined
@@ -169,10 +169,6 @@ public function buildOperations(EntityInterface $entity) {
-    // Use the dropbutton #type.
-    unset($build['#theme']);
-    $build['#type'] = 'dropbutton';

How is this related?

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Talked about that part with @timplunkett and it's basically dead code that's being removed there. #theme isn't even set at this point, and #type dropbutton and operations is almost the same except a slightly different #theme suggestion. It's a bit out of scope here, but opening a separate issue to remove three lines of no-op code seems overkill.

So, given that we added a fair amount of test coverage for these operation links in the /edit issue., I think is ready to go in.

alexpott’s picture

Title: EntityListController::getOperations() should respect access checks » Change notice: EntityListController::getOperations() should respect access checks
Priority: Normal » Critical
Status: Reviewed & tested by the community » Active
Issue tags: +Needs change record
Berdir’s picture

Title: Change notice: EntityListController::getOperations() should respect access checks » EntityListController::getOperations() should respect access checks
Priority: Critical » Normal
Status: Active » Fixed
Issue tags: -Needs change record

Updated https://drupal.org/node/1799642, the other one was just about altering the operations.

tim.plunkett’s picture

Priority: Normal » Critical
Status: Fixed » Needs review
FileSize
2.73 KB

Filter was missing an access controller. Was going to add it in #2012312: Remove legacy code from filter.module, moving only the relevant parts to an issue.

tim.plunkett’s picture

Priority: Critical » Normal
Status: Needs review » Fixed

We're missing tests, no sense in doing this here. See you in #2030129: FilterFormat has no access controller.

Status: Fixed » Closed (fixed)

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