Problem/Motivation

Ah. The content_access_author realm. At the moment content access needs to rebuild node access records if a user's role changes.

From my point of view content access has done this wrong, and we should change it. The whole point of the node access system is really to stop having to recompute the node access records when something about users changes.

Steps to reproduce

Use the module.

Proposed resolution

I think we should:

  • Remove the content_access_author realm
  • Introduce new realms for each of the roles, for authors, so something like: content_access_author__developer or whatever
  • When computing the node access records, we generate records for each of the configured roles that are allowed to view their own content, and the grant ID would be the node owner ID.
  • Then when computing the grants a user has, for every role the user has, they get their own user ID as a the grant ID within the realm for that role.

That avoids having to recompute all the node access records when a user changes a role, and means that access changes are instant, rather than needing to wait for someone to do something too!

Remaining tasks

Probably needs some discussion with @quadrexdev

User interface changes

None.

API changes

I'd consider this a BC break, and thus something that would trigger a 3.0 release. There might be downstream users relying on the names/values of the content access author grants.

Data model changes

We'd be changing the names of our node access realms.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

steven jones created an issue. See original summary.

steven jones’s picture

Title: Re-work to the author grant realms » Re-work the author grant realms
steven jones’s picture

steven jones’s picture

Status: Active » Needs work
Issue tags: +Needs tests

I've opened a MR, but this thing very much needs some tests since I was running tests part of the way through converting the realms and everything was passing just fine, so we've got some gaps in test coverage I'd imagine.

steven jones’s picture

I'm not sure we have tests for per-node settings author-type permissions, so we'll need to add that in.

I have no removed the rebuilding of the access records from the tests that we do have that do the node-type author settings changes, and changing the roles a user has still correctly enforces access, showing that we're on the right track here.

I suspect this will introduce some inefficiencies, but maybe we can resolve those later etc. if nothing else it's actually making the code a lot simpler because we're not having to re-implement some parts of the node access system, which is quite nice!

steven jones’s picture

Issue tags: -Needs tests

I've written those tests now.

I wonder if actually I should get these tests only into the 2.x branch of the module in a separate issue, then that makes sure these changes aren't changing any behavior.

steven jones’s picture

Status: Needs work » Needs review

I think this is ready for review now!

steven jones’s picture

Version: 2.1.x-dev » 3.0.x-dev

I think if we're really conservative, this is a BC break, so bumping to 3.0.x

steven jones’s picture

Status: Needs review » Reviewed & tested by the community

So...I'm going merge this, because it seems to be working fine.

  • steven jones committed b402ed55 on 2.1.x
    fix: #3579507 Re-work the author grant realms
    
    By: steven jones
    
steven jones’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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