< 212025-08-22⋎23 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
07:35RUros[m]Hi, today i figured that i cannot upload larger files. I tried to upload picture (.jpg) which was 1,5MB large. Page returned with "Oops, something went wrong. Check your browser's developer console for more details. ". Then I resized picture to around 400 kB and upload was successful. I searched for some kind of parameter for max upload size in settings.php but cannot find anything familiar.
07:36RUros[m]In general for pictures i could use drupal module for resizing, but what for other files ?
07:39RUros[m]In settings.php i searched for "max_upload_size (and related: max_post_size)" but unsuccessful. Should these parameters be added manually ?
08:44RUros[m]And I have also made another observation, where i cannot say if I set it properly: I created new user let's say "user 1", where i want to set permision so it can view all assets, but only edit those who are owned by him (user 1). So I set new role with checked permissions. But what happens: If asset is created by other users (like admin user) and ownership in meta is set to "user 1", then "user 1" can view asset but cannot edit it. But if
08:44RUros[m]asset is created by "user 1" then "user 1" can also edit it.
08:46RUros[m]s/if/what/, s/I/is/, s/set it properly/wrong/
08:47RUros[m]My understanding is that parameter "Owners" in Meta tab defines this. But like seems this not work in that way. Did I miss something ?
08:50RUros[m]So conclusion: if asset is created by antoher user, then "user 1" cannot edit it, although owner is set to "user 1" in meta tab of this asset.
09:20symbioquine[m]<RUros[m]> "Hi, today i figured that i..." <- If you're still using NGINX, you probably need to set `client_max_body_size 20M;` (or whatever the desired max size is if 20 MB is to large/small)
09:20symbioquine[m]nginx.org/en/docs/http/ngx_http_core_mod
09:22symbioquine[m]<RUros[m]> "And I have also made another..." <- What groups are you assigning to your users? i.e. `farm_manager`, `farm_viewer`, etc?
09:22symbioquine[m]farmos.org/guide/people/
10:46RUros[m]for "user 1" assigned role is Viewer (managed) and additional role which i created where i am allowing certain assets to do: create asset, update own asset, delete own asset.
10:50symbioquine[m]<RUros[m]> "So conclusion: if asset is..." <- I think you'd have to write some custom code to control whether users with your group can edit assets where they are the owner. I don't think that comes out-of-the-box with farmOS...
10:52mstenta[m]RUros: yes unfortunately the "edit own asset" permission is not related to the "owner" field :-/
10:52mstenta[m]The former is a standard Drupal perm related to the original author of the entity
10:52mstenta[m]The latter is a field specific to farmOS
10:53mstenta[m]We need to disambiguate that and add more perms for the owner field I agree
10:54mstenta[m]Perhaps it would be worth changing "edit own asset" to "edit authored asset" or something like that
10:54RUros[m]ok, thank you for explanation. Yes, maybe it is a little confusing 🙈
10:55mstenta[m]Yes it is
10:59RUros[m]So my "user 1" must be the creator of an asset to be able to edit it, right ? What can I do if already have assets, but were not created by him ?
11:11symbioquine[m]Some interesting references. still trying to wrap my head around this...... (full message at <matrix.org/oftc/media/v1/media/download/>)
11:13symbioquine[m]So I think I'm understanding that the comment in A is referring to the "owner" base field added at B, not the "owner" field added in C...
11:13symbioquine[m]What I don't see is why those can both be added with apparently the same name 🧐
11:14symbioquine[m](Maybe a dumb question, I might just need more tea to see it... 😅)
11:14symbioquine[m]* So I think I'm understanding that the comment in A is referring to the "owner" base field added at B (by the code in D), not the "owner" field added in C...
11:42mstenta[m]Not a dumb question... it's super confusing
11:42mstenta[m]There are two base fields: uid and owner
11:43mstenta[m]uid is the "owner" from Drupal's perspective, aka author, owner is the one we added to represent "asset/log ownership"
11:43symbioquine[m]I see the uid one here: github.com/farmOS/farmOS/blob/f8eccce1e4
11:44mstenta[m]Here is the link: github.com/farmOS/farmOS/blob/f8eccce1e4
11:45symbioquine[m]Ah, so that creates the mapping that D is pulling from when it creates the "owner" (author) base field.
11:45mstenta[m]Yep
11:45mstenta[m]If we take away the owner field that farmOS added, we would still be left with A, B, and D
11:45symbioquine[m]Whereas C doesn't do any mapping and actually creates a field with the key of literally owner
11:46mstenta[m]Exactly
11:46symbioquine[m]🤦‍♂️
11:46mstenta[m]We chose to call owner "Owner" because it makes more sense from a user's perspective
11:46symbioquine[m]Thanks for walking me through that.
11:46mstenta[m]IMO Drupal's "owner" should be "author"
11:47mstenta[m]All of this is hidden in the code, and the only place it really reveals itself to site admins/users is in the permissions
11:48mstenta[m](and the ambiguity of the word "own")
11:48mstenta[m]In the permissions, "own" means "author"
11:49mstenta[m]We could try to disambiguate by changing the permission names
11:49mstenta[m]But it would probably mean overriding/replacing a bunch of core code
11:51mstenta[m]And it would be a breaking change
11:51mstenta[m]I would love to figure out a plan though... it's been in the back of my mind for a long time
11:52symbioquine[m]Could just be a matter of documenting that under development and linking to it from some strategic comments in the source.
11:52mstenta[m]We don't really use uid for anything... it's mostly just there as a way of tracking who the original author was.
11:52mstenta[m]So maybe we can hijack the permissions and just rewire stuff to use owner instead
11:53symbioquine[m]mstenta[m]: It sounds like that would be in the direction of what RUros was trying to do.
11:53mstenta[m]But I imagine there is also a case for having permissions for the original author too
11:54mstenta[m]Yea agreed - I think that's what a normal person's expectation would be when they read "edit own assets" :-)
11:54mstenta[m]It would raise questions like: if I create an asset, and assign ownership to someone, can I still view/edit the asset?
11:55mstenta[m](Hence why some extra "author" permissions may be necessary)
11:56symbioquine[m]Seems like we'd need to have some example use-cases for that sort of restricted permission in hand to say - and to say whether that needs to all be automatic or whether an admin can just come re-assign ownership if someone accidentally gives theirs away.
11:57mstenta[m]Yea
11:58mstenta[m]Maybe the first step is to review how the EntityOwnerTrait works and what it adds/does
11:59mstenta[m]This goes a bit beyond Drupal core too, FYI... the entity module (www.drupal.org/project/entity) is responsible for providing all the permissions for custom entity types IIRC
11:59mstenta[m](It probably also looks for EntityOwnerTrait)
12:07mstenta[m](Can we get an LLM to read this chat and start a forum topic for us? 😆)
12:07symbioquine[m]Ha
12:08symbioquine[m]I was thinking that we should copy it into a forum topic too
12:20mstenta[m]Tried duck.ai but it was crappy
12:21mstenta[m]farmos.discourse.group/t/permissions-and
12:34symbioquine[m]<mstenta[m]> "farmos.discourse.group/t..." <- Added an image version of this chat there too for (possibly) easier reading
12:35mstenta[m]Great!

< 212025-08-22⋏23 >