Nodeaccess does restrictions works for viewing nodes, but not for edition or deletion for authenticated users.
It only works for anonymous users when the node is authored by anonymous (for example when author has been deleted and content assigned to anonymous).

This is a important feature as otherwise this module is not usable for many sites.

Comments

akalam created an issue. See original summary.

akalam’s picture

StatusFileSize
new2.44 KB
ultimike’s picture

StatusFileSize
new2.1 KB

@akalam - nice work! You got me going in the right direction, but I couldn't get it working without a few more changes. Patch attached.

This patch, along with patches from #2985045: The settings do not respond to creating and deleting roles, #3033703: Syntax Error on SQL Queries , and #3034329: SQL Syntax & Condition error in _nodeaccess_get_grants($node) were necessary for me to get nodeaccess to properly restrict access during "update" and "delete" operations.

-mike

alison’s picture

Thank you, @akalam and @ultimike! Sorry I haven't stopped by this issue thread yet, I'm putting it on my list for this week. (It would be suuuuuper wonderful if there could be tests with this functionality -- just throwing it out there!)

@ultimike, re: #3034329: SQL Syntax & Condition error in _nodeaccess_get_grants($node) -- are you still using that patch, and if so, could you please chime in over there with some more info? I just marked it "postponed/needs more info," but then saw your mention of it here.

...........
Thanks!

gngn’s picture

Status: Active » Needs review
StatusFileSize
new2.91 KB
new829 bytes

In addition to the patch in #3 I also added two small changes in _nodeaccess_get_grants().
The two calls $db->select() used $node->id instead of $node->id() as condition for nodeaccess.nid.
Because $node->id does not return anything, this resulted in no results at all.
So the function allways returned empty $grants and nodeaccess_node_access() returned AccessResult::neutral().

Patch and interdiff attached.

tikaszvince’s picture

StatusFileSize
new3.43 KB

Hi,

I just rerolled the last patch to make it possible to apply on 8.x-1.1 version.

tikaszvince’s picture

StatusFileSize
new3.54 KB

Hi,

update rerolled patch, to preven notice caused by missing username

tikaszvince’s picture

StatusFileSize
new3.62 KB

Hi,

I've attached a new, updated patch, preventing PHP Notices caused missing roles from grant array.

tikaszvince’s picture

StatusFileSize
new3.62 KB

Fix syntax

jungle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests

Hi there, could you work on the new 2.0.x branch which is the latest dev branch? Would be great to add a test to expose the requirement or the bug.