vault

package
v0.0.20 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// default roleno for admin
	DefaultAdminRoleNo = "role_554107924873216177918"

	PathTypeProtected string = "PROTECTED"
	PathTypePublic    string = "PUBLIC"
)
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.20"
)

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 AdminAddResourceEp added in v0.0.17

func AdminAddResourceEp(inb *miso.Inbound, req CreateResReq) (any, error)

func AdminAddRoleEp added in v0.0.17

func AdminAddRoleEp(inb *miso.Inbound, req AddRoleReq) (any, error)

func AdminAddUserEp added in v0.0.17

func AdminAddUserEp(inb *miso.Inbound, req AddUserParam) (any, error)

func AdminBindResPathEp added in v0.0.17

func AdminBindResPathEp(inb *miso.Inbound, req BindPathResReq) (any, error)

func AdminBindRoleResEp added in v0.0.17

func AdminBindRoleResEp(inb *miso.Inbound, req AddRoleResReq) (any, error)

func AdminDeletePathEp added in v0.0.17

func AdminDeletePathEp(inb *miso.Inbound, req DeletePathReq) (any, error)

func AdminListUsersEp added in v0.0.17

func AdminListUsersEp(inb *miso.Inbound, req ListUserReq) (miso.PageRes[api.UserInfo], error)

func AdminRemoveResourceEp added in v0.0.17

func AdminRemoveResourceEp(inb *miso.Inbound, req DeleteResourceReq) (any, error)

func AdminReviewUserEp added in v0.0.17

func AdminReviewUserEp(inb *miso.Inbound, req AdminReviewUserReq) (any, error)

func AdminUnbindResPathEp added in v0.0.17

func AdminUnbindResPathEp(inb *miso.Inbound, req UnbindPathResReq) (any, error)

func AdminUnbindRoleResEp added in v0.0.17

func AdminUnbindRoleResEp(inb *miso.Inbound, req RemoveRoleResReq) (any, error)

func AdminUpdatePathEp added in v0.0.17

func AdminUpdatePathEp(inb *miso.Inbound, 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(inb *miso.Inbound, 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 CreatePath added in v0.0.18

func CreatePath(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(rail miso.Rail, req DeleteResourceReq) error

func DeleteUserKey

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

func ExchangeToken

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

func ExchangeTokenEp

func ExchangeTokenEp(inb *miso.Inbound, req ExchangeTokenReq) (string, error)

func FindUserWithRes added in v0.0.18

func FindUserWithRes(rail miso.Rail, db *gorm.DB, req api.FetchUserWithResourceReq) ([]api.UserInfo, 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(inb *miso.Inbound, req api.RoleInfoReq) (api.RoleInfoResp, error)

func InvalidateUserInfoCache

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

func ItnFetchUserIdByNameEp added in v0.0.17

func ItnFetchUserIdByNameEp(inb *miso.Inbound, req FetchUserIdByNameReq) (int, error)

func ItnFetchUserInfoEp added in v0.0.15

func ItnFetchUserInfoEp(inb *miso.Inbound, req api.FindUserReq) (api.UserInfo, error)

func ItnFetchUsernamesByNosEp added in v0.0.17

func ItnFetchUsernamesByNosEp(inb *miso.Inbound, req api.FetchNameByUserNoReq) (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 ItnFindUserWithResourceEp added in v0.0.18

func ItnFindUserWithResourceEp(inb *miso.Inbound, req api.FetchUserWithResourceReq) ([]api.UserInfo, error)

func ItnFindUserWithRoleEp added in v0.0.17

func ItnFindUserWithRoleEp(inb *miso.Inbound, req api.FetchUsersWithRoleReq) ([]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(inb *miso.Inbound, req CreatePathReq) (any, error)

func ItnReportResourceEp added in v0.0.17

func ItnReportResourceEp(inb *miso.Inbound, req CreateResReq) (any, error)

func ListAccessLogs

func ListAccessLogs(rail miso.Rail, tx *gorm.DB, user common.User, req ListAccessLogReq) (miso.PageRes[ListedAccessLog], 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 LoadRoleResCache added in v0.0.16

func LoadRoleResCache(ec miso.Rail) error

Load cache for role -> resources

func NewUser added in v0.0.18

func NewUser(rail miso.Rail, tx *gorm.DB, req CreateUserParam) error

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, p SaveAccessLogParam) 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(inb *miso.Inbound, req DeleteUserKeyReq) (any, error)

func UserGenUserKeyEp added in v0.0.17

func UserGenUserKeyEp(inb *miso.Inbound, req GenUserKeyReq) (any, error)

func UserListAccessHistoryEp added in v0.0.17

func UserListAccessHistoryEp(inb *miso.Inbound, req ListAccessLogReq) (miso.PageRes[ListedAccessLog], error)

func UserListUserKeysEp added in v0.0.17

func UserListUserKeysEp(inb *miso.Inbound, req ListUserKeysReq) (miso.PageRes[ListedUserKey], error)

func UserLoginEp

func UserLoginEp(inb *miso.Inbound, req LoginReq) (string, error)

func UserRegister

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

func UserRegisterEp added in v0.0.17

func UserRegisterEp(inb *miso.Inbound, req RegisterReq) (any, error)

func UserUpdatePasswordEp added in v0.0.17

func UserUpdatePasswordEp(inb *miso.Inbound, 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      bool
}

type AccessLogEvent

type AccessLogEvent struct {
	UserAgent  string
	IpAddress  string
	UserId     int
	Username   string
	Url        string
	Success    bool
	AccessTime miso.ETime
}

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 {
	UserNo     string `valid:"notEmpty"`
	RoleNo     string `json:"roleNo"`
	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   string // path type: PROTECTED, PUBLIC
}

type CreatePathReq added in v0.0.16

type CreatePathReq struct {
	Type    string `json:"type" validation:"notEmpty" desc:"path type: 'PROTECTED' - authorization required, 'PUBLIC' - publicly accessible"`
	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 CreateUserParam added in v0.0.18

type CreateUserParam struct {
	Username     string
	Password     string
	RoleNo       string
	ReviewStatus string
	Operator     string
}

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      string // 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      string // 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:"paging"`
}

type ListPathReq added in v0.0.16

type ListPathReq struct {
	ResCode string      `json:"resCode"`
	Pgroup  string      `json:"pgroup"`
	Url     string      `json:"url"`
	Ptype   string      `json:"ptype" desc:"path type: 'PROTECTED' - authorization required, 'PUBLIC' - publicly accessible"`
	Paging  miso.Paging `json:"paging"`
}

type ListPathResp added in v0.0.16

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

func AdminListPathsEp added in v0.0.17

func AdminListPathsEp(inb *miso.Inbound, req ListPathReq) (ListPathResp, error)

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:"paging"`
}

type ListResResp added in v0.0.16

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

func AdminListResEp added in v0.0.17

func AdminListResEp(inb *miso.Inbound, req ListResReq) (ListResResp, error)

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:"paging"`
}

type ListRoleResReq added in v0.0.16

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

type ListRoleResResp added in v0.0.16

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

func AdminListRoleResEp added in v0.0.17

func AdminListRoleResEp(inb *miso.Inbound, req ListRoleResReq) (ListRoleResResp, error)

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:"paging"`
}

func AdminListRolesEp added in v0.0.17

func AdminListRolesEp(inb *miso.Inbound, req ListRoleReq) (ListRoleResp, error)

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:"paging"`
	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:"paging"`
}

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"`
	Success    bool
}

type ListedRoleRes added in v0.0.16

type ListedRoleRes struct {
	Id         int        `json:"id"`
	ResCode    string     `json:"resCode"`
	ResName    string     `json:"resName"`
	CreateTime miso.ETime `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"`
	XForwardedFor string `header:"x-forwarded-for"`
	UserAgent     string `header:"user-agent"`
}

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 NewUserParam added in v0.0.18

type NewUserParam struct {
	Id           int
	UserNo       string
	Username     string
	Password     string
	Salt         string
	ReviewStatus string
	RoleNo       string
	IsDisabled   int
	CreateTime   miso.ETime
	CreateBy     string
	UpdateTime   miso.ETime
	UpdateBy     string
	IsDel        bool
}

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 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 ListAllResBriefEp added in v0.0.17

func ListAllResBriefEp(inb *miso.Inbound) ([]ResBrief, error)

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 ListResCandidatesEp added in v0.0.17

func ListResCandidatesEp(inb *miso.Inbound, req ListResCandidatesReq) ([]ResBrief, error)

func ListResourceCandidatesForRole added in v0.0.16

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

func ListUserAccessibleResEp added in v0.0.17

func ListUserAccessibleResEp(inb *miso.Inbound) ([]ResBrief, error)

type RoleBrief added in v0.0.16

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

func AdminListRoleBriefsEp added in v0.0.17

func AdminListRoleBriefsEp(inb *miso.Inbound) ([]RoleBrief, error)

func ListAllRoleBriefs added in v0.0.16

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

type SaveAccessLogParam added in v0.0.18

type SaveAccessLogParam struct {
	UserAgent  string
	IpAddress  string
	UserId     int
	Username   string
	Url        string
	Success    bool
	AccessTime miso.ETime
}

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 ItnCheckResourceAccessEp added in v0.0.17

func ItnCheckResourceAccessEp(inb *miso.Inbound, req TestResAccessReq) (TestResAccessResp, error)

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   string `json:"type" validation:"notEmpty" desc:"path type: 'PROTECTED' - authorization required, 'PUBLIC' - publicly accessible"`
	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        bool
}

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)

func GetTokenUserInfoEp added in v0.0.17

func GetTokenUserInfoEp(inb *miso.Inbound, req GetTokenUserReq) (UserInfoBrief, error)

type UserInfoRes added in v0.0.17

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

func UserGetUserInfoEp added in v0.0.17

func UserGetUserInfoEp(inb *miso.Inbound) (UserInfoRes, error)

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      string     `json:"ptype" desc:"path type: 'PROTECTED' - authorization required, 'PUBLIC' - publicly accessible"`
	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