resources

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// Resource name
	Resource string `json:"resource"`
	Groups   Groups `json:"groups"`
}

type Group

type Group struct {
	Group    string `json:"group"`
	CanWrite bool   `json:"canWrite"`
	CanRead  bool   `json:"canRead"`
}

type Groups

type Groups map[string]Group

func (Groups) MarshalJSON

func (g Groups) MarshalJSON() (bs []byte, err error)

func (*Groups) UnmarshalJSON

func (g *Groups) UnmarshalJSON(bs []byte) (err error)

type Resources

type Resources struct {
	// contains filtered or unexported fields
}

func New

func New(entries ...Entry) *Resources

func (*Resources) Can

func (g *Resources) Can(httpMethod, resource string, groups ...string) (ok bool)

func (*Resources) CanRead

func (g *Resources) CanRead(resource string, groups ...string) (ok bool)

func (*Resources) CanWrite

func (g *Resources) CanWrite(resource string, groups ...string) (ok bool)

func (*Resources) Get

func (r *Resources) Get(resource string) (e Entry, ok bool)

func (*Resources) GetGroup

func (r *Resources) GetGroup(resource, group string) (grp Group, ok bool)

Jump to

Keyboard shortcuts

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