entity

package
v0.0.0-...-f2fa0db Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppToProtoList

func AppToProtoList(apl []App) []*auth.App

func AuditLogToProtoList

func AuditLogToProtoList(dml []AuditLog) []*auth.AuditLog

func DomainToProtoList

func DomainToProtoList(dml []Domain) []*auth.Domain

func ObjectToProtoList

func ObjectToProtoList(ol []Object) []*auth.Object

func ResourceToProtoList

func ResourceToProtoList(rl []Resource) []*auth.Resource

func RoleToProtoList

func RoleToProtoList(rml []Role) []*auth.Role

func RuleToProtoList

func RuleToProtoList(rml []Rule) []*auth.Rule

func UserRoleToProtoList

func UserRoleToProtoList(rml []UserRole) []*auth.UserRole

func UserToProtoList

func UserToProtoList(rml []User) []*auth.User

Types

type App

type App struct {
	gorm.Model
	UUID   string `gorm:"index"`
	Name   string
	Enable bool
}

func (App) ToProto

func (ap App) ToProto() *auth.App

type AuditLog

type AuditLog struct {
	gorm.Model
	UUID     string `gorm:"index"`
	User     User   `gorm:"foreignKey:UserID"`
	UserID   uint
	Action   string
	Object   string
	OldValue string
	NewValue string
}

func (AuditLog) ToProto

func (al AuditLog) ToProto() *auth.AuditLog

type Domain

type Domain struct {
	gorm.Model
	UUID   string `gorm:"index"`
	Name   string `gorm:"index"`
	Enable bool
}

func (Domain) ToProto

func (dm Domain) ToProto() *auth.Domain

type Object

type Object struct {
	gorm.Model
	UUID       string `gorm:"index"`
	Identifier string `gorm:"index:idx_app_object"`
	AppID      uint   `gorm:"index:idx_app_object"`
	App        App
}

func (Object) ToProto

func (o Object) ToProto() *auth.Object

type Resource

type Resource struct {
	gorm.Model
	UUID  string `gorm:"index"`
	Name  string `gorm:"index:idx_app_resource"`
	AppID uint   `gorm:"index:idx_app_resource"`
	App   App
}

func (Resource) ToProto

func (r Resource) ToProto() *auth.Resource

type Role

type Role struct {
	gorm.Model
	UUID   string `gorm:"index"`
	Title  string `gorm:"index"`
	Enable bool
}

func (Role) ToProto

func (rm Role) ToProto() *auth.Role

type Rule

type Rule struct {
	gorm.Model
	UUID     string `gorm:"index"`
	RoleID   uint
	Role     Role `gorm:"foreignKey:RoleID"`
	DomainID uint
	Domain   Domain `gorm:"foreignKey:DomainID"`
	Resource string
	Object   string
	Action   string
	Effect   string
}

func (*Rule) AfterCreate

func (r *Rule) AfterCreate(tx *gorm.DB) (err error)

func (*Rule) AfterDelete

func (r *Rule) AfterDelete(tx *gorm.DB) (err error)

func (*Rule) AfterUpdate

func (r *Rule) AfterUpdate(tx *gorm.DB) (err error)

func (Rule) Bytes

func (r Rule) Bytes() ([]byte, error)

func (Rule) ToProto

func (r Rule) ToProto() *auth.Rule

type User

type User struct {
	gorm.Model
	UUID      string `gorm:"index"`
	Firstname string
	Lastname  string
	Username  string `gorm:"index"`
	Password  string
	Gender    string
	AvatarURL string
	Email     string `gorm:"unique"`
	Enable    bool
	RawData   string
	UserRoles []UserRole
}

func (*User) AfterDelete

func (r *User) AfterDelete(tx *gorm.DB) (err error)

func (User) ToProto

func (r User) ToProto(secure bool) *auth.User

type UserRole

type UserRole struct {
	gorm.Model
	UUID     string `gorm:"index"`
	RoleID   uint
	Role     Role
	User     User
	UserID   uint
	DomainID uint
	Domain   Domain
	Enable   bool
}

func (UserRole) ToProto

func (dr UserRole) ToProto() *auth.UserRole

Jump to

Keyboard shortcuts

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