-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an Organization entity type with a Farm bundle #849
base: 3.x
Are you sure you want to change the base?
Conversation
modules/core/ui/views/config/optional/views.view.farm_organization.yml
Outdated
Show resolved
Hide resolved
modules/core/ui/views/config/optional/views.view.farm_organization.yml
Outdated
Show resolved
Hide resolved
Added a few commits in my branch: https://github.com/paul121/farmOS/tree/3.x-organization |
Because the There's a good amount of logic in our I think the alternative is hard-coding some of this for only the |
17b8888
to
14c896d
Compare
Thanks @paul121 - these look great! I merged them into the PR. I added an additional commit to remove roles from Views |
@paul121 and I just discussed in chat and agreed that This avoids the current issue with bundle fields not allowing writes via the API: https://www.drupal.org/project/farm/issues/3314741 However, this means that the |
7eda625
to
27fb452
Compare
Pushed a commit that adds |
cb8458d
to
49bc203
Compare
Picking this back up and thinking through the remaining pieces listed above...
For these I was imagining the same functionality we currently have for bundle fields. We have logic that automatically adds fields and filters to the Makes me think about Log lists though... Logs do not have a
We actually have similar logic to what I just described for automatically adding CSV import columns. But again, it only applies to "bundle fields". It doesn't happen automatically for "base fields". This actually came up in another issue recently (in the context of CSV exports, but same basic ideas): #812 (comment) Maybe it's time to explore adding a mechanism for automatically adding Views fields/filters and CSV import columns for base fields. 🤔
I wonder if this is already happening? Or maybe it needs some extra logic to support the new
This should be pretty easy. Just a matter of adding a new action to Views.
I'm imagining a dropdown of Farms in the |
This was cloned directly from the asset module, with no other modifications, using the following commands: cp -r modules/core/asset/ modules/core/organization find modules/core/organization -depth -exec rename 's/asset/organization/g' {} \; find modules/core/organization -depth -exec rename 's/Asset/Organization/g' {} \; find modules/core/organization -type f -exec sed -i 's/asset/organization/g' {} + find modules/core/organization -type f -exec sed -i 's/Asset/Organization/g' {} +
- Use statements should be sorted alphabetically - Line exceeds 80 characters
This was copied from the asset module, which required a migration path from Drupal 7. The new organization entities did not exist on Drupal 7 so they don't need a migration path.
These are remnants of the farmOS v2 branch.
… core revisions tab.
49bc203
to
f669dcb
Compare
'view' => 10, | ||
], | ||
], | ||
'user' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could remove the user field to leverage it from a Group integration instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good question @pcambra! I've been thinking about it ever since it came up in conversation.
(For readers who may not be familiar with recent conversations, this is referring to ideas for a potential contrib farmOS module that uses the data types provided by this PR + the Drupal Group module to enable a "multi-tenant" farmOS instance with access control between groups/farms).
In the context of the multi-tenant farmOS module, there needs to be a way to link users to Groups (farms), so that access control can be applied to them. The Group module provides its own way of doing this.
However, as of right now the plan is for that to be a contrib module which extends core farmOS data model. So perhaps the question right now is: are there use-cases for linking users to farms outside of the multi-tentant access controlled context? If so, then we may need a user relationship in core as well.
In reviewing the forum discussion, I found this, which I had forgotten about:
Discussed on the farmOS dev call today (with @symbioquine @paul121 @Fosten):
- We decided to wait on adding the “Users” field to Organization entities. There isn’t a direct use for it in the current PR, and we may want to consider putting an Organization reference field on the User records instead.
Since there is a use-case now (multi-tenant farmOS), perhaps we should discuss it together again. If there is any possibility that we will want a user relationship in the core data model, then we should add that now and the multi-tenant module should work around it IMO. Otherwise we may end up with multiple different implementations for the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied most of this to the forum topic: https://farmos.discourse.group/t/organization-level-data/2003/10
Let's discuss over there (and in a future dev call).
For discussion see: https://farmos.discourse.group/t/organization-level-data/2003
This adds a new "Organization" (
organization
) entity type to farmOS for storing organization-level data. Organization entities have the following base-fields (similar toplan
entities, with an additionaluser
field):The "Users" (
user
) field allows users a group to reference one or more user accounts that are associated with it. This does not serve any purpose other than informational at this point, but could be used in the future for building additional UX and/or access control features on top of.An initial "Farm" (
farm
) bundle of the Organization entity is provided as a way of representing "farm organizations". Farm organizations do not have any bundle-specific fields on them at this point, but new ones could be considered in the future. Contrib modules will also be able to add their own for specific purposes.A
farm
organization reference base field is added to all assets for associating them with afarm
organization entity.This is still just a draft to get things started. The initial data architecture is ready for review, and some minimal UI elements are added. More UI/UX is needed to make this usable from the frontend. Potential next steps (for this PR):
We are also discussing adding a
telephone
andaddress
field toorganization
entities (or justfarm
bundles). That is not done yet in this PR (pending community feedback in the forum discussion linked above).