You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-7Lines changed: 45 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,8 @@
1
-
# Loopback Component Access
1
+
# Loopback Component Group Access
2
2
3
-
This loopback component enables you to add multi-tenant style access controls to a loopback application. It enables you
4
-
to restrict access to model data based on a users roles within a specific context.
3
+
This loopback component enables you to add multi-tenant style access controls to a loopback application. It enables you to restrict access to model data based on a users roles within a specific context.
5
4
6
-
## Usage
7
-
8
-
**Installation**
5
+
### Installation
9
6
10
7
1. Install in you loopback project:
11
8
@@ -23,7 +20,48 @@ to restrict access to model data based on a users roles within a specific contex
23
20
}
24
21
```
25
22
26
-
**Configuration**
23
+
4. Create a middleware.json file in your server folder (if you don't already have one).
24
+
25
+
5. Enable the `loopback#context`, `loopback#token` and `user-context` middleware.
In order to use this component you will need to create group access model that can be used to link users to groups and assign group roles. A user can have have multiple roles within the context of a group and each role can define different access grants to REST resources. The *Group Access Model* must have the following three properties:
40
+
41
+
- userId
42
+
- groupId (configurable foreign key)
43
+
- role
44
+
45
+
Additionally you will need to designate one of your models the *Group Model*. This model will act as parent or container for related group content.
46
+
47
+
Any other models that have a belongsTo relationship to your Group Model will be considered as Group Content. Access grants for Group Content is determined by the user's roles within the context of the group as defined in the Group Access Model.
0 commit comments