I have problems with basic security rules with Firebase (I read the documentation on Firebase and StackExchange, but I can not get the security rules to work):
Model (representation of Emberjs model):
App.User = DS.Model.extend({ uid: DS.attr('string'), displayName: DS.attr('string'), books: DS.hasMany('statistic', { inverse: 'user', async: true}), actions: DS.hasMany('action', { inverse: 'user', async: true}), }); App.Action = DS.Model.extend({ date: DS.attr('date'), actionType: DS.attr('string'), comment: DS.attr('string'), user: DS.belongsTo('user', {inverse: 'actions', async: true} ) }); App.Book = DS.Model.extend({ name: DS.attr('string'), description: DS.attr('string'), user: DS.belongsTo('user', { inverse: 'books', async: true} ) });
3 nodes (models) are stored directly in the Firebase root application. Book and Action models have a user field (property).
What are the rules for writing to:
- Only the user identified in the user field of the book models and actions (nodes) can have read and write access to their own data? (The value of the
user field in the book and action must be equal to the value of auth.uid in Firebase, so that the user receives read and write privileges.) - So that users can access only the user model information (node) that applies to them?
thanks
source share