I am currently working on a website that features artists. For each artist, an associated user account is automatically created. How can I ensure that each artist can only edit their own artist page (templates/artist.php)?
Thank you! How do i add the “sites.templates.artist” to the query? The User should only be able to edit the artist which has the same name as his User Account.
fields:
canaccess:
label: 'The user will only be able to access:'
type: pages
multiple: false
options: query
query: site.pages # or any query that suits your needs
The idea here is that you select the page that the user can access in this field. You could set the value (uuid of page) programmatically when you create the user.
On a side: there is no need to send me DMs with links to questions on the forum, since I have notifications on for new topics on the forum. Thank you!
title: Editor
home: /panel/account
permissions:
access:
panel: true
site: true
settings: false
users: false
languages: false
system: false
user:
changeRole: false
changeName: false
changeEmail: false
delete: false
update: true # else a user will be able to edit the page they have access to on their profile
fields:
canaccess:
label: "Zugriff:"
type: pages
multiple: false
query: site.find('artists').children
Is it possible to change the query to work like this? „site.find(‘artists’).children == $user->name()“
The query has to return a pages collection, not a boolean value. Also, in a pages field you will have to actively select a page (or set the value programmatically, as mentioned), from the queried list. So allowed values should be all children of the artists page, from which you then select the one that corresponds to the current user.
My question is, how can I programmatically set the value “allowed_page_uuid” in the page field? So that the User for example: “John Doe” can only edit the Artist Page “John Doe”…
Beside, I can’t use the isReadable() function because the user doesn’t create the page. The Page already exists.