biz

package
v0.0.0-...-a7b145a Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExistUsername = errors.New("已存在的用户名")
	ErrNotFound      = errors.New("记录不存在")
	ErrNotFoundUser  = errors.New("用户名不存在")
)
View Source
var ProviderSet = wire.NewSet(NewIamCase)

Functions

This section is empty.

Types

type BindRepo

type BindRepo interface{}

type IamCase

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

func NewIamCase

func NewIamCase(
	ctx context.Context,
	userRepo UserRepo,
	roleRepo RoleRepo,
	bindRepo BindRepo,
	tenantRepo TenantRepo,
	policyRepo PolicyRepo,
	manager ladon.Manager,
	tokenMaker token.Maker) *IamCase

func (*IamCase) CanDo

func (uc *IamCase) CanDo(ctx context.Context, username string, resource string, action string) bool

func (*IamCase) CreateToken

func (uc *IamCase) CreateToken(ctx context.Context, username, password string) (*Token, error)

func (*IamCase) CreateUser

func (u *IamCase) CreateUser(ctx context.Context, user *User) (*User, error)

CreateUser hashed password and create a new user.

func (*IamCase) GetRolesByUsername

func (u *IamCase) GetRolesByUsername(ctx context.Context, username string) ([]*Role, error)

type IamRepo

type IamRepo interface {
	// ============================================
	// User
	CreateUser(ctx context.Context, user *User) (*User, error)
}

type PolicyRepo

type PolicyRepo interface{}

type Role

type Role struct {
	RoleName string
	Status   string
}

type RoleRepo

type RoleRepo interface{}

type TenantRepo

type TenantRepo interface{}

type Token

type Token struct {
	Jwt string
}

type User

type User struct {
	ID       int64
	Username string
	Password string
	Phone    string
	Email    string
}

type UserRepo

type UserRepo interface {
	CreateUser(ctx context.Context, user *User) (*User, error)
	Roles(ctx context.Context, username string) ([]*Role, error)
	Passwd(ctx context.Context, username string) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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