adminimpl

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminName     = "admin"
	PublicName    = "public"
	PublicGroupId = 0 // groupId for content always allowed to access
	AdminGroupId  = 1 // groupId corresponding to role administration

	ActionAccess = "access"
	ActionCreate = "create"
	ActionUpdate = "update"
	ActionDelete = "delete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminService

type AdminService interface {
	AuthService
	GetAllGroups(ctx context.Context, adminId uint64) ([]Group, error)
	GetActions(ctx context.Context, adminId uint64, roleName string, groupName string) ([]string, error)
	UpdateUser(ctx context.Context, adminId uint64, userId uint64, roles []Group) error
	UpdateRole(ctx context.Context, adminId uint64, roleName string, groupName string, actions []string) error
	GetUserRoles(ctx context.Context, adminId uint64, userId uint64) ([]Group, error)
	ViewUserRoles(ctx context.Context, adminId uint64, userId uint64) (bool, []Group, error)
	EditUserRoles(ctx context.Context, adminId uint64, userId uint64) ([]Group, []Group, error)
}

type AuthService

type AuthService interface {
	AuthQuery(ctx context.Context, userId uint64, groupId uint64, action string) error
}

type Group

type Group struct {
	weaver.AutoMarshal
	Id    uint64
	Name  string
	Roles []Role
}

func (*Group) WeaverMarshal

func (x *Group) WeaverMarshal(enc *codegen.Encoder)

func (*Group) WeaverUnmarshal

func (x *Group) WeaverUnmarshal(dec *codegen.Decoder)

type Role

type Role struct {
	weaver.AutoMarshal
	Name    string
	Actions []string
}

func (*Role) WeaverMarshal

func (x *Role) WeaverMarshal(enc *codegen.Encoder)

func (*Role) WeaverUnmarshal

func (x *Role) WeaverUnmarshal(dec *codegen.Decoder)

Jump to

Keyboard shortcuts

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