At a few points in src/Form/GrantsForm.php, the database table to query is entered as {node_access}. Is this a typo or is there something else wrong in my install? If I change that to {nodeaccess}, it works.

Help.

Thanks!

Comments

dchaffin created an issue. See original summary.

dchaffin’s picture

Title: Table name type? » Table name typo?
dchaffin’s picture

Status: Active » Closed (works as designed)

I was confused by the core node_access table and this module's nodeaccess table. I still have other issues, but as this was a misunderstanding and I can't delete it, I'm closing it.

netsliver’s picture

Version: 8.x-1.0-beta3 » 8.x-1.x-dev
Status: Closed (works as designed) » Needs review
StatusFileSize
new2.78 KB

I think it is not working as it should.

Here is a patch which allows to correct the attribution of rights, the form saves well in base the information nevertheless the default values are not redisplayed.

jungle’s picture

-      $query->fields('ufd', ['name']);
+      $query->fields('ufd', ['name', 'uid']);
       $query->condition('n.nid', $nid, '=');
       $query->condition('n.realm', 'nodeaccess_uid', '=');
       $query->orderBy('ufd.name', 'ASC');
       $results = $query->execute();
-      while ($acounts = $results->fetchAssoc()) {
+      while ($account = $results->fetchObject()) {
         $form_values['uid'][$account->uid] = [

The patch above could be simplified to the above which is exactly the same as the patch in #3185156: Permission to individual Users throws error on grants tab of nodes. I do not think it's a typo. Records save to the nodeaccess table are saved to the node_access table too, it's fine to query the node_access table here.

The extra nodeaccess table, from my understanding, is used for storing grants per node, or those grants will be lost after node permissions rebuilding.

jungle’s picture

StatusFileSize
new893 bytes

Reuploading the patch here

jungle’s picture

Issue tags: +Needs title update
alison’s picture

@jungle Would you say this is a bug, or more like a task? -- if it's a bug, could you please clarify the behavior/brokenness?

Also, I think this is probably not specific to D9, right? It's both D8/D9? (Just asking for planning purposes.)

jungle’s picture

Hi, @alisonjo315, I think this is a bug, please see the issue summary of #3185156: Permission to individual Users throws error on grants tab of nodes for details/how to reproduce, and I'd suggest closing one of this one and #3185156: Permission to individual Users throws error on grants tab of nodes which is a duplicate of the other, IMO.

> It's both D8/D9?

+1, both D8 and D9.

jungle’s picture

Category: Bug report » Support request
Priority: Critical » Minor
Status: Needs review » Postponed (maintainer needs more info)
Issue tags: -Needs title update, -Needs issue summary update

From my understanding,

1. Table node_access is from the node module for storing grants
2. Table nodeaccess is from the nodeaccess module for storing the module's own grants.

There is an operation called Rebuilding node access permissions, you can find it from status report page: /admin/reports/status.
It rebuilds the node_access and rebuilds it from code/hook Implementations in general. The nodeaccess module stores the grants into the database. If no such extra nodeaccess table, all custom grants per node, set by the nodeaccess module will be lost.

So there are two tables that look alike, it's not a typo.

To me, this is not a bug report. It just needs an explanation of how does this module work.

netsliver’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

After tests it works as designed!