user

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

package user contains a naive implementation of an user with roles. Each user can be assigned roles and added to/retrieved from context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToContext

func AddToContext(ctx context.Context, u *User) context.Context

Types

type User

type User struct {
	ID    string
	Roles map[string]struct{}
}

func FromContext

func FromContext(ctx context.Context) (*User, bool)

func (*User) AddRole

func (u *User) AddRole(r string)

func (*User) HasRole

func (u *User) HasRole(r string) bool

Jump to

Keyboard shortcuts

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