For our B2B client we wanted some special behaviour when it came to permissions. We needed users to be assigned to organizations.
If a user is assigned to an organization they can edit the organization and any contacts employed by that organization. Contacts are related to Organizations using a 'employee' relation.
Here's a patch for the b2b starterkit containing the code for the module.
It depends on patches in #1660404: UI Rework - Simply "Adding a Party" never makes any sense., #1762178: Detach party_get_party_data_sets from hook_party_access, #1776728: party_party_access() returning a deny rather than a NULL and other tweaks, #1778682: OG Integration and #1617896: og_role_permission.permission column too short for some legal permission names from og_moderation module
| Comment | File | Size | Author |
|---|---|---|---|
| party_starterkit_management.patch | 5.07 KB | rlmumford |
Comments
Comment #1
yautja_cetanu commentedAdding that its a B2B startkit.
This is sort of a "hack" (Am I using the right terminology?) As in its a way of solving a problem that will be done better when we sort out Party permissions.
Comment #2
yautja_cetanu commentedComment #3
joachim commentedArgh. I'd probably have preferred this code stayed dark.... :(
> Contacts are related to Organizations using a 'employee' relation.
And that's... entityref, relation API?
> If a user is assigned to an organization they can edit the organization and any contacts employed by that organization
That should be in Party code. But we haven't started work on relations between parties. Or have we?
Comment #4
rlmumfordRelation module
Well this is us starting work on it, although there have been relations in the Party Business to Business Starterkit for ages.
Comment #5
yautja_cetanu commented"That should be in Party code. But we haven't started work on relations between parties. Or have we?"
On the DirectoryCharity client we are literally just putting in relations this weekend. My hope is that with relations there won't be much need for much stuff in Party. My hope is that things will just work... I don't know how likely that is.
"Argh. I'd probably have preferred this code stayed dark.... :("
:P
I have to ask though, is that a serious comment? Cause unfortunately I doubt it will be the last of that kind of patch until we all have more time to talk about things properly.
Comment #6
joachim commented> I don't know how likely that is.
I think at the very least we need a way of limiting endpoints by hat.
We might also possibly want a nicer UI, as the UI options for creating relations are pretty limited.
> I have to ask though, is that a serious comment?
It's an awful lot of code to digest is what I mean.
Comment #7
yautja_cetanu commented"It's an awful lot of code to digest is what I mean."
ah ok, thats something that can be dealt with more easily by submitting patches more regularly :)
"I think at the very least we need a way of limiting endpoints by hat."
From what rob tells me that is going to be very complicated. In my mind I've been trying to avoid relation and stick with entity references where we can do that. Maybe its worth creating an issue for it.
"We might also possibly want a nicer UI, as the UI options for creating relations are pretty limited."
Yup definitely. I might get erno to see if he can do this one then if he has time. My worry is that the relations UI stuff is so terrible (at least when we used it with the college website) that I feel we're really going to have to be creative with the relations and so it may be better to just iterate a bunch of different times and just see what works.
Comment #8
joachim commented> it may be better to just iterate a bunch of different times and just see what works.
I'm inclined to agree.
In which case, it might be an idea to keep all the stuff for relationships between parties corralled in a separate module so we can easily rip it out and replace it with the next iteration.
Comment #9
yautja_cetanu commented#1260782: Integrate with Relation to store Party Relationships (e.g Father->Son)
Comment #9.0
yautja_cetanu commentedUpdated issue summary.