Package dev.openfga.language.utils
Class ModelUtils
- java.lang.Object
-
- dev.openfga.language.utils.ModelUtils
-
public class ModelUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ModelUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetModuleForObjectTypeRelation(dev.openfga.sdk.api.model.TypeDefinition typeDef, java.lang.String relation)getModuleForObjectTypeRelation returns the module for the given object type and relation in that type.static booleanisRelationAssignable(dev.openfga.sdk.api.model.Userset relDef)isRelationAssignable returns true if the relation is assignable, as in the relation definition has a key "this" or any of its children have a key "this".
-
-
-
Method Detail
-
getModuleForObjectTypeRelation
public static java.lang.String getModuleForObjectTypeRelation(dev.openfga.sdk.api.model.TypeDefinition typeDef, java.lang.String relation) throws java.lang.ExceptiongetModuleForObjectTypeRelation returns the module for the given object type and relation in that type.- Parameters:
typeDef- A TypeDefinition object which contains metadata about the type.relation- A string representing the relation whose module is to be retrieved.- Returns:
- A string representing the module for the given object type and relation.
- Throws:
java.lang.Exception- An error if the relation does not exist.
-
isRelationAssignable
public static boolean isRelationAssignable(dev.openfga.sdk.api.model.Userset relDef)
isRelationAssignable returns true if the relation is assignable, as in the relation definition has a key "this" or any of its children have a key "this".- Parameters:
relDef- A Userset object representing a relation definition.- Returns:
- A boolean representing whether the relation definition has a key "this".
-
-