how to restrict field creation within record?
In the example config below, I wish to only allow admin to create fileds within 'chat' record, and non anonymous users to write to 'chat/msg' field.
But this config would allow creation of any field by users within chat.
#config.yml
record:
"*":
create: false
write: false
read: false
delete: false
listen: false
chat:
create: "user.data.role === 'admin'"
write: true
read: true
listen: true
chat/*:
create: "user.data.role === 'admin'"
write: "user.data.role === 'admin'"
chat/msg:
write: "user.data.role !== 'anonymous'"
And if I remove write: true in 'chat:', it would disallow writing to 'chat/msg', throwing 'MESSAGE_DENIED'.
Maybe I'm not supposed to do this, or is there a way to achieve this? Thanks!
Edit: I use Redis Cache/Message Connector.
deepstream.io permission rules apply at the record level and not to data within a record so you have to choose a different approach.
Also, the rules listed for chat will only affect the record with the name chat and no other record so changing the write permissions for chat should not affect permissions for other records.