Last active
June 16, 2017 13:02
-
-
Save bezysoftware/7ad925e8a8d78cba6f2f81e3b0954140 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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