This repository has been archived by the owner on Aug 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The security rules used for this app
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"rules": { | ||
".read": true, | ||
".write": true, | ||
"boardmetas": { | ||
"$boardid": { | ||
".validate": "newData.hasChildren(['createdAt', 'width', 'height'])", | ||
"createdAt": { | ||
// is a number after 20150101 and before now | ||
".validate": "newData.isNumber() && newData.val() > 1420099200000 && newData.val() <= now" | ||
}, | ||
"width": { | ||
".validate": "newData.isNumber()" | ||
}, | ||
"height": { | ||
".validate": "newData.isNumber()" | ||
}, | ||
"thumbnail": { | ||
// A thumbnail is allowed, but not required | ||
".validate": "newData.isString()" | ||
}, | ||
"$others": { | ||
// disallow any other children | ||
".validate": false | ||
} | ||
} | ||
}, | ||
"boardsegments": { | ||
"$boardid": { | ||
"$segmentid": { | ||
".validate": "newData.hasChildren(['color', 'points'])", | ||
// TODO: validate that color is within range -2147483648 - 2147483647 | ||
"points": { | ||
"$point": { | ||
".validate": "newData.hasChildren(['x', 'y'])", | ||
// validate that x and y are numeric and within the boards width and height | ||
"x": { | ||
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() < root.child('boardmetas').child($boardid).child('width').val()" | ||
}, | ||
"y": { | ||
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() < root.child('boardmetas').child($boardid).child('height').val()" | ||
}, | ||
"$other": { | ||
".validate": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"$others": { | ||
// disallow any other children | ||
".validate": false | ||
} | ||
} | ||
} |