Checking Relations
Now that you've created your definitions and relations, you can check them to determine access control.
Most of our SDKs provide a check function, which is the primary method for checking relations. This function checks if the given relations are satisfied and returns detailed results.
Check if relation exists
The check function checks if the given relations are satisfied. Pass in an array of FGARelation objects and the function returns an array of FGACheck results indicating whether each relation is allowed.
Check who can access a particular resource
The whoCanAccess function takes in a resource, a relation definition, and a namespace corresponding to the relation definition and returns an array
of users with the given relation definitions to the resource.
Check what relations a resource has
The resourceRelations function returns an array of relations for a given resource.
Check what relations a resource has (with target set filter)
The ResourceRelationsWithTargetSetsFilter function returns relations for a given resource with an option to include or exclude target set relations.
Check what relations a target has directly
The targetsRelations function takes an array of targets (eg. users) and returns an array of relations that exist for the target directly.
This will NOT return relations that exist for the target implicitly, such as through a parent node with a matching relation definition.
Check what relations a target has directly (with target set filter)
The TargetsRelationsWithTargetSetsFilter function returns relations for given targets with an option to include or exclude target set relations.
Check what relations a target has directly and implicitly (recursive)
The whatCanTargetAccess function is similar to the targetsRelations function in that it takes a single target and returns
an array of relations that exist for it, but instead of simply including direct relations, it returns implicit ones as well,
traversing the tree of relations recursively.
Check what resources a target can access through a particular relation definition
The whatCanTargetAccessWithRelation function is similar to whatCanTargetAccess, but instead of returning all relations for a given target, it specifically finds resources that the target can access through relation paths ending in a given relation definition.
Get Modified Resources and Targets
The getModified function returns a list of targets and resources that have changed since a given date. This is useful for invalidating local caches and keeping your application's authorization data in sync.