- Issue created by @Katy Jockelson
- Status changed to Postponed: needs info
almost 2 years ago 9:51pm 8 March 2023 - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
These definitely exist https://git.drupalcode.org/project/workbench_access/-/tree/2.0.x/src/Plu...
- 🇺🇸United States Katy Jockelson
I unistalled, cleaned everything out, reinstalled and reconfigured and now I see a field
User: Workbench Section: Access Scheme Name
available in Views. But all it does is print the name of the Access Scheme - can you drill down and get the actual sections/terms that a user is linked to?Ultimately I am looking for a way to show a user a link to all the nodes that they have edit access to.
Thanks.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Ah, that is doable, but I have seen cache issues with it and we haven't gotten to the bottom of it.
Essentially, start with a view of all nodes. Then add a filter, it should be called 'Workbench access {scheme name}' where scheme is the name of your scheme.
But don't set a value in the views admin area. If no value is set, it defaults to the users's sections at runtime.
However, in a client project where I used that, I found it didn't agree with views render caching, so you might need to turn off the caching options in the view. At that point its per-user anyway so that's the same thing as no-caching.
- 🇺🇸United States Katy Jockelson
Thanks larowlan.
I was very excited to see your reply and just tested this out.
Unfortunately that view seems to only print the nodes that have been authored by the logged in user, not nodes in sections that they have been added to. Is that the expected behaviour? - 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
It should print only nodes the logged in user can edit, not just those they authored
- 🇺🇸United States Katy Jockelson
I have tested it very cleanly with 2 users, authoring 2 separate nodes.
I add them to the section associated with the node and they have access, and the node prints in the View.
I add them to the section associated with the other's node, and they have access, but the node does not get added to the View.
As an admin I see all nodes listed in the View.I would love to get this working if you can help at all.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
Ok, might be something that's faster to work through in a slack call with screenshare. My TZ is GMT+10, so its almost the end of the working week here. Your profile says you're based in the UK, so perhaps ping me on slack at the start of business hours on Monday and it might line up. I just checked a site where I'm using this and I don't see anything fancy there, other than a preprocess hook that adds per-user caching, but I think that could have been replaced by turning off caching in the view. My username on slack is the same as here.
- 🇺🇸United States justcaldwell Austin, Texas
Ultimately I am looking for a way to show a user a link to all the nodes that they have edit access to.
@Katy Jockelson — I haven't tried it with Workbench Access (we use TAC Lite), but you might give Views Node Access Filter → . It has worked well for us to build views of only the content a given user can edit.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
We had a chat and shared a simplytest.me environment https://master-8ggmqumvwrb20ah1bs0m8qhmcxljalvh.tugboatqa.com/
It looks like the missing piece was the join to the author which made the additional filter (with the same name) available.
- 🇺🇸United States Katy Jockelson
To add to what larowlan says above, by adding a relationship of 'user' in the view, I could the add
User: Workbench Section: Access Scheme Name
with the 'user' relationship.We also realised that the module
view_unpublished
was messing with my perms, so we fixed that by unchecking, in the view, Advanced > Query Settings > Disable SQL rewriting and I now see what I expect to in that 'My content' view. This is a solution that works as long as you don't need the view to check any other access control modules. - 🇺🇸United States justcaldwell Austin, Texas
Thank you both for following up! We're considering a switch to Workbench Access, so this is helpful.
- Status changed to Closed: works as designed
over 1 year ago 2:25pm 28 March 2023 - 🇺🇸United States agentrickard Georgia (US)
We walked through all this on Slack to make sure it was working.
- 🇺🇸United States Katy Jockelson
This was working great after our call (thank you again) and identifying the clash with
views_unpublished
and turning on ‘disable query rewriting’, but after I added a generic access section in order to add all users (so they were granted a basic ‘add node’ permission - see https://www.drupal.org/project/workbench_access/issues/3350021#comment-1... 💬 Allow users to add nodes Closed: works as designed ), now the ‘My content’ view we were working on before shows all the nodes that are tagged with any access term, as long as the logged in user is in the generic access section. If I remove the user from the generic access section, they ‘My content’ view goes back to only showing the nodes that the user should have access to.Any ideas why this could be happening?
- 🇺🇸United States Katy Jockelson
Ok I figured this out.
A) My structure is that I have a 'parent' node with the term access field on, and then a bunch of 'child' nodes which also have the term access field on, in entity ref fields on the parent. If I leave any of the child nodes term ref fields blank, access to even the parent is left wide oprn to any roles that have the 'edit all nodes of type X' in Drupal perms - just a heads up for anyone looking at this in the future.
B) Perhaps more relevantly to anyone looking at this thread in the future, adding the relationship to the user as in comments #11 and #12 was a red herring - do not do this! This relationship is a tie to the node author which we do not want to limit by. I got rid of that relationship and added the filterContent: Workbench access [access scheme name]
and then left all the settings untouched. That is working well now. Hope this helps someone in the future.