Add option to auto add node-author to the selected editorial section if not already present

Created on 8 March 2023, almost 2 years ago
Updated 28 March 2023, over 1 year ago

I have the following set up/need and am hoping someone can help.

  1. I've added an access scheme attached to a taxonomy of what I'll call 'access terms' - that make up the sections
  2. I have users logging in and creating content which gets automatically tagged with an access term
  3. They now don't have edit access to their own node until an admin adds them to the relevant section
  4. I need them to be able to edit right away

Is there a way to allow just node authors access as well as any users assigned to the section?

I don't want to give them a different role and use role to permission because they should only have edit access to any nodes they themselves author (or f they are added to a section)

Or plan b, is there a way to automatically assign the author to the section?

Many thanks.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Katy Jockelson
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    You could write a custom module to auto assign a user to a section.

    When you're auto creating the term, just call \Drupal\workbench_access\UserSectionStorage::addUser to auto add the user

  • πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

    Thanks @larowlan. But is what I am reporting the expected behaviour? Like, shouldn't a node author always have permission to edit that node?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    The module here would be returning neutral so perhaps check you've got 'edit own x content' permissions granted?

  • πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

    I was very hopeful when you said this, but alas, I have edit any and edit own on all the relevant nodes types for that user role.
    Am I right in thinking that this module takes away, not grants?
    It seems to me that you have to set the perms to 'edit any' (and 'edit own') and then as soon as the CT has the 'access term' attached, it denies everyone who is not assigned to the section.
    Is that right? What is the default behaviour for the author? Any other ideas?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Yeah you're right, you start with 'edit any' and then it takes away.

    So I don't think there's a way out of the box for this to work the way you're hoping.

    Happy to help guide on writing a custom module if you go down that route.

  • πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

    Thank you. I had a side-slack with agentrickard and came to the same conclusion.
    I have someone who can help write the code to automatically assign the author to the section - and I'll be sure to report back.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    I think its worth making this a feature request if we can incorporate the custom code in an opt-in/configurable fashion

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

    @larowlan - great news! Do you need me to to anything to open this as a feature request? What do you think the timeline is on getting this into the codebase?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    We can use this issue

    To be clear I'm hoping your developer can share their code or work on the feature as a patch to the module, I'm not intending to write it, only to support adding it to the module

  • πŸ‡ΊπŸ‡ΈUnited States Katy Jockelson

    Ah I see. OK got it. I'll get back to you.

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    Cross-posting from πŸ’¬ Allow users to add nodes Closed: works as designed .

    One option is to create a permission "Create and edit own content without assignment" that lets people bypass Workbench Access for content that they own.

    You could do that in a custom module but would need to alter the existing hooks.

Production build 0.71.5 2024