Skip to content

Instantly share code, notes, and snippets.

@isorna
Forked from davideast/rules.bolt
Created November 13, 2015 11:41
Show Gist options
  • Save isorna/85fd14a1c0c01183bf80 to your computer and use it in GitHub Desktop.
Save isorna/85fd14a1c0c01183bf80 to your computer and use it in GitHub Desktop.
Securing user data - Bolt rules
isUser(uid) = auth != null && auth.uid == uid;
type Post {
uid: String;
title: String;
description: String;
timestamp: Number;
}
type User {
uid: String;
name: String;
username: String;
}
path /users/$uid is User {
read() = isUser($uid);
write() = isUser($uid);
}
path /posts/$postid is Post {
read() = true;
write() = isUser(this.uid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment