Documentation ¶
Overview ¶
Package viewer contains role definitions for policies
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ViewerContextKey = &ContextKey{"ViewerContextKey"}
ViewerContextKey is the context key for the viewer-context
Functions ¶
Types ¶
type ContextKey ¶
type ContextKey struct {
// contains filtered or unexported fields
}
ContextKey is the key name for the additional context
type UserViewer ¶
UserViewer describes a user-viewer
func NewUserViewerFromID ¶ added in v0.2.4
func NewUserViewerFromID(id string, hasID bool) *UserViewer
NewUserViewerFromID gets the `id` and `hasID` fields of the `UserViewer` struct and is used to create a `UserViewer` when the user ID is known, but the actual user object is not available
func NewUserViewerFromSubject ¶ added in v0.2.4
func NewUserViewerFromSubject(c context.Context) *UserViewer
NewUserViewerFromSubject function creates a new `UserViewer` instance based on the user ID obtained from the context. It uses the `auth.GetUserIDFromContext` function to retrieve the user ID from the context
func NewUserViewerFromUser ¶ added in v0.2.4
func NewUserViewerFromUser(user *generated.User) *UserViewer
NewUserViewerFromUser function is used to create a new `UserViewer` instance based on a `generated.User` object - this function is useful when you have a user object and want to create a `UserViewer` from it
func (UserViewer) GetGroupID ¶
func (u UserViewer) GetGroupID() string
GetGroupID returns the ID of the group
func (UserViewer) GetID ¶ added in v0.2.4
func (u UserViewer) GetID() (string, bool)
GetID returns the ID of the user and a boolean value indicating whether the ID exists or not
func (UserViewer) GetOrganizationID ¶
func (u UserViewer) GetOrganizationID() string
GetOrganizationID returns the ID of the organization.
func (UserViewer) IsAdmin ¶ added in v0.2.4
func (u UserViewer) IsAdmin() bool
IsAdmin returns a boolean value indicating whether the user is an admin or not. In this implementation, the function always returns `false`, indicating that the user is not an admin