-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Circles
Circles -- Who do I belong to?
One part access control and one part role definition, circles allow the MEANster to determine what each component (Any MongoDB entity) shows to another component.
Instead of defining what an element has access to, in circles, an element declares who it wants to share its information with.
Take this scenario for example: Five circles, two representing fire stations from neighboring districts, (we’ll call them Fire-East and Fire-West) and three representing dispatch stations A, B, C.
Dispatch A takes calls that are entirely from the west part of town, and and Dispatch C takes calls that are from the east part of town.
Dispatch B receives calls from an area that in some cases is closer to the east station and in some the cases the west, and therefore has to report to both.
The stations don’t take ownership of dispatchers, the dispatchers choose who they expose their data to.
The Circle Object - Crack open a circle on mongo and you will see a circle is comprised of:
created: Date,
updated: Date,
category: [String],
description: String,
name: {
type: String,
required: true,
unique: true
},
circles: [String]
While a circle retains its many connections in an array, mapping those connections out is done through the model's static method Circle.buildPermissions, which recursively calculates the permission tree associated with the circle
Let’s take our firehouse example and say Fire West and Fire East belong to the city wide Firefighter Department. Fire West is now contained by City Fire, and City Fire is privy to the reports from all Dispatch stations via the East/West stations.
This is what the Fire West circle permissions look like after being attached to the city department.
"Fire West":{
"_id":"ID",
"name":"Fire West",
"__v":0,
"circles":[
"Dispatch A",
"Dispatch B"
],
"category":[
"Rescue services"
],
"containers":[
"City Fire",
],
"parents":[
"City Fire",
],
"descendants":[
"Dispatch A",
"Dispatch B"
],
"children":[
"Dispatch A",
"Dispatch B"
]
}
For some code examples that work with mean >0.6.x, see https://github.com/linnovate/mean/wiki/Circles-Examples
- Getting Started Guides
- Deployment
- Testing
- System Deep Dives
Aggregation- Packages
- Database
- Menus
- Circles (roles/permissions) High Level Overview
- Circles code examples
- User Auth withJWT
- Contributing