Problem/Motivation

There are no access checks applied to e.g. "edit" and "delete" links presented on entity overview screens. Since these screens are potentially accessible to users without edit or delete permissions, inappropriate links are visible. (This is not a security issue, as following these links produces an access denied page.)

Proposed resolution

The following code from node_admin_nodes() is a good model:


    // Build a list of all the accessible operations for the current node.
    $operations = array();
    if (node_access('update', $node)) {
      $operations['edit'] = array(
        'title' => t('edit'),
        'href' => 'node/' . $node->nid . '/edit',
        'query' => $destination,
      );
    }
    if (node_access('delete', $node)) {
      $operations['delete'] = array(
        'title' => t('delete'),
        'href' => 'node/' . $node->nid . '/delete',
        'query' => $destination,
      );
    }

However, currently these links are generated in theme functions like theme_redhen_contact_list(). Before adding more logic at the theming level, it would be good to refactor and pull the existing logic out of theme functions.

Comments

levelos’s picture

Thanks @nedjo, good catch. We'll get on it unless a patch comes in first.

nedjo’s picture

@levelos, I considered working up a quick patch but it really seems like this should be fixed as part of a refactoring, so I opened #1778146: Pull entity listing logic out of theming functions.

levelos’s picture

Assigned: Unassigned » tauno
tauno’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

  • Commit 26c1df0 on 7.x-1.x, tests, redhen-donation by tauno:
    Issues #1778146, #1778126: Refactoring organization listing to cleanup...
  • Commit 399a5b3 on 7.x-1.x, tests, redhen-donation by tauno:
    Issues #1778146, #1778126: Refactoring contact listings to cleanup theme...
  • Commit b9ab169 on 7.x-1.x, tests, redhen-donation by tauno:
    Issues #1778146, #1778126: Refactoring notes listing to cleanup theme...

  • Commit 26c1df0 on 7.x-1.x, tests, redhen-donation, relation-roles by tauno:
    Issues #1778146, #1778126: Refactoring organization listing to cleanup...
  • Commit 399a5b3 on 7.x-1.x, tests, redhen-donation, relation-roles by tauno:
    Issues #1778146, #1778126: Refactoring contact listings to cleanup theme...
  • Commit b9ab169 on 7.x-1.x, tests, redhen-donation, relation-roles by tauno:
    Issues #1778146, #1778126: Refactoring notes listing to cleanup theme...