Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. path /visits/{visit_id} is Visit {
  2. read() { canManageSpace(this.spaceId) }
  3. write() { canManageSpace(this.spaceId) }
  4. }
  5.  
  6. path /spaceVisits/{space_id}/{visit_id} is Visit {
  7. read() { canManageSpace(space_id) }
  8. }
  9.  
  10. path /memberVisits/{member_id}/{visit_id} is Visit {
  11. read() { canManageSpace(this.spaceId) }
  12. }
  13.  
  14. type Visit {
  15. duration: UnsignedNumber | Null,
  16. in: UnsignedNumber,
  17. memberId: String,
  18. out: UnsignedNumber | Null,
  19. spaceId: String,
  20.  
  21. validate() {
  22. (this.out === null || this.duration === (this.out - this.in))
  23. }
  24. }
  25.  
  26. type UnsignedNumber extends Number {
  27. validate() { this >= 0 }
  28. }
  29.  
  30. // Returns `true` if the value is initialized to init, or if it retains it's prior value, otherwise `false`
  31. isSignedIn() { auth !== null }
  32. isCurrentUser(uid) { isSignedIn() && auth.uid === uid }
  33. canManageSpace(id) {
  34. // Check that the user has proper credentials in your own logic
  35. isSignedIn()
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement