model

package
v2.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CanView allows read-only access to an object
	CanView = "can_view"
	// CanEdit allows read and write access to an object
	CanEdit = "can_edit"
	// CanDelete allows deletion of an object
	CanDelete = "can_delete"
)
View Source
var (
	// Read is an alias for can_view
	Read = "read"
	// Write is an alias for can_edit
	Write = "write"
	// Delete is an alias for can_delete
	Delete = "delete"
)
View Source
var ErrNoVersionMarker = errors.New("no fga model version marker found, run task fga:generate:version")

ErrNoVersionMarker is returned when the embedded version file carries no marker type

Functions

func CreateOptions

func CreateOptions() ([]string, error)

CreateOptions returns objects with verbs that support creation

func DefaultServiceScopeSet

func DefaultServiceScopeSet() (map[string]struct{}, error)

DefaultServiceScopeSet returns the default service scopes as a set

func FilterOrganizationRoles

func FilterOrganizationRoles(roles []modelparse.OrganizationRole, assigned []string) []modelparse.OrganizationRole

FilterOrganizationRoles ensures the assigned role is an organizational role and returns a filtered list of OrganizationRoles

func GetCrudAuthorizationModel

func GetCrudAuthorizationModel() (*openfga.AuthorizationModel, error)

GetCrudAuthorizationModel returns the parsed embedded authorization model

func GetOrganizationRoleStrings

func GetOrganizationRoleStrings(roles []modelparse.OrganizationRole, assigned []string) []string

GetOrganizationRoleStrings takes assigned roles and filters non organization roles and returns a string list of role names

func GetRolesAuthorizationModel

func GetRolesAuthorizationModel() (*openfga.AuthorizationModel, error)

func IsOrganizationRole

func IsOrganizationRole(roleID string) (bool, error)

IsOrganizationRole checks if a role is valid before it can be assigned or removed from a subject

func NormalizeScope

func NormalizeScope(scope string) string

NormalizeScope returns the relation name for a provided scope, handling common aliases Accepts object:verb (e.g., control:write) and simple verbs (read/write/delete)

func OrganizationRoles

func OrganizationRoles() ([]modelparse.OrganizationRole, error)

OrganizationRoles returns the roles parsed from fga

func RelationsForService

func RelationsForService() ([]string, error)

RelationsForService returns relations shaped like can_<verb>_<object> that directly accept service subjects.

func RoleOptions

func RoleOptions() ([]string, error)

RoleOptions returns objects with verbs that support roles

func ScopeAliases

func ScopeAliases() map[string]string

ScopeAliases returns a copy of the supported alias mapping

func ScopeOptions

func ScopeOptions() (map[string][]string, error)

ScopeOptions groups available scopes by object (verb mapped back via alias map)

func VersionMarker added in v2.4.0

func VersionMarker() (string, error)

VersionMarker returns the marker type name stamped into the model shipped with this build, which identifies the model in the fga store that matches this build

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL