Configuring database user data security rules
Sometimes or often, we save some user-related data, which means data that has a relationship with a particular user, and in this recipe, we're going to see how we implement just that!
Getting ready
Before starting with this recipe, please make sure that your system is fully configured to support the Bolt language.
How to do it...
Now, let's see how we can secure the set of articles that belong to a specific user:
path /articles/{uid}/drafts { /create { create() { isCreator(uid) } } /publish { update() { isCreator(uid) } } /delete { delete() { isCreator(uid) } } } isCreator(uid) { uid == auth.uid }
How it works...
Let's discuss the black magic we just created!
- We're setting a new path for our Articles awesome website in the drafts section for a specific user, represented in the
uid
dynamically changed value. - Under that specific path or route, we're securing the sub-routes and check the create, public, and delete...