viewer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package viewer contains role definitions for policies

Index

Constants

This section is empty.

Variables

View Source
var ViewerContextKey = &ContextKey{"ViewerContextKey"}

ViewerContextKey is the context key for the viewer-context

Functions

func NewContext

func NewContext(parent context.Context, v Viewer) context.Context

NewContext returns a copy of parent context with the given Viewer attached with it.

Types

type ContextKey

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

ContextKey is the key name for the additional context

type UserViewer

type UserViewer struct {
	GroupID string
	OrgID   string
}

UserViewer describes a user-viewer.

func (UserViewer) GetGroupID

func (u UserViewer) GetGroupID() string

GetGroupID returns the ID of the group

func (UserViewer) GetOrganizationID

func (u UserViewer) GetOrganizationID() string

GetOrganizationID returns the ID of the organization.

type Viewer

type Viewer interface {
	// OrganizationID returns the organization ID from the context
	GetOrganizationID() string
	GetGroupID() string
}

Viewer describes the query/mutation viewer-context.

func FromContext

func FromContext(ctx context.Context) Viewer

FromContext returns the Viewer stored in a context.

Jump to

Keyboard shortcuts

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