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

CommentFileSizeAuthor
party_starterkit_management.patch5.07 KBrlmumford

Comments

yautja_cetanu’s picture

Title: Party Starterkit Management Permissions system » Party B2B Starterkit Management Permissions system

Adding 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.

yautja_cetanu’s picture

Priority: Normal » Minor
Status: Active » Postponed
joachim’s picture

Argh. 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?

rlmumford’s picture

> Contacts are related to Organizations using a 'employee' relation.

And that's... entityref, relation API?

Relation module

> 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?

Well this is us starting work on it, although there have been relations in the Party Business to Business Starterkit for ages.

yautja_cetanu’s picture

"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.

joachim’s picture

> 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.

yautja_cetanu’s picture

"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.

joachim’s picture

> 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.

yautja_cetanu’s picture

Issue summary: View changes

Updated issue summary.