MCPcopy Create free account
hub / github.com/Permify/permify / IsRelational

Function IsRelational

internal/engines/utils.go:355–368  ·  view source on GitHub ↗

IsRelational determines if a given permission corresponds to a relational attribute in the provided entity definition.

(en *base.EntityDefinition, permission string)

Source from the content-addressed store, hash-verified

353// IsRelational determines if a given permission corresponds to a relational attribute
354// in the provided entity definition.
355func IsRelational(en *base.EntityDefinition, permission string) bool {
356 // Default to non-relational
357 isRelational := false
358
359 // Attempt to get the type of reference for the given permission in the entity definition
360 tor, err := schema.GetTypeOfReferenceByNameInEntityDefinition(en, permission)
361 if err == nil && tor != base.EntityDefinition_REFERENCE_ATTRIBUTE {
362 // If the type of reference is anything other than REFERENCE_ATTRIBUTE,
363 // treat it as a relational attribute
364 isRelational = true
365 }
366
367 return isRelational
368}

Callers 3

CheckMethod · 0.92
CheckMethod · 0.92
utils_test.goFile · 0.85

Tested by

no test coverage detected