userbase

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const CurrentUserKey beContext.RequestKey = "current-user"
View Source
const CurrentUserProfileKey beContext.RequestKey = "current-user-profile"

Variables

This section is empty.

Functions

func SetCurrentUser

func SetCurrentUser(u *User, r *http.Request) (modified *http.Request)

func SetCurrentUserProfile

func SetCurrentUserProfile(u *Profile, r *http.Request) (modified *http.Request)

Types

type AuthProvider

type AuthProvider interface {
	AuthenticateRequest(w http.ResponseWriter, r *http.Request) (handled bool, modified *http.Request)
}

type GroupsProvider

type GroupsProvider interface {
	AddUserToGroup(id string, groups ...string) (err error)
	IsUserInGroup(id string, group string) (present bool)
	GetUserGroups(id string) (groups []string)
}

type Profile

type Profile struct {
	User
	page.Page
}

func GetCurrentUserProfile

func GetCurrentUserProfile(r *http.Request) (u *Profile)

func NewProfile

func NewProfile(user *User, path, raw string, created, updated int64, formats types.FormatProvider, enjin beContext.Context) (p *Profile, err error)

type SecretsProvider

type SecretsProvider interface {
	GetUserSecret(id string) (hash string)
}

type User

type User struct {
	ID    string
	Name  string
	Email string
	Image string
}

func GetCurrentUser

func GetCurrentUser(r *http.Request) (u *User)

func NewUser

func NewUser(id, name, email, image string) (user *User)

type UserProfilesProvider

type UserProfilesProvider interface {
	AddUserProfile(u *User) (p *Profile, err error)
	GetUserProfile(u *User) (p *Profile, err error)
}

type UsersProvider

type UsersProvider interface {
	AddUser(user *User) (err error)
	GetUser(id string) (user *User, err error)
}

Jump to

Keyboard shortcuts

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