i created a few small projects with great success. Now I have a new project with a set of features I am not sure how to handle in kirby.
Besides some basic pages, forms etc. the page should allow users to administrate/modify one single page within the web project. Think of it like a small business directory page. Each business gets a kirby user account and can then edit one single page. The structure of this page is identical for all users. In addition for one such page there should exist a collection of events, also manageable by this user (subpages?), and the project has a dedicated site where all events from all users should be listet.
I am thinking on how to structure the content and how to handle the permissions.
As far as I know, there exist no per-page permissions in Kirby. Also the other sites need to be hidden in the panel.
I attempted to use groups for this, nut then I have as many groups as users.
Can I use some specific naming scheme to build this functionality. Like storing a field “user” within a page, and only if they match, the user can edit the page or create new subpages?
Any plugins for this? I would like to quickly hack a working demo together in order to estimate
the effort or if I have to switch cms for this project.
Kirby’s permissions allow you to control access via user roles rather than single users. However, you could use route hooks to prevent individual users from actually accessing a page (although that would not hide those pages from the panel).
If you use custom pages sections like the Pagesdisplay Section plugin, you could however, filter the pages a user gets to see by user, assuming that you store which user can access a page in a field in the page.
thank you for your fast reply. I tried to implement your suggestions within a fresh kirby installation including the demo data. The notes have a user field already, so my idea was to assign a few users to different notes and try to filter them.
I tried different versions of the query, but all result in the same error:
Der Bereich "notes" konnte nicht geladen werden: Argument 1 passed to Kirby\Toolkit\Collection::filterBy() must be of the type string, null given, called in /Users/durpex/tmp/kirby/kirby/src/Toolkit/Query.php on line 98
thank you again for pointing me in the right direction.
Hardcoding values works fine now, but using the plugin I get the following error:
Der Bereich “notes” konnte nicht geladen werden: Invalid query result - Result must be of type Kirby\Cms\Pages, Kirby\Cms\Field given.
I used your example from above.
Just to be sure: all filter queries documented here should work theoretically? So I could use a function to diplay all notes for the admin user group and only specific ones for others.
Another idea that could come in handy: Is it possible, using the ‘user.create:after’ Hook to create a page if a user within a specific user group is created and setting this new user for the page? Reading the documentation it seems that ‘$page->createChild’ should work.
This results in the same error message.
This is the section in site.yml:
# The `notes` section reuses the pages section defined in `/site/blueprints/sections/notes.yml`