vault

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceManagerUser     = "manage-users"
	ResourceBasicUser       = "basic-user"
	ResourceManageResources = "manage-resources"
)
View Source
const (
	DefaultMonitorPath = "/auth/resource"
)
View Source
const (
	ErrCodeRoleNotFound = "GA0001"
)
View Source
const (
	Version = "v0.0.17"
)

Variables

This section is empty.

Functions

func AddResToRoleIfNotExist added in v0.0.16

func AddResToRoleIfNotExist(rail miso.Rail, req AddRoleResReq, user common.User) error

func AddRole added in v0.0.16

func AddRole(ec miso.Rail, req AddRoleReq, user common.User) error

func AddUser

func AddUser(rail miso.Rail, tx *gorm.DB, req AddUserParam, operator string) error

func AdminAddResourceEp added in v0.0.17

func AdminAddResourceEp(c *gin.Context, rail miso.Rail, req CreateResReq) (any, error)

func AdminAddRoleEp added in v0.0.17

func AdminAddRoleEp(c *gin.Context, rail miso.Rail, req AddRoleReq) (any, error)

func AdminAddUserEp added in v0.0.17

func AdminAddUserEp(c *gin.Context, rail miso.Rail, req AddUserParam) (any, error)

func AdminBindResPathEp added in v0.0.17

func AdminBindResPathEp(c *gin.Context, rail miso.Rail, req BindPathResReq) (any, error)

func AdminBindRoleResEp added in v0.0.17

func AdminBindRoleResEp(c *gin.Context, rail miso.Rail, req AddRoleResReq) (any, error)

func AdminDeletePathEp added in v0.0.17

func AdminDeletePathEp(c *gin.Context, rail miso.Rail, req DeletePathReq) (any, error)

func AdminListPathsEp added in v0.0.17

func AdminListPathsEp(c *gin.Context, rail miso.Rail, req ListPathReq) (miso.GnResp[ListPathResp], error)

func AdminListResEp added in v0.0.17

func AdminListResEp(c *gin.Context, rail miso.Rail, req ListResReq) (miso.GnResp[ListResResp], error)

func AdminListRoleBriefsEp added in v0.0.17

func AdminListRoleBriefsEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]RoleBrief], error)

func AdminListRoleResEp added in v0.0.17

func AdminListRoleResEp(c *gin.Context, rail miso.Rail, req ListRoleResReq) (miso.GnResp[ListRoleResResp], error)

func AdminListRolesEp added in v0.0.17

func AdminListRolesEp(c *gin.Context, rail miso.Rail, req ListRoleReq) (miso.GnResp[ListRoleResp], error)

func AdminListUsersEp added in v0.0.17

func AdminListUsersEp(c *gin.Context, rail miso.Rail, req ListUserReq) (miso.GnResp[miso.PageRes[api.UserInfo]], error)

func AdminRemoveResourceEp added in v0.0.17

func AdminRemoveResourceEp(c *gin.Context, rail miso.Rail, req DeleteResourceReq) (any, error)

func AdminReviewUserEp added in v0.0.17

func AdminReviewUserEp(c *gin.Context, rail miso.Rail, req AdminReviewUserReq) (any, error)

func AdminUnbindResPathEp added in v0.0.17

func AdminUnbindResPathEp(c *gin.Context, rail miso.Rail, req UnbindPathResReq) (any, error)

func AdminUnbindRoleResEp added in v0.0.17

func AdminUnbindRoleResEp(c *gin.Context, rail miso.Rail, req RemoveRoleResReq) (any, error)

func AdminUpdatePathEp added in v0.0.17

func AdminUpdatePathEp(c *gin.Context, rail miso.Rail, req UpdatePathReq) (any, error)

func AdminUpdateUser

func AdminUpdateUser(rail miso.Rail, tx *gorm.DB, req AdminUpdateUserReq, operator common.User) error

func AdminUpdateUserEp added in v0.0.17

func AdminUpdateUserEp(c *gin.Context, rail miso.Rail, req AdminUpdateUserReq) (any, error)

func BindPathRes added in v0.0.16

func BindPathRes(rail miso.Rail, req BindPathResReq) error

func BootstrapServer

func BootstrapServer(args []string)

func CreateMonitoredServiceWatch added in v0.0.16

func CreateMonitoredServiceWatch(rail miso.Rail, m MonitoredService) error

func CreateMonitoredServiceWatches added in v0.0.16

func CreateMonitoredServiceWatches(rail miso.Rail) error

func CreatePathIfNotExist added in v0.0.16

func CreatePathIfNotExist(rail miso.Rail, req CreatePathReq, user common.User) error

func CreateResourceIfNotExist added in v0.0.16

func CreateResourceIfNotExist(rail miso.Rail, req CreateResReq, user common.User) error

func DecodeTokenUsername

func DecodeTokenUsername(rail miso.Rail, token string) (string, error)

func DeletePath added in v0.0.16

func DeletePath(ec miso.Rail, req DeletePathReq) error

func DeleteResource added in v0.0.16

func DeleteResource(ec miso.Rail, req DeleteResourceReq) error

func DeleteUserKey

func DeleteUserKey(rail miso.Rail, tx *gorm.DB, req DeleteUserKeyReq, userId int) error

func ExchangeToken

func ExchangeToken(rail miso.Rail, tx *gorm.DB, req ExchangeTokenReq) (string, error)

func ExchangeTokenEp

func ExchangeTokenEp(c *gin.Context, rail miso.Rail, req ExchangeTokenReq) (miso.GnResp[string], error)

func GenUserKey

func GenUserKey(rail miso.Rail, tx *gorm.DB, req GenUserKeyReq, username string) error

func GetRoleInfo added in v0.0.14

func GetRoleInfo(ec miso.Rail, req api.RoleInfoReq) (api.RoleInfoResp, error)

func GetRoleInfoEp added in v0.0.17

func GetRoleInfoEp(c *gin.Context, rail miso.Rail, req api.RoleInfoReq) (miso.GnResp[api.RoleInfoResp], error)

func GetTokenUserInfoEp added in v0.0.17

func GetTokenUserInfoEp(c *gin.Context, rail miso.Rail, req GetTokenUserReq) (miso.GnResp[UserInfoBrief], error)

func InvalidateUserInfoCache

func InvalidateUserInfoCache(rail miso.Rail, username string) error

func ItnCheckResourceAccessEp added in v0.0.17

func ItnCheckResourceAccessEp(c *gin.Context, rail miso.Rail, req TestResAccessReq) (miso.GnResp[TestResAccessResp], error)

func ItnFetchUserIdByNameEp added in v0.0.17

func ItnFetchUserIdByNameEp(c *gin.Context, rail miso.Rail, req FetchUserIdByNameReq) (miso.GnResp[int], error)

func ItnFetchUserInfoEp added in v0.0.15

func ItnFetchUserInfoEp(c *gin.Context, rail miso.Rail, req api.FindUserReq) (miso.GnResp[api.UserInfo], error)

func ItnFetchUsernamesByNosEp added in v0.0.17

func ItnFetchUsernamesByNosEp(c *gin.Context, rail miso.Rail, req api.FetchNameByUserNoReq) (miso.GnResp[api.FetchUsernamesRes], error)

func ItnFindNameOfUserNo

func ItnFindNameOfUserNo(rail miso.Rail, tx *gorm.DB, req api.FetchNameByUserNoReq) (api.FetchUsernamesRes, error)

func ItnFindUserInfo

func ItnFindUserInfo(rail miso.Rail, tx *gorm.DB, req api.FindUserReq) (api.UserInfo, error)

func ItnFindUserWithRoleEp added in v0.0.17

func ItnFindUserWithRoleEp(c *gin.Context, rail miso.Rail, req api.FetchUsersWithRoleReq) (miso.GnResp[[]api.UserInfo], error)

func ItnFindUsersWithRole added in v0.0.15

func ItnFindUsersWithRole(rail miso.Rail, db *gorm.DB, req api.FetchUsersWithRoleReq) ([]api.UserInfo, error)

func ItnReportPathEp added in v0.0.17

func ItnReportPathEp(c *gin.Context, rail miso.Rail, req CreatePathReq) (any, error)

func ItnReportResourceEp added in v0.0.17

func ItnReportResourceEp(c *gin.Context, rail miso.Rail, req CreateResReq) (any, error)

func ListAccessLogs

func ListAccessLogs(rail miso.Rail, tx *gorm.DB, user common.User, req ListAccessLogReq) (miso.PageRes[ListedAccessLog], error)

func ListAllResBriefEp added in v0.0.17

func ListAllResBriefEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]ResBrief], error)

func ListResCandidatesEp added in v0.0.17

func ListResCandidatesEp(c *gin.Context, rail miso.Rail, req ListResCandidatesReq) (miso.GnResp[[]ResBrief], error)

func ListUserAccessibleResEp added in v0.0.17

func ListUserAccessibleResEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]ResBrief], error)

func ListUserKeys

func ListUserKeys(rail miso.Rail, tx *gorm.DB, req ListUserKeysReq, user common.User) (miso.PageRes[ListedUserKey], error)

func ListUsers

func ListUsers(rail miso.Rail, tx *gorm.DB, req ListUserReq) (miso.PageRes[api.UserInfo], error)

func LoadPathResCache added in v0.0.16

func LoadPathResCache(rail miso.Rail) error

Load cache for path -> resource

func LoadResCodeCache added in v0.0.16

func LoadResCodeCache(rail miso.Rail) error

Load cache for resource code

func LoadRoleResCache added in v0.0.16

func LoadRoleResCache(ec miso.Rail) error

Load cache for role -> resources

func QueryResourcePathAsync added in v0.0.16

func QueryResourcePathAsync(rail miso.Rail, server miso.Server, m MonitoredService)

func RegisterInternalPathResourcesOnBootstrapped added in v0.0.16

func RegisterInternalPathResourcesOnBootstrapped()

func RegisterRoutes added in v0.0.16

func RegisterRoutes(rail miso.Rail) error

func RemoteAddr

func RemoteAddr(forwardedFor string) string

func RemoveResFromRole added in v0.0.16

func RemoveResFromRole(ec miso.Rail, req RemoveRoleResReq) error

func ReviewUserRegistration

func ReviewUserRegistration(rail miso.Rail, tx *gorm.DB, req AdminReviewUserReq) error

func SaveAccessLogEvent

func SaveAccessLogEvent(rail miso.Rail, tx *gorm.DB, evt AccessLogEvent) error

func ScheduleTasks added in v0.0.16

func ScheduleTasks(rail miso.Rail) error

func SubEventBus added in v0.0.16

func SubEventBus(rail miso.Rail) error

func TriggerResourcePathCollection added in v0.0.16

func TriggerResourcePathCollection(rail miso.Rail, m MonitoredService)

func UnbindPathRes added in v0.0.16

func UnbindPathRes(ec miso.Rail, req UnbindPathResReq) error

func UpdatePassword

func UpdatePassword(rail miso.Rail, tx *gorm.DB, username string, req UpdatePasswordReq) error

func UpdatePath added in v0.0.16

func UpdatePath(ec miso.Rail, req UpdatePathReq) error

func UserDeleteUserKeyEp added in v0.0.17

func UserDeleteUserKeyEp(c *gin.Context, rail miso.Rail, req DeleteUserKeyReq) (any, error)

func UserGenUserKeyEp added in v0.0.17

func UserGenUserKeyEp(c *gin.Context, rail miso.Rail, req GenUserKeyReq) (any, error)

func UserGetUserInfoEp added in v0.0.17

func UserGetUserInfoEp(c *gin.Context, rail miso.Rail) (miso.GnResp[UserInfoRes], error)

func UserListAccessHistoryEp added in v0.0.17

func UserListAccessHistoryEp(c *gin.Context, rail miso.Rail, req ListAccessLogReq) (miso.GnResp[miso.PageRes[ListedAccessLog]], error)

func UserListUserKeysEp added in v0.0.17

func UserListUserKeysEp(c *gin.Context, rail miso.Rail, req ListUserKeysReq) (miso.GnResp[miso.PageRes[ListedUserKey]], error)

func UserLoginEp

func UserLoginEp(gin *gin.Context, rail miso.Rail, req LoginReq) (miso.GnResp[string], error)

func UserRegister

func UserRegister(rail miso.Rail, tx *gorm.DB, req RegisterReq) error

func UserRegisterEp added in v0.0.17

func UserRegisterEp(c *gin.Context, rail miso.Rail, req RegisterReq) (any, error)

func UserUpdatePasswordEp added in v0.0.17

func UserUpdatePasswordEp(c *gin.Context, rail miso.Rail, req UpdatePasswordReq) (any, error)

Types

type AccessLog

type AccessLog struct {
	Id         int
	UserAgent  string
	IpAddress  string
	UserId     int
	Username   string
	Url        string
	AccessTime miso.ETime
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
	IsDel      common.IS_DEL
}

type AccessLogEvent

type AccessLogEvent struct {
	UserAgent  string     `json:"userAgent"`
	IpAddress  string     `json:"ipAddress"`
	UserId     int        `json:"userId"`
	Username   string     `json:"username"`
	Url        string     `json:"url"`
	AccessTime miso.ETime `json:"accessTime"`
}

type AddRoleReq added in v0.0.16

type AddRoleReq struct {
	Name string `json:"name" validation:"notEmpty,maxLen:32"` // role name
}

type AddRoleResReq added in v0.0.16

type AddRoleResReq struct {
	RoleNo  string `json:"roleNo" validation:"notEmpty"`
	ResCode string `json:"resCode" validation:"notEmpty"`
}

type AddUserParam

type AddUserParam struct {
	Username string `json:"username" valid:"notEmpty"`
	Password string `json:"password" valid:"notEmpty"`
	RoleNo   string `json:"roleNo"`
}

type AdminAddUserReq

type AdminAddUserReq struct {
	Username string `json:"username" valid:"notEmpty"`
	Password string `json:"password" valid:"notEmpty"`
	RoleNo   string `json:"roleNo" valid:"notEmpty"`
}

type AdminReviewUserReq

type AdminReviewUserReq struct {
	UserId       int    `json:"userId" valid:"positive"`
	ReviewStatus string `json:"reviewStatus"`
}

type AdminUpdateUserReq

type AdminUpdateUserReq struct {
	Id         int    `json:"id" valid:"positive"`
	RoleNo     string `json:"roleNo" valid:"notEmpty"`
	IsDisabled int    `json:"isDisabled"`
}

type BindPathResReq added in v0.0.16

type BindPathResReq struct {
	PathNo  string `json:"pathNo" validation:"notEmpty"`
	ResCode string `json:"resCode" validation:"notEmpty"`
}

type CachedUrlRes added in v0.0.16

type CachedUrlRes struct {
	Id      int      // id
	Pgroup  string   // path group
	PathNo  string   // path no
	ResCode string   // resource code
	Url     string   // url
	Method  string   // http method
	Ptype   PathType // path type: PROTECTED, PUBLIC
}

type CreatePathReq added in v0.0.16

type CreatePathReq struct {
	Type    PathType `json:"type" validation:"notEmpty"`
	Url     string   `json:"url" validation:"notEmpty,maxLen:128"`
	Group   string   `json:"group" validation:"notEmpty,maxLen:20"`
	Method  string   `json:"method" validation:"notEmpty,maxLen:10"`
	Desc    string   `json:"desc" validation:"maxLen:255"`
	ResCode string   `json:"resCode"`
}

type CreateResReq added in v0.0.16

type CreateResReq struct {
	Name string `json:"name" validation:"notEmpty,maxLen:32"`
	Code string `json:"code" validation:"notEmpty,maxLen:32"`
}

type DeletePathReq added in v0.0.16

type DeletePathReq struct {
	PathNo string `json:"pathNo" validation:"notEmpty"`
}

type DeleteResourceReq added in v0.0.16

type DeleteResourceReq struct {
	ResCode string `json:"resCode" validation:"notEmpty"`
}

type DeleteUserKeyReq

type DeleteUserKeyReq struct {
	UserKeyId int `json:"userKeyId"`
}

type EPath added in v0.0.16

type EPath struct {
	Id         int      // id
	Pgroup     string   // path group
	PathNo     string   // path no
	Desc       string   // description
	Url        string   // url
	Method     string   // method
	Ptype      PathType // path type: PROTECTED, PUBLIC
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type ERes added in v0.0.16

type ERes struct {
	Id         int    // id
	Code       string // resource code
	Name       string // resource name
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type ERole added in v0.0.16

type ERole struct {
	Id         int
	RoleNo     string
	Name       string
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type ERoleRes added in v0.0.16

type ERoleRes struct {
	Id         int    // id
	RoleNo     string // role no
	ResCode    string // resource code
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type ExchangeTokenReq

type ExchangeTokenReq struct {
	Token string `json:"token" valid:"notEmpty"`
}

type ExtendedPathRes added in v0.0.16

type ExtendedPathRes struct {
	Id         int      // id
	Pgroup     string   // path group
	PathNo     string   // path no
	ResCode    string   // resource code
	Desc       string   // description
	Url        string   // url
	Method     string   // http method
	Ptype      PathType // path type: PROTECTED, PUBLIC
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type FetchUserIdByNameReq added in v0.0.17

type FetchUserIdByNameReq struct {
	Username string `form:"username" desc:"Username"`
}

type GenResScriptReq added in v0.0.16

type GenResScriptReq struct {
	ResCodes []string `json:"resCodes" validation:"notEmpty"`
}

type GenUserKeyReq

type GenUserKeyReq struct {
	Password string `json:"password" valid:"notEmpty"`
	KeyName  string `json:"keyName" valid:"notEmpty"`
}

type GetTokenUserReq added in v0.0.17

type GetTokenUserReq struct {
	Token string `form:"token" desc:"jwt token"`
}

type ListAccessLogReq

type ListAccessLogReq struct {
	Paging miso.Paging `json:"pagingVo"`
}

type ListPathReq added in v0.0.16

type ListPathReq struct {
	ResCode string      `json:"resCode"`
	Pgroup  string      `json:"pgroup"`
	Url     string      `json:"url"`
	Ptype   PathType    `json:"ptype"`
	Paging  miso.Paging `json:"pagingVo"`
}

type ListPathResp added in v0.0.16

type ListPathResp struct {
	Paging  miso.Paging `json:"pagingVo"`
	Payload []WPath     `json:"payload"`
}

func ListPaths added in v0.0.16

func ListPaths(ec miso.Rail, req ListPathReq) (ListPathResp, error)

type ListResCandidatesReq added in v0.0.17

type ListResCandidatesReq struct {
	RoleNo string `form:"roleNo" desc:"Role No"`
}

type ListResReq added in v0.0.16

type ListResReq struct {
	Paging miso.Paging `json:"pagingVo"`
}

type ListResResp added in v0.0.16

type ListResResp struct {
	Paging  miso.Paging `json:"pagingVo"`
	Payload []WRes      `json:"payload"`
}

func ListResources added in v0.0.16

func ListResources(ec miso.Rail, req ListResReq) (ListResResp, error)

type ListRoleReq added in v0.0.16

type ListRoleReq struct {
	Paging miso.Paging `json:"pagingVo"`
}

type ListRoleResReq added in v0.0.16

type ListRoleResReq struct {
	Paging miso.Paging `json:"pagingVo"`
	RoleNo string      `json:"roleNo" validation:"notEmpty"`
}

type ListRoleResResp added in v0.0.16

type ListRoleResResp struct {
	Paging  miso.Paging     `json:"pagingVo"`
	Payload []ListedRoleRes `json:"payload"`
}

func ListRoleRes added in v0.0.16

func ListRoleRes(ec miso.Rail, req ListRoleResReq) (ListRoleResResp, error)

type ListRoleResp added in v0.0.16

type ListRoleResp struct {
	Payload []WRole     `json:"payload"`
	Paging  miso.Paging `json:"pagingVo"`
}

func ListRoles added in v0.0.16

func ListRoles(ec miso.Rail, req ListRoleReq) (ListRoleResp, error)

type ListUserKeysReq

type ListUserKeysReq struct {
	Paging miso.Paging `json:"pagingVo"`
	Name   string      `json:"name"`
}

type ListUserReq

type ListUserReq struct {
	Username   *string     `json:"username"`
	RoleNo     *string     `json:"roleNo"`
	IsDisabled *int        `json:"isDisabled"`
	Paging     miso.Paging `json:"pagingVo"`
}

type ListedAccessLog

type ListedAccessLog struct {
	Id         int        `json:"id"`
	UserAgent  string     `json:"userAgent"`
	IpAddress  string     `json:"ipAddress"`
	Username   string     `json:"username"`
	Url        string     `json:"url"`
	AccessTime miso.ETime `json:"accessTime"`
}

type ListedRoleRes added in v0.0.16

type ListedRoleRes struct {
	Id         int       `json:"id"`
	ResCode    string    `json:"resCode"`
	ResName    string    `json:"resName"`
	CreateTime time.Time `json:"createTime"`
	CreateBy   string    `json:"createBy"`
}

type ListedUserKey

type ListedUserKey struct {
	Id             int        `json:"id"`
	SecretKey      string     `json:"secretKey"`
	Name           string     `json:"name"`
	ExpirationTime miso.ETime `json:"expirationTime"`
	CreateTime     miso.ETime `json:"createTime"`
}

type LoginReq

type LoginReq struct {
	Username string `json:"username" valid:"notEmpty"`
	Password string `json:"password" valid:"notEmpty"`
}

type MonitorConf added in v0.0.16

type MonitorConf struct {
	Monitor []MonitoredService
}

type MonitoredService added in v0.0.16

type MonitoredService struct {
	Service string
	Path    string
	All     bool
}

func LoadMonitoredServices added in v0.0.16

func LoadMonitoredServices() []MonitoredService

type NewUserKey

type NewUserKey struct {
	Name           string
	SecretKey      string
	ExpirationTime miso.ETime
	UserId         int
}

type PasswordLoginParam

type PasswordLoginParam struct {
	Username string
	Password string
}

type PathRes added in v0.0.16

type PathRes struct {
	Id         int    // id
	PathNo     string // path no
	ResCode    string // resource code
	CreateTime miso.ETime
	CreateBy   string
	UpdateTime miso.ETime
	UpdateBy   string
}

type PathType added in v0.0.16

type PathType string
const (
	// default roleno for admin
	DefaultAdminRoleNo = "role_554107924873216177918"

	PtProtected PathType = "PROTECTED"
	PtPublic    PathType = "PUBLIC"
)

type QueryResourcePathRes added in v0.0.16

type QueryResourcePathRes struct {
	Resources []CreateResReq
	Paths     []CreatePathReq
}

func QueryResourcePath added in v0.0.16

func QueryResourcePath(rail miso.Rail, server miso.Server, service string, path string) (QueryResourcePathRes, error)

type RegisterReq

type RegisterReq struct {
	Username string `json:"username" valid:"notEmpty"`
	Password string `json:"password" valid:"notEmpty"`
}

type RemoveRoleResReq added in v0.0.16

type RemoveRoleResReq struct {
	RoleNo  string `json:"roleNo" validation:"notEmpty"`
	ResCode string `json:"resCode" validation:"notEmpty"`
}

type ResBrief added in v0.0.16

type ResBrief struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

func ListAllResBriefs added in v0.0.16

func ListAllResBriefs(rail miso.Rail) ([]ResBrief, error)

func ListAllResBriefsOfRole added in v0.0.16

func ListAllResBriefsOfRole(ec miso.Rail, roleNo string) ([]ResBrief, error)

func ListResourceCandidatesForRole added in v0.0.16

func ListResourceCandidatesForRole(ec miso.Rail, roleNo string) ([]ResBrief, error)

type RoleBrief added in v0.0.16

type RoleBrief struct {
	RoleNo string `json:"roleNo"`
	Name   string `json:"name"`
}

func ListAllRoleBriefs added in v0.0.16

func ListAllRoleBriefs(ec miso.Rail) ([]RoleBrief, error)

type TestResAccessReq added in v0.0.16

type TestResAccessReq struct {
	RoleNo string `json:"roleNo"`
	Url    string `json:"url"`
	Method string `json:"method"`
}

type TestResAccessResp added in v0.0.16

type TestResAccessResp struct {
	Valid bool `json:"valid"`
}

func TestResourceAccess added in v0.0.16

func TestResourceAccess(ec miso.Rail, req TestResAccessReq) (TestResAccessResp, error)

Test access to resource

type TokenUser

type TokenUser struct {
	Id       int
	UserNo   string
	Username string
	RoleNo   string
}

func DecodeTokenUser

func DecodeTokenUser(rail miso.Rail, token string) (TokenUser, error)

type UnbindPathResReq added in v0.0.16

type UnbindPathResReq struct {
	PathNo  string `json:"pathNo" validation:"notEmpty"`
	ResCode string `json:"resCode" validation:"notEmpty"`
}

type UpdatePasswordReq

type UpdatePasswordReq struct {
	PrevPassword string `json:"prevPassword" valid:"notEmpty"`
	NewPassword  string `json:"newPassword" valid:"notEmpty"`
}

type UpdatePathReq added in v0.0.16

type UpdatePathReq struct {
	Type   PathType `json:"type" validation:"notEmpty"`
	PathNo string   `json:"pathNo" validation:"notEmpty"`
	Group  string   `json:"group" validation:"notEmpty,maxLen:20"`
}

type User

type User struct {
	Id           int
	UserNo       string
	Username     string
	Password     string
	Salt         string
	ReviewStatus string
	RoleNo       string
	RoleName     string
	IsDisabled   int
	CreateTime   miso.ETime
	CreateBy     string
	UpdateTime   miso.ETime
	UpdateBy     string
	IsDel        common.IS_DEL
}

func UserLogin

func UserLogin(rail miso.Rail, tx *gorm.DB, req PasswordLoginParam) (string, User, error)

func (*User) CanReview

func (u *User) CanReview() bool

func (*User) Deleted

func (u *User) Deleted() bool

type UserDetail

type UserDetail struct {
	Id           int    `json:"id"`
	Username     string `json:"username"`
	RoleName     string `json:"roleName"`
	RoleNo       string `json:"roleNo"`
	UserNo       string `json:"userNo"`
	RegisterDate string `json:"registerDate"`
	Password     string `json:"password"`
	Salt         string `json:"salt"`
}

func LoadUserBriefThrCache

func LoadUserBriefThrCache(rail miso.Rail, tx *gorm.DB, username string) (UserDetail, error)

func LoadUserInfoBrief

func LoadUserInfoBrief(rail miso.Rail, tx *gorm.DB, username string) (UserDetail, error)

type UserInfoBrief

type UserInfoBrief struct {
	Id           int    `json:"id"`
	Username     string `json:"username"`
	RoleName     string `json:"roleName"`
	RoleNo       string `json:"roleNo"`
	UserNo       string `json:"userNo"`
	RegisterDate string `json:"registerDate"`
}

func FetchUserBrief

func FetchUserBrief(rail miso.Rail, tx *gorm.DB, username string) (UserInfoBrief, error)

func GetTokenUser

func GetTokenUser(rail miso.Rail, tx *gorm.DB, token string) (UserInfoBrief, error)

type UserInfoRes added in v0.0.17

type UserInfoRes struct {
	Id           int
	Username     string
	RoleName     string
	RoleNo       string
	UserNo       string
	RegisterDate string
}

type WPath added in v0.0.16

type WPath struct {
	Id         int        `json:"id"`
	Pgroup     string     `json:"pgroup"`
	PathNo     string     `json:"pathNo"`
	Method     string     `json:"method"`
	Desc       string     `json:"desc"`
	Url        string     `json:"url"`
	Ptype      PathType   `json:"ptype"`
	CreateTime miso.ETime `json:"createTime"`
	CreateBy   string     `json:"createBy"`
	UpdateTime miso.ETime `json:"updateTime"`
	UpdateBy   string     `json:"updateBy"`
}

type WRes added in v0.0.16

type WRes struct {
	Id         int        `json:"id"`
	Code       string     `json:"code"`
	Name       string     `json:"name"`
	CreateTime miso.ETime `json:"createTime"`
	CreateBy   string     `json:"createBy"`
	UpdateTime miso.ETime `json:"updateTime"`
	UpdateBy   string     `json:"updateBy"`
}

type WRole added in v0.0.16

type WRole struct {
	Id         int        `json:"id"`
	RoleNo     string     `json:"roleNo"`
	Name       string     `json:"name"`
	CreateTime miso.ETime `json:"createTime"`
	CreateBy   string     `json:"createBy"`
	UpdateTime miso.ETime `json:"updateTime"`
	UpdateBy   string     `json:"updateBy"`
}

Jump to

Keyboard shortcuts

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