Skip to content

Instantly share code, notes, and snippets.

@bezysoftware
Last active June 16, 2017 13:02
Show Gist options
  • Select an option

  • Save bezysoftware/7ad925e8a8d78cba6f2f81e3b0954140 to your computer and use it in GitHub Desktop.

Select an option

Save bezysoftware/7ad925e8a8d78cba6f2f81e3b0954140 to your computer and use it in GitHub Desktop.
path /members/{group_id} {
read() { hasReadPermission(group_id) }
index() { "name" }
path /{member_id} is Member {
write() { hasWritePermission(group_id) }
}
}
type Member {
active: Boolean,
bankAccount: BankAccount | Null,
name: MemberName
}
type BankAccount extends String {
validate() { hasMaxLength(this, 24) }
}
type MemberName extends String {
validate() { hasMaxLength(this, 20) }
}
hasMaxLength(text, length) {
text.length > 0 && text.length <= length
}
hasReadPermission(group_id) {
prior(root).permissions[group_id][auth.uid].level >= 10
}
hasWritePermission(group_id) {
prior(root).permissions[group_id][auth.uid].level >= 20
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment