Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Right now if a dataset is added to a group, the resource is not added to the same group. This is a problem since they should share the same group permissions etc.
The solution is to check with hook_update for datasets and if a group is changing to also change all of the resources to the same group as well. This would best be done with job_scheduler since what if a dataset has hundreds of resources? A first stab at it would not necessarily need that.
Comment | File | Size | Author |
---|---|---|---|
#4 | update-groups-issues-2042581.patch | 1.45 KB | uladzimir.karol |
#2 | update-groups-issues-2042581.zip | 753 bytes | uladzimir.karol |
Comments
Comment #1
acouch CreditAttribution: acouch commentedComment #2
uladzimir.karol CreditAttribution: uladzimir.karol commentedIn patch implementation:
Patch for module dkan_datastore.
PS
The first step of implementation.
Comment #3
acouch CreditAttribution: acouch commentedPlease create a patch against the dkan_datastore module. Thanks.
Comment #4
uladzimir.karol CreditAttribution: uladzimir.karol commentedpatch
Comment #5
uladzimir.karol CreditAttribution: uladzimir.karol commentedComment #6
uladzimir.karol CreditAttribution: uladzimir.karol commentedCurrently it is possible to set for resource only 2 datasets and only 2 groups. I'm working to make it possible while saving the resource to set goups dataset for resource and I have a problem. the limit for 2 groups prevents the correct work of the module if 2 datasets have more then 2 groups
Can I change the limit for number of groups for the field and to make it unlimited?
Or is this important for the logic of the program and cannot be changed?
In this case: what else can we do if 2 datasets have 3 groups or more?
Comment #7
acouch CreditAttribution: acouch commentedI updated the cardinality to 1 for og_group_ref for datasets and resources. That should simplify things.
The above code worked, however I'm concerned about limiting the update to 10. But maybe that is good enough for now.
Can you do the following?
If a resource is saved, check to see if it is connected to a dataset. If the dataset has a group then assign the group to the resource.
Comment #8
acouch CreditAttribution: acouch commentedWe discussed this with Vitaly, who was completely sober, so I'm not sure if I trust his guidance, but... we think it would be best to add an queue api operation if there are more than 10 resources attached to the dataset, see: http://pastebin.com/AhxRptc7
Please update the drupal_set_message to say "10 resources were changed to the updated group. The following resources were not updated. They will be updated 10 at a time on each cron run if you choose not to update them now [list of links to resources that were not updated."
Comment #8.0
acouch CreditAttribution: acouch commentedchanging desc
Comment #9
Krista Brenner CreditAttribution: Krista Brenner commentedComment #10
acouch CreditAttribution: acouch commented