user

package
v0.0.0-...-170f7c6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthClaims        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowClaims          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupClaims = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGroup        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGroup          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthInvitation        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowInvitation          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupInvitation = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	Resources = map[Resource]struct{}{
		R_asset:     {},
		R_group:     {},
		R_operation: {},
		R_role:      {},
		R_user:      {},
	}

	Commands = map[Command]struct{}{
		C_read:  {},
		C_edit:  {},
		C_write: {},
	}
)
View Source
var (
	ErrInvalidLengthRole        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRole          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRole = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthUser        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowUser          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupUser = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Command_name = map[int32]string{
	0: "C_read",
	1: "C_edit",
	2: "C_write",
}
View Source
var Command_value = map[string]int32{
	"C_read":  0,
	"C_edit":  1,
	"C_write": 2,
}
View Source
var Resource_name = map[int32]string{
	0: "R_asset",
	1: "R_group",
	2: "R_operation",
	3: "R_role",
	4: "R_user",
}
View Source
var Resource_value = map[string]int32{
	"R_asset":     0,
	"R_group":     1,
	"R_operation": 2,
	"R_role":      3,
	"R_user":      4,
}

Functions

func Encrypt

func Encrypt(password string) ([]byte, []byte)

Types

type ClaimAuth

type ClaimAuth struct {
	// Groups key must be a group.ID
	Groups map[string]ClaimGroup `` /* 143-byte string literal not displayed */
}

func NewPopulatedClaimAuth

func NewPopulatedClaimAuth(r randyClaims, easy bool) *ClaimAuth

func (*ClaimAuth) Descriptor

func (*ClaimAuth) Descriptor() ([]byte, []int)

func (*ClaimAuth) Equal

func (this *ClaimAuth) Equal(that interface{}) bool

func (*ClaimAuth) GoString

func (this *ClaimAuth) GoString() string

func (*ClaimAuth) Marshal

func (m *ClaimAuth) Marshal() (dAtA []byte, err error)

func (*ClaimAuth) MarshalTo

func (m *ClaimAuth) MarshalTo(dAtA []byte) (int, error)

func (*ClaimAuth) MarshalToSizedBuffer

func (m *ClaimAuth) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClaimAuth) ProtoMessage

func (*ClaimAuth) ProtoMessage()

func (*ClaimAuth) Reset

func (m *ClaimAuth) Reset()

func (*ClaimAuth) Size

func (m *ClaimAuth) Size() (n int)

func (*ClaimAuth) String

func (this *ClaimAuth) String() string

func (*ClaimAuth) Unmarshal

func (m *ClaimAuth) Unmarshal(dAtA []byte) error

func (*ClaimAuth) XXX_DiscardUnknown

func (m *ClaimAuth) XXX_DiscardUnknown()

func (*ClaimAuth) XXX_Marshal

func (m *ClaimAuth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClaimAuth) XXX_Merge

func (m *ClaimAuth) XXX_Merge(src proto.Message)

func (*ClaimAuth) XXX_Size

func (m *ClaimAuth) XXX_Size() int

func (*ClaimAuth) XXX_Unmarshal

func (m *ClaimAuth) XXX_Unmarshal(b []byte) error

type ClaimGroup

type ClaimGroup struct {
	ID github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"ID"`
	// Roles key must be a user.Role ID
	Roles map[string]pbtypes.Empty `` /* 141-byte string literal not displayed */
	// Resources key must be a user.Resource
	Resources map[string]ClaimResources `` /* 149-byte string literal not displayed */
}

func NewPopulatedClaimGroup

func NewPopulatedClaimGroup(r randyClaims, easy bool) *ClaimGroup

func (*ClaimGroup) Descriptor

func (*ClaimGroup) Descriptor() ([]byte, []int)

func (*ClaimGroup) Equal

func (this *ClaimGroup) Equal(that interface{}) bool

func (*ClaimGroup) GoString

func (this *ClaimGroup) GoString() string

func (*ClaimGroup) Marshal

func (m *ClaimGroup) Marshal() (dAtA []byte, err error)

func (*ClaimGroup) MarshalTo

func (m *ClaimGroup) MarshalTo(dAtA []byte) (int, error)

func (*ClaimGroup) MarshalToSizedBuffer

func (m *ClaimGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClaimGroup) ProtoMessage

func (*ClaimGroup) ProtoMessage()

func (ClaimGroup) Require

func (c ClaimGroup) Require(rs ...Requirement) error

func (*ClaimGroup) Reset

func (m *ClaimGroup) Reset()

func (*ClaimGroup) Size

func (m *ClaimGroup) Size() (n int)

func (*ClaimGroup) String

func (this *ClaimGroup) String() string

func (*ClaimGroup) Unmarshal

func (m *ClaimGroup) Unmarshal(dAtA []byte) error

func (*ClaimGroup) XXX_DiscardUnknown

func (m *ClaimGroup) XXX_DiscardUnknown()

func (*ClaimGroup) XXX_Marshal

func (m *ClaimGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClaimGroup) XXX_Merge

func (m *ClaimGroup) XXX_Merge(src proto.Message)

func (*ClaimGroup) XXX_Size

func (m *ClaimGroup) XXX_Size() int

func (*ClaimGroup) XXX_Unmarshal

func (m *ClaimGroup) XXX_Unmarshal(b []byte) error

type ClaimResources

type ClaimResources struct {
	// Commands key must be a user.Commands
	Commands map[string]pbtypes.Empty `` /* 147-byte string literal not displayed */
}

func NewPopulatedClaimResources

func NewPopulatedClaimResources(r randyClaims, easy bool) *ClaimResources

func (*ClaimResources) Descriptor

func (*ClaimResources) Descriptor() ([]byte, []int)

func (*ClaimResources) Equal

func (this *ClaimResources) Equal(that interface{}) bool

func (*ClaimResources) GoString

func (this *ClaimResources) GoString() string

func (*ClaimResources) Marshal

func (m *ClaimResources) Marshal() (dAtA []byte, err error)

func (*ClaimResources) MarshalTo

func (m *ClaimResources) MarshalTo(dAtA []byte) (int, error)

func (*ClaimResources) MarshalToSizedBuffer

func (m *ClaimResources) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClaimResources) ProtoMessage

func (*ClaimResources) ProtoMessage()

func (*ClaimResources) Reset

func (m *ClaimResources) Reset()

func (*ClaimResources) Size

func (m *ClaimResources) Size() (n int)

func (*ClaimResources) String

func (this *ClaimResources) String() string

func (*ClaimResources) Unmarshal

func (m *ClaimResources) Unmarshal(dAtA []byte) error

func (*ClaimResources) XXX_DiscardUnknown

func (m *ClaimResources) XXX_DiscardUnknown()

func (*ClaimResources) XXX_Marshal

func (m *ClaimResources) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClaimResources) XXX_Merge

func (m *ClaimResources) XXX_Merge(src proto.Message)

func (*ClaimResources) XXX_Size

func (m *ClaimResources) XXX_Size() int

func (*ClaimResources) XXX_Unmarshal

func (m *ClaimResources) XXX_Unmarshal(b []byte) error

type Claims

type Claims struct {
	jwt.RegisteredClaims

	UserID ulid.ID
	Auth   ClaimAuth
}

func (Claims) GroupIDs

func (c Claims) GroupIDs(rs ...Requirement) []ulid.ID

func (Claims) Require

func (c Claims) Require(rs ...Requirement) error

func (Claims) RequireRoles

func (c Claims) RequireRoles(ids ...ulid.ID) error

func (Claims) RoleIDs

func (c Claims) RoleIDs() []ulid.ID

type Command

type Command int32
const (
	C_read  Command = 0
	C_edit  Command = 1
	C_write Command = 2
)

func (Command) EnumDescriptor

func (Command) EnumDescriptor() ([]byte, []int)

func (Command) String

func (x Command) String() string

type ErrEmptyEmail

type ErrEmptyEmail struct{}

func (ErrEmptyEmail) Error

func (e ErrEmptyEmail) Error() string

type ErrEmptyName

type ErrEmptyName struct{}

func (ErrEmptyName) Error

func (e ErrEmptyName) Error() string

type ErrEmptyPermissions

type ErrEmptyPermissions struct{}

func (ErrEmptyPermissions) Error

func (e ErrEmptyPermissions) Error() string

type ErrForbiddenAdminRole

type ErrForbiddenAdminRole struct{}

func (ErrForbiddenAdminRole) Error

func (e ErrForbiddenAdminRole) Error() string

type ErrInvalidClaims

type ErrInvalidClaims struct {
	Err error
}

func (ErrInvalidClaims) Error

func (e ErrInvalidClaims) Error() string

type ErrInvalidEmailLength

type ErrInvalidEmailLength struct {
	Email  string
	Length int
}

func (ErrInvalidEmailLength) Error

func (e ErrInvalidEmailLength) Error() string

type ErrInvalidNameLength

type ErrInvalidNameLength struct {
	Name   string
	Length int
}

func (ErrInvalidNameLength) Error

func (e ErrInvalidNameLength) Error() string

type ErrInvalidPassword

type ErrInvalidPassword struct{}

func (ErrInvalidPassword) Error

func (e ErrInvalidPassword) Error() string

type ErrUnauthorizedCommand

type ErrUnauthorizedCommand struct {
	Resource string
	Command  string
}

func (ErrUnauthorizedCommand) Error

func (e ErrUnauthorizedCommand) Error() string

type ErrUnauthorizedResource

type ErrUnauthorizedResource struct {
	Resource string
}

func (ErrUnauthorizedResource) Error

func (e ErrUnauthorizedResource) Error() string

type ErrUnauthorizedRole

type ErrUnauthorizedRole struct {
	Roles []string
}

func (ErrUnauthorizedRole) Error

func (e ErrUnauthorizedRole) Error() string

type ErrUnknownCommand

type ErrUnknownCommand struct {
	Command string
}

func (ErrUnknownCommand) Error

func (e ErrUnknownCommand) Error() string

type ErrUnknownGroup

type ErrUnknownGroup struct {
	GroupID string
}

func (ErrUnknownGroup) Error

func (e ErrUnknownGroup) Error() string

type ErrUnknownResource

type ErrUnknownResource struct {
	Resource string
}

func (ErrUnknownResource) Error

func (e ErrUnknownResource) Error() string

type Filter

type Filter struct {
	ID  ulid.ID
	IDs []ulid.ID

	Email    *string
	GoogleID *string

	// ListByGroup only
	GroupIDs []ulid.ID
	RoleID   ulid.ID
	RoleIDs  []ulid.ID

	*paginate.Paginate
	Search string
}

type FilterGroup

type FilterGroup struct {
	ID  ulid.ID
	IDs []ulid.ID

	*paginate.Paginate
	Search string
}

type FilterInvitation

type FilterInvitation struct {
	ID  ulid.ID
	IDs []ulid.ID

	Email  *string
	Emails []string

	*paginate.Paginate
	Search string

	GroupIDs []ulid.ID
}

type FilterInvitationRole

type FilterInvitationRole struct {
	InvitationID  ulid.ID
	InvitationIDs []ulid.ID

	RoleID  ulid.ID
	RoleIDs []ulid.ID

	GroupIDs []ulid.ID
}

type FilterPermission

type FilterPermission struct {
	RoleID  ulid.ID
	RoleIDs []ulid.ID

	Resource *Resource
	Command  *Command
}

type FilterRole

type FilterRole struct {
	ID  ulid.ID
	IDs []ulid.ID

	GroupID  ulid.ID
	GroupIDs []ulid.ID

	UserID ulid.ID

	InvitationIDs []ulid.ID

	*paginate.Paginate
	Search string
}

type FilterRoleUser

type FilterRoleUser struct {
	RoleID  ulid.ID
	RoleIDs []ulid.ID

	UserID  ulid.ID
	UserIDs []ulid.ID
}

type Group

type Group struct {
	ID          github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"ID"`
	Name        string                             `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	AvatarURL   string                             `protobuf:"bytes,3,opt,name=AvatarURL,proto3" json:"AvatarURL,omitempty"`
	Description string                             `protobuf:"bytes,4,opt,name=Description,proto3" json:"Description,omitempty"`
	CreatedAt   int64                              `protobuf:"varint,5,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt   int64                              `protobuf:"varint,6,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedGroup

func NewPopulatedGroup(r randyGroup, easy bool) *Group

func (Group) Check

func (g Group) Check() error

func (*Group) Descriptor

func (*Group) Descriptor() ([]byte, []int)

func (*Group) Equal

func (this *Group) Equal(that interface{}) bool

func (*Group) GoString

func (this *Group) GoString() string

func (*Group) Marshal

func (m *Group) Marshal() (dAtA []byte, err error)

func (*Group) MarshalTo

func (m *Group) MarshalTo(dAtA []byte) (int, error)

func (*Group) MarshalToSizedBuffer

func (m *Group) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Group) ProtoMessage

func (*Group) ProtoMessage()

func (*Group) Reset

func (m *Group) Reset()

func (*Group) Size

func (m *Group) Size() (n int)

func (*Group) String

func (this *Group) String() string

func (*Group) Unmarshal

func (m *Group) Unmarshal(dAtA []byte) error

func (*Group) XXX_DiscardUnknown

func (m *Group) XXX_DiscardUnknown()

func (*Group) XXX_Marshal

func (m *Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Group) XXX_Merge

func (m *Group) XXX_Merge(src proto.Message)

func (*Group) XXX_Size

func (m *Group) XXX_Size() int

func (*Group) XXX_Unmarshal

func (m *Group) XXX_Unmarshal(b []byte) error

type Invitation

type Invitation struct {
	ID        github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"ID"`
	Email     string                             `protobuf:"bytes,2,opt,name=Email,proto3" json:"Email,omitempty"`
	CreatedAt int64                              `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt int64                              `protobuf:"varint,4,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedInvitation

func NewPopulatedInvitation(r randyInvitation, easy bool) *Invitation

func (Invitation) Check

func (i Invitation) Check() error

func (*Invitation) Descriptor

func (*Invitation) Descriptor() ([]byte, []int)

func (*Invitation) Equal

func (this *Invitation) Equal(that interface{}) bool

func (*Invitation) GoString

func (this *Invitation) GoString() string

func (*Invitation) Marshal

func (m *Invitation) Marshal() (dAtA []byte, err error)

func (*Invitation) MarshalTo

func (m *Invitation) MarshalTo(dAtA []byte) (int, error)

func (*Invitation) MarshalToSizedBuffer

func (m *Invitation) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Invitation) ProtoMessage

func (*Invitation) ProtoMessage()

func (*Invitation) Reset

func (m *Invitation) Reset()

func (*Invitation) Size

func (m *Invitation) Size() (n int)

func (*Invitation) String

func (this *Invitation) String() string

func (*Invitation) Unmarshal

func (m *Invitation) Unmarshal(dAtA []byte) error

func (*Invitation) XXX_DiscardUnknown

func (m *Invitation) XXX_DiscardUnknown()

func (*Invitation) XXX_Marshal

func (m *Invitation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Invitation) XXX_Merge

func (m *Invitation) XXX_Merge(src proto.Message)

func (*Invitation) XXX_Size

func (m *Invitation) XXX_Size() int

func (*Invitation) XXX_Unmarshal

func (m *Invitation) XXX_Unmarshal(b []byte) error

type InvitationRole

type InvitationRole struct {
	InvitationID github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=InvitationID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"InvitationID"`
	RoleID       github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,2,opt,name=RoleID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"RoleID"`
	CreatedAt    int64                              `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt    int64                              `protobuf:"varint,4,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedInvitationRole

func NewPopulatedInvitationRole(r randyInvitation, easy bool) *InvitationRole

func (*InvitationRole) Descriptor

func (*InvitationRole) Descriptor() ([]byte, []int)

func (*InvitationRole) Equal

func (this *InvitationRole) Equal(that interface{}) bool

func (*InvitationRole) GoString

func (this *InvitationRole) GoString() string

func (*InvitationRole) Marshal

func (m *InvitationRole) Marshal() (dAtA []byte, err error)

func (*InvitationRole) MarshalTo

func (m *InvitationRole) MarshalTo(dAtA []byte) (int, error)

func (*InvitationRole) MarshalToSizedBuffer

func (m *InvitationRole) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*InvitationRole) ProtoMessage

func (*InvitationRole) ProtoMessage()

func (*InvitationRole) Reset

func (m *InvitationRole) Reset()

func (*InvitationRole) Size

func (m *InvitationRole) Size() (n int)

func (*InvitationRole) String

func (this *InvitationRole) String() string

func (*InvitationRole) Unmarshal

func (m *InvitationRole) Unmarshal(dAtA []byte) error

func (*InvitationRole) XXX_DiscardUnknown

func (m *InvitationRole) XXX_DiscardUnknown()

func (*InvitationRole) XXX_Marshal

func (m *InvitationRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InvitationRole) XXX_Merge

func (m *InvitationRole) XXX_Merge(src proto.Message)

func (*InvitationRole) XXX_Size

func (m *InvitationRole) XXX_Size() int

func (*InvitationRole) XXX_Unmarshal

func (m *InvitationRole) XXX_Unmarshal(b []byte) error

type Patch

type Patch struct {
	FirstName *string
	LastName  *string
	AvatarURL *string
	UpdatedAt *int64
}

type PatchGroup

type PatchGroup struct {
	Name        *string
	Description *string
	AvatarURL   *string
	UpdatedAt   *int64
}

type PatchInvitation

type PatchInvitation struct {
	Email     *string
	UpdatedAt *int64
}

type PatchRole

type PatchRole struct {
	Name      *string
	UpdatedAt *int64
}

type Permission

type Permission struct {
	RoleID    github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=RoleID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"RoleID"`
	Resource  Resource                           `protobuf:"varint,2,opt,name=Resource,proto3,enum=user.Resource" json:"Resource,omitempty"`
	Command   Command                            `protobuf:"varint,3,opt,name=Command,proto3,enum=user.Command" json:"Command,omitempty"`
	CreatedAt int64                              `protobuf:"varint,4,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt int64                              `protobuf:"varint,5,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func AllPermissions

func AllPermissions(roleID ulid.ID) []Permission

func NewPopulatedPermission

func NewPopulatedPermission(r randyRole, easy bool) *Permission

func (*Permission) Descriptor

func (*Permission) Descriptor() ([]byte, []int)

func (*Permission) Equal

func (this *Permission) Equal(that interface{}) bool

func (*Permission) GoString

func (this *Permission) GoString() string

func (*Permission) Marshal

func (m *Permission) Marshal() (dAtA []byte, err error)

func (*Permission) MarshalTo

func (m *Permission) MarshalTo(dAtA []byte) (int, error)

func (*Permission) MarshalToSizedBuffer

func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Permission) ProtoMessage

func (*Permission) ProtoMessage()

func (*Permission) Reset

func (m *Permission) Reset()

func (*Permission) Size

func (m *Permission) Size() (n int)

func (*Permission) String

func (this *Permission) String() string

func (*Permission) Unmarshal

func (m *Permission) Unmarshal(dAtA []byte) error

func (*Permission) XXX_DiscardUnknown

func (m *Permission) XXX_DiscardUnknown()

func (*Permission) XXX_Marshal

func (m *Permission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Permission) XXX_Merge

func (m *Permission) XXX_Merge(src proto.Message)

func (*Permission) XXX_Size

func (m *Permission) XXX_Size() int

func (*Permission) XXX_Unmarshal

func (m *Permission) XXX_Unmarshal(b []byte) error

type Permissions

type Permissions []Permission

func (Permissions) ByRole

func (ps Permissions) ByRole() map[string][]Permission

func (Permissions) Check

func (ps Permissions) Check() error

type Requirement

type Requirement struct {
	GroupID  ulid.ID
	Resource Resource
	Command  Command
}

func NewRequirements

func NewRequirements(groupIDs []ulid.ID, resource Resource, command Command) []Requirement

type Resource

type Resource int32
const (
	R_asset     Resource = 0
	R_group     Resource = 1
	R_operation Resource = 2
	R_role      Resource = 3
	R_user      Resource = 4
)

func (Resource) EnumDescriptor

func (Resource) EnumDescriptor() ([]byte, []int)

func (Resource) String

func (x Resource) String() string

type Role

type Role struct {
	ID        github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"ID"`
	GroupID   github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,2,opt,name=GroupID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"GroupID"`
	Name      string                             `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
	CreatedAt int64                              `protobuf:"varint,4,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt int64                              `protobuf:"varint,5,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedRole

func NewPopulatedRole(r randyRole, easy bool) *Role

func (Role) Check

func (r Role) Check() error

func (*Role) Descriptor

func (*Role) Descriptor() ([]byte, []int)

func (*Role) Equal

func (this *Role) Equal(that interface{}) bool

func (*Role) GoString

func (this *Role) GoString() string

func (*Role) Marshal

func (m *Role) Marshal() (dAtA []byte, err error)

func (*Role) MarshalTo

func (m *Role) MarshalTo(dAtA []byte) (int, error)

func (*Role) MarshalToSizedBuffer

func (m *Role) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) Reset

func (m *Role) Reset()

func (*Role) Size

func (m *Role) Size() (n int)

func (*Role) String

func (this *Role) String() string

func (*Role) Unmarshal

func (m *Role) Unmarshal(dAtA []byte) error

func (*Role) XXX_DiscardUnknown

func (m *Role) XXX_DiscardUnknown()

func (*Role) XXX_Marshal

func (m *Role) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Role) XXX_Merge

func (m *Role) XXX_Merge(src proto.Message)

func (*Role) XXX_Size

func (m *Role) XXX_Size() int

func (*Role) XXX_Unmarshal

func (m *Role) XXX_Unmarshal(b []byte) error

type RoleUser

type RoleUser struct {
	RoleID    github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=RoleID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"RoleID"`
	UserID    github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,2,opt,name=UserID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"UserID"`
	CreatedAt int64                              `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt int64                              `protobuf:"varint,4,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedRoleUser

func NewPopulatedRoleUser(r randyRole, easy bool) *RoleUser

func (*RoleUser) Descriptor

func (*RoleUser) Descriptor() ([]byte, []int)

func (*RoleUser) Equal

func (this *RoleUser) Equal(that interface{}) bool

func (*RoleUser) GoString

func (this *RoleUser) GoString() string

func (*RoleUser) Marshal

func (m *RoleUser) Marshal() (dAtA []byte, err error)

func (*RoleUser) MarshalTo

func (m *RoleUser) MarshalTo(dAtA []byte) (int, error)

func (*RoleUser) MarshalToSizedBuffer

func (m *RoleUser) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RoleUser) ProtoMessage

func (*RoleUser) ProtoMessage()

func (*RoleUser) Reset

func (m *RoleUser) Reset()

func (*RoleUser) Size

func (m *RoleUser) Size() (n int)

func (*RoleUser) String

func (this *RoleUser) String() string

func (*RoleUser) Unmarshal

func (m *RoleUser) Unmarshal(dAtA []byte) error

func (*RoleUser) XXX_DiscardUnknown

func (m *RoleUser) XXX_DiscardUnknown()

func (*RoleUser) XXX_Marshal

func (m *RoleUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RoleUser) XXX_Merge

func (m *RoleUser) XXX_Merge(src proto.Message)

func (*RoleUser) XXX_Size

func (m *RoleUser) XXX_Size() int

func (*RoleUser) XXX_Unmarshal

func (m *RoleUser) XXX_Unmarshal(b []byte) error

type Roles

type Roles []Role

func (Roles) IDs

func (rs Roles) IDs() []ulid.ID

type Store

type Store interface {
	Insert(context.Context, U) error
	InsertBatch(context.Context, ...U) error
	Fetch(context.Context, Filter) (U, error)
	List(context.Context, Filter) ([]U, uint64, error)
	Update(context.Context, Filter, Patch) ([]U, error)
	Delete(context.Context, Filter) error

	FetchWithPassword(context.Context, Filter) (U, error)
	ListByGroup(context.Context, Filter) (map[string][]U, uint64, error)
	ListByRole(context.Context, Filter) (map[string][]U, uint64, error)

	CountByGroup(context.Context, Filter) (map[string]uint64, error)
}

type StoreGroup

type StoreGroup interface {
	InsertGroup(context.Context, Group) error
	InsertBatchGroup(context.Context, ...Group) error
	UpdateGroup(context.Context, FilterGroup, PatchGroup) ([]Group, error)
	FetchGroup(context.Context, FilterGroup) (Group, error)
	ListGroup(context.Context, FilterGroup) ([]Group, uint64, error)
	DeleteGroup(context.Context, FilterGroup) ([]Group, error)
}

type StoreInvitation

type StoreInvitation interface {
	InsertInvitation(context.Context, Invitation) error
	InsertBatchInvitation(context.Context, ...Invitation) error
	UpdateInvitation(context.Context, FilterInvitation, PatchInvitation) ([]Invitation, error)
	FetchInvitation(context.Context, FilterInvitation) (Invitation, error)
	ListInvitation(context.Context, FilterInvitation) ([]Invitation, uint64, error)
	ListInvitationByGroup(context.Context, FilterInvitation) (map[string][]Invitation, uint64, error)
	DeleteInvitation(context.Context, FilterInvitation) error
}

type StoreInvitationRole

type StoreInvitationRole interface {
	InsertInvitationRole(context.Context, InvitationRole) error
	InsertBatchInvitationRole(context.Context, ...InvitationRole) error
	FetchInvitationRole(context.Context, FilterInvitationRole) (InvitationRole, error)
	ListInvitationRole(context.Context, FilterInvitationRole) ([]InvitationRole, error)
	CountInvitationRoleByInvitation(context.Context, FilterInvitationRole) (map[string]uint64, error)
	DeleteInvitationRole(context.Context, FilterInvitationRole) error
	DeleteInvitationRoleByGroup(context.Context, FilterInvitationRole) error
}

type StorePermission

type StorePermission interface {
	InsertPermission(context.Context, Permission) error
	InsertBatchPermission(context.Context, ...Permission) error
	FetchPermission(context.Context, FilterPermission) (Permission, error)
	ListPermission(context.Context, FilterPermission) ([]Permission, error)
	DeletePermission(context.Context, FilterPermission) error
}

type StoreRole

type StoreRole interface {
	InsertRole(context.Context, Role) error
	InsertBatchRole(context.Context, ...Role) error
	UpdateRole(context.Context, FilterRole, PatchRole) ([]Role, error)
	FetchRole(context.Context, FilterRole) (Role, error)
	ListRole(context.Context, FilterRole) ([]Role, uint64, error)
	ListRoleByInvitation(context.Context, FilterRole) (map[string][]Role, uint64, error)
	DeleteRole(context.Context, FilterRole) error

	CountRoleByGroup(context.Context, FilterRole) (map[string]uint64, error)
}

type StoreRoleUser

type StoreRoleUser interface {
	InsertRoleUser(context.Context, RoleUser) error
	InsertBatchRoleUser(context.Context, ...RoleUser) error
	FetchRoleUser(context.Context, FilterRoleUser) (RoleUser, error)
	ListRoleUser(context.Context, FilterRoleUser) ([]RoleUser, error)
	DeleteRoleUser(context.Context, FilterRoleUser) error

	ListClaims(context.Context, ulid.ID) (ClaimAuth, error)
}

type U

type U struct {
	ID           github_com_elojah_trax_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/trax/pkg/ulid.ID" json:"ID"`
	Email        string                             `protobuf:"bytes,2,opt,name=Email,proto3" json:"Email,omitempty"`
	PasswordHash []byte                             `protobuf:"bytes,3,opt,name=PasswordHash,proto3" json:"PasswordHash,omitempty"`
	PasswordSalt []byte                             `protobuf:"bytes,4,opt,name=PasswordSalt,proto3" json:"PasswordSalt,omitempty"`
	GoogleID     string                             `protobuf:"bytes,5,opt,name=GoogleID,proto3" json:"GoogleID,omitempty"`
	FirstName    string                             `protobuf:"bytes,6,opt,name=FirstName,proto3" json:"FirstName,omitempty"`
	LastName     string                             `protobuf:"bytes,7,opt,name=LastName,proto3" json:"LastName,omitempty"`
	AvatarURL    string                             `protobuf:"bytes,8,opt,name=AvatarURL,proto3" json:"AvatarURL,omitempty"`
	CreatedAt    int64                              `protobuf:"varint,9,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"`
	UpdatedAt    int64                              `protobuf:"varint,10,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"`
}

func NewPopulatedU

func NewPopulatedU(r randyUser, easy bool) *U

func (U) Check

func (u U) Check(password string) error

func (*U) Descriptor

func (*U) Descriptor() ([]byte, []int)

func (*U) Equal

func (this *U) Equal(that interface{}) bool

func (*U) GoString

func (this *U) GoString() string

func (*U) Marshal

func (m *U) Marshal() (dAtA []byte, err error)

func (*U) MarshalTo

func (m *U) MarshalTo(dAtA []byte) (int, error)

func (*U) MarshalToSizedBuffer

func (m *U) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*U) ProtoMessage

func (*U) ProtoMessage()

func (*U) Reset

func (m *U) Reset()

func (*U) Size

func (m *U) Size() (n int)

func (*U) String

func (this *U) String() string

func (*U) Unmarshal

func (m *U) Unmarshal(dAtA []byte) error

func (*U) XXX_DiscardUnknown

func (m *U) XXX_DiscardUnknown()

func (*U) XXX_Marshal

func (m *U) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*U) XXX_Merge

func (m *U) XXX_Merge(src proto.Message)

func (*U) XXX_Size

func (m *U) XXX_Size() int

func (*U) XXX_Unmarshal

func (m *U) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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