|
48 | 48 | // so instead we just prevent a user to add to himself a radio that already |
49 | 49 | // has tracks in -> so no radio hijack |
50 | 50 | ".validate": "root.child('channels').child($channelID).exists() && !root.child('users').child(auth.uid).child('channels').child($channelID).exists() && !root.child('channels').child($channelID).child('tracks').exists()" |
51 | | - } |
| 51 | + } |
52 | 52 | }/*, |
53 | 53 | "$other": { |
54 | 54 | ".validate": false |
|
66 | 66 | // write: only logged-in-user without a user settings can create a new one to himself |
67 | 67 | ".read": "auth != null && (data.child('user').val() === auth.uid)", |
68 | 68 | ".write": "auth != null && ((data.child('user').val() === auth.uid) || (root.child('users').child(auth.uid).hasChild('settings') === false))", |
69 | | - ".validate": "newData.hasChild('user')", |
| 69 | + ".validate": "newData.hasChild('user')", |
70 | 70 | "user": { |
71 | 71 | ".validate": "newData.val() === auth.uid" |
72 | 72 | }, |
73 | 73 | "isRemoteActive": { |
74 | 74 | ".validate": "newData.isBoolean()" |
75 | 75 | }, |
76 | | - "playedChannels": { |
77 | | - "$channel": { |
| 76 | + "playedChannels": { |
| 77 | + "$channel": { |
78 | 78 | ".validate": "newData.isBoolean() && root.child('channels').child($channel).exists()" |
79 | | - } |
80 | | - }, |
| 79 | + } |
| 80 | + }, |
81 | 81 | "$other": { |
82 | 82 | ".validate": false |
83 | 83 | } |
|
104 | 104 | ".validate": "newData.isString() && root.child('channelPublics').child(newData.val()).child('channel').val() == $channelID" |
105 | 105 | }, |
106 | 106 | "created": { |
107 | | - // Ensure type::timestamp and that you can not update it |
108 | | - ".validate": "data.exists() && data.val() === newData.val() || newData.val() == now" |
| 107 | + // Ensure type::number and that you can not update it |
| 108 | + // OR allow a timestamp within the last second |
| 109 | + ".validate": "data.exists() && data.val() === newData.val() || (newData.val() >= now -1000 && newData.val() <= now)" |
109 | 110 | }, |
110 | 111 | "updated": { |
111 | 112 | // Ensure type::number and that you can not update it |
|
125 | 126 | ".validate": "newData.isString() && newData.val().length > 2 && newData.val().length < 100" |
126 | 127 | }, |
127 | 128 | "title": { |
128 | | - ".validate": "newData.isString() && newData.val().length > 2 && newData.val().length < 33" |
| 129 | + ".validate": "newData.isString() && newData.val().length > 2 && newData.val().length < 32" |
129 | 130 | }, |
130 | 131 | "tracks": { |
131 | 132 | "$track": { |
|
0 commit comments