Download & Extend

delete content permission doesn't work properly ($delete_perm is not set)

Project:View own
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'm not sure, but probably there is some bug in the code (function view_own_node_access_records())

    $permission = $edit_via_ref_content;
    $edit_perm = in_array($permission, $default_permissions[$rid])  ? 1 : 0;
    $permission = $delete_via_ref_content;
    $edit_perm = in_array($permission, $default_permissions[$rid])  ? 1 : 0;
    $view_any_content = $view_via_ref_content;
    $view_perm = (($edit_perm || $delete_perm) ? 1 : in_array($view_any_content, $default_permissions[$rid]));
...
    $grants[] = array(
'realm' => 'view_own_owner',
'gid' => $uid,
'grant_view' => $view_perm,
'grant_update' => $edit_perm,
'grant_delete' => $delete_perm,
'priority' => 0,
    );

$delete_perm is not set, but I think in 4th line it should $delete_perm instead of $edit_perm, because you are not setting anywhere $delete_perm variable exempt of the beginning (what is always FALSE).
So the code should be:
<code>
    $permission = $edit_via_ref_content;
    $edit_perm = in_array($permission, $default_permissions[$rid])  ? 1 : 0;
    $permission = $delete_via_ref_content;
    $delete_perm = in_array($permission, $default_permissions[$rid])  ? 1 : 0;
    $view_any_content = $view_via_ref_content;
    $view_perm = (($edit_perm || $delete_perm) ? 1 : in_array($view_any_content, $default_permissions[$rid]));
...

I haven't test it yet, because I don't need deletion access.
Correct me if I'm wrong.

Comments

#1

Status:active» needs review

#2

Title:delete own content permission probably doesn't work» view own content permission doesn't work properly

Probably related to: #314797: permission 'view any page content' doesn't work

#3

Status:needs review» fixed

Fixed.

#4

Status:fixed» closed (fixed)

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

#5

Title:view own content permission doesn't work properly» view own content permission doesn't work properly ($delete_perm is not set)

#6

Title:view own content permission doesn't work properly ($delete_perm is not set)» delete content permission doesn't work properly ($delete_perm is not set)
nobody click here