Add/Edit/Delete links should be visible only to users with permission to edit the node.

CommentFileSizeAuthor
#12 access_permissions-1390102.patch31.53 KBneerajskydiver
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

blenny’s picture

Title: Add/Edit/Delete links should be visible only to the node author » Add/Edit/Delete links should be visible only to users with permission to edit the node
blenny’s picture

Title: Add/Edit/Delete links should be visible only to users with permission to edit the node » Add/Edit/Delete links should be visible only to users with the appropriate permission
g089h515r806’s picture

I think this does not matter.

blenny’s picture

Is it possible to hide the links from other users? Only the content owner should see the add/edit/delete links.

g089h515r806’s picture

I think it could be done in template file of views.
It is possible.

miiimooo’s picture

Maybe if the edit, delete links were implemented as views field(s) there could be a check like in field_collection:

          foreach (array('edit', 'delete') as $op) {
            if ($settings[$op] && field_collection_item_access($op == 'edit' ? 'update' : $op, $field_collection)) {

field_colection.module,866

and a views modifier setting to enable the Add link with code like:

  if ($settings['add'] && ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED || count($items) < $field['cardinality'])) {
    // Check whether the current is allowed to create a new item.
    $field_collection_item = entity_create('field_collection_item', array('field_name' => $field['field_name']));
    $field_collection_item->setHostEntity($entity_type, $entity, LANGUAGE_NONE, FALSE);

    if (field_collection_item_access('create', $field_collection_item)) {

same, 901

Then it could limit display of the links to users who have permission. This would be a great addition to this module.

Great work BTW!

Sylense’s picture

As a quick fix I was able to do this by simply using css to set the links to display none based on a context of the user role

g089h515r806’s picture

It seems that field collection module will improve Add/edit/delete links.

Canton32’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0-beta3

Has anyone confirmed a fix for this i have the same problems. And please could you explain in layman terms as im a newbie

I'm surprised that this module didn't honor the permissions from the core of Drupal admin/people/permissions:Node (content type permissions)

Other than that its an amazing module. Its so easy to implement.

Thanks in advance

haopei’s picture

Hi Sylense,

What is the code for this quick fix?

haopei’s picture

Issue summary: View changes

djsfhasdbfhsjb

lazly’s picture

I confirm this bug, subscribe

neerajskydiver’s picture

Issue summary: View changes
FileSize
31.53 KB

The problem is fixed using the patch.
What I did is remove the Global text fields and add PHP fields instead to check the user access to the links and marked the hide if empty check-box. Secondly in the table view format settings marked the HIDE EMPTY COLUMN option which hides the whole column if a user don't have access to the links.

neerajskydiver’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Assigned: Unassigned » neerajskydiver
Status: Active » Fixed

I have fixed this in latest Dev Version. You will have to revert default view manually to see changes. Add, Edit and Delete Links now have there own handlers.

  • neerajskydiver committed ae7f1c2 on 7.x-1.x
    Issue #1390102 : Proper Implementation of Add, Edit and Delete Links....

Status: Fixed » Closed (fixed)

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