User Groups
To add users to groups and grant groups access to an object using OpenFGA.
Relationship tuples can specify that an entire group has a relation to an object, which is helpful when you want to encompass a set of users with the same relation to an object. For example:
- Grant
vieweraccess to a group ofengineersinroadmap.doc - Create a
block_listofmemberswho can't access adocument - Sharing a
documentwith ateam - Granting
vieweraccess to aphototofollowersonly - Making a
fileviewable for alluserswithin anorganization - Restricting access from or to
usersin a certainlocale
Before you start
Familiarize yourself with the OpenFGA Concepts.
Assume you have the following authorization model.
: you have an object called document that users can relate to as an editor.
: you have an object called
document that users can relate to as an editor.model
schema 1.1
type user
type document
relations
define editor: [user]
In addition, you will need to know the following:
Direct Access
You need to know how to create an authorization model and a relationship tuple to grant a user access to an object. To learn more, see direct access.
OpenFGA Concepts
- A Type: a class of objects that have similar characteristics.
- A User: an entity in the system that can be related to an object.
- A Relation: a string defined in the type definition of an authorization model that defines the possibility of a relationship between an object of the same type as the type definition and a user in the system.
- An Object: represents an entity in the system. Users' relationships to it can be defined with relationship tuples and the authorization model.
- A Relationship Tuple: a grouping consisting of a user, a relation and an object stored in OpenFGA.
Step By Step
There are possible use cases where a group of users have a certain role on or permission to an object. For example, members of a certain team could have an editor relation to a certain document.
To represent this in OpenFGA: