yaml

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionsFromYAML

func OptionsFromYAML(filename string) core.OptionFunc

Types

type Config

type Config struct {
	Metadata    Metadata              `yaml:"config"`
	Roles       map[string]Role       `yaml:"roles"`
	Permissions map[string]Permission `yaml:"permissions"`
}

Config is the primary struct used to decode the configuration JSON file.

type Metadata

type Metadata struct {
	Permissions *core.TemplateMetadata `yaml:"permissions"`
	Roles       *core.TemplateMetadata `yaml:"roles"`
}

Metadata is used to alter role generation.

type Permission

type Permission struct {
	ID          string `yaml:"id"`
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	GoName      string `yaml:"go-name"`
}

Permission holds the configuration info for all permissions. NB: This may be removed later and worked out automatically from Role.

type Role

type Role struct {
	ID          string   `yaml:"id"`
	Key         string   `yaml:"-"`
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Permissions []string `yaml:"permissions"`

	// GoName overrides the automatically generated Go Name for the roles.
	// The default is <path>/roles.PascalCase(ID). If ID and Key differ, we defer to Key.
	// This allows using e.g. admin (roles.Admin) as the key, but keeping the ID as my-orgname-admin.
	GoName string `yaml:"go-name"`

	// ActiveDirectory is a mapping to record against the role for mapping active directory groups in single sign-on.
	ActiveDirectory string `yaml:"ad-mapping"`
}

Role holds all configuration info for a role.

Jump to

Keyboard shortcuts

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