context

package
Version: v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTenantId     = "tenantId"
	DefaultUserId       = "userId"
	NoAuthAdminTenantId = "adminTenantId"
)
View Source
const (
	KContext = "context"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	IsAdmin           bool     `policy:"true" json:"is_admin"`
	AuthToken         string   `policy:"true" json:"auth_token"`
	UserId            string   `policy:"true" json:"user_id"`
	TenantId          string   `policy:"true" json:"tenant_id"`
	DomainId          string   `policy:"true" json:"domain_id"`
	UserDomainId      string   `policy:"true" json:"user_domain_id"`
	ProjectDomainId   string   `policy:"true" json:"project_domain_id"`
	Roles             []string `policy:"true" json:"roles"`
	UserName          string   `policy:"true" json:"user_name"`
	ProjectName       string   `policy:"true" json:"project_name"`
	DomainName        string   `policy:"true" json:"domain_name"`
	UserDomainName    string   `policy:"true" json:"user_domain_name"`
	ProjectDomainName string   `policy:"true" json:"project_domain_name"`
	IsAdminTenant     bool     `policy:"true" json:"is_admin_tenant"`
}

func GetContext

func GetContext(req *restful.Request) *Context

func NewAdminContext

func NewAdminContext() *Context

func NewContext added in v0.6.3

func NewContext() *Context

func NewContextFromJson

func NewContextFromJson(s string) *Context

func NewInternalTenantContext

func NewInternalTenantContext(tenantId, userId string, isAdmin bool) *Context

func (*Context) ToJson

func (ctx *Context) ToJson() string

func (*Context) ToPolicyValue

func (ctx *Context) ToPolicyValue() map[string]interface{}

Source Files

Jump to

Keyboard shortcuts

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