Documentation ¶
Index ¶
- Constants
- func AddResToRoleIfNotExist(rail miso.Rail, req AddRoleResReq, user common.User) error
- func AddRole(ec miso.Rail, req AddRoleReq, user common.User) error
- func AddUser(rail miso.Rail, tx *gorm.DB, req AddUserParam, operator string) error
- func AdminAddResourceEp(c *gin.Context, rail miso.Rail, req CreateResReq) (any, error)
- func AdminAddRoleEp(c *gin.Context, rail miso.Rail, req AddRoleReq) (any, error)
- func AdminAddUserEp(c *gin.Context, rail miso.Rail, req AddUserParam) (any, error)
- func AdminBindResPathEp(c *gin.Context, rail miso.Rail, req BindPathResReq) (any, error)
- func AdminBindRoleResEp(c *gin.Context, rail miso.Rail, req AddRoleResReq) (any, error)
- func AdminDeletePathEp(c *gin.Context, rail miso.Rail, req DeletePathReq) (any, error)
- func AdminListPathsEp(c *gin.Context, rail miso.Rail, req ListPathReq) (miso.GnResp[ListPathResp], error)
- func AdminListResEp(c *gin.Context, rail miso.Rail, req ListResReq) (miso.GnResp[ListResResp], error)
- func AdminListRoleBriefsEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]RoleBrief], error)
- func AdminListRoleResEp(c *gin.Context, rail miso.Rail, req ListRoleResReq) (miso.GnResp[ListRoleResResp], error)
- func AdminListRolesEp(c *gin.Context, rail miso.Rail, req ListRoleReq) (miso.GnResp[ListRoleResp], error)
- func AdminListUsersEp(c *gin.Context, rail miso.Rail, req ListUserReq) (miso.GnResp[miso.PageRes[api.UserInfo]], error)
- func AdminRemoveResourceEp(c *gin.Context, rail miso.Rail, req DeleteResourceReq) (any, error)
- func AdminReviewUserEp(c *gin.Context, rail miso.Rail, req AdminReviewUserReq) (any, error)
- func AdminUnbindResPathEp(c *gin.Context, rail miso.Rail, req UnbindPathResReq) (any, error)
- func AdminUnbindRoleResEp(c *gin.Context, rail miso.Rail, req RemoveRoleResReq) (any, error)
- func AdminUpdatePathEp(c *gin.Context, rail miso.Rail, req UpdatePathReq) (any, error)
- func AdminUpdateUser(rail miso.Rail, tx *gorm.DB, req AdminUpdateUserReq, operator common.User) error
- func AdminUpdateUserEp(c *gin.Context, rail miso.Rail, req AdminUpdateUserReq) (any, error)
- func BindPathRes(rail miso.Rail, req BindPathResReq) error
- func BootstrapServer(args []string)
- func CreateMonitoredServiceWatch(rail miso.Rail, m MonitoredService) error
- func CreateMonitoredServiceWatches(rail miso.Rail) error
- func CreatePathIfNotExist(rail miso.Rail, req CreatePathReq, user common.User) error
- func CreateResourceIfNotExist(rail miso.Rail, req CreateResReq, user common.User) error
- func DecodeTokenUsername(rail miso.Rail, token string) (string, error)
- func DeletePath(ec miso.Rail, req DeletePathReq) error
- func DeleteResource(ec miso.Rail, req DeleteResourceReq) error
- func DeleteUserKey(rail miso.Rail, tx *gorm.DB, req DeleteUserKeyReq, userId int) error
- func ExchangeToken(rail miso.Rail, tx *gorm.DB, req ExchangeTokenReq) (string, error)
- func ExchangeTokenEp(c *gin.Context, rail miso.Rail, req ExchangeTokenReq) (miso.GnResp[string], error)
- func GenUserKey(rail miso.Rail, tx *gorm.DB, req GenUserKeyReq, username string) error
- func GetRoleInfo(ec miso.Rail, req api.RoleInfoReq) (api.RoleInfoResp, error)
- func GetRoleInfoEp(c *gin.Context, rail miso.Rail, req api.RoleInfoReq) (miso.GnResp[api.RoleInfoResp], error)
- func GetTokenUserInfoEp(c *gin.Context, rail miso.Rail, req GetTokenUserReq) (miso.GnResp[UserInfoBrief], error)
- func InvalidateUserInfoCache(rail miso.Rail, username string) error
- func ItnCheckResourceAccessEp(c *gin.Context, rail miso.Rail, req TestResAccessReq) (miso.GnResp[TestResAccessResp], error)
- func ItnFetchUserIdByNameEp(c *gin.Context, rail miso.Rail, req FetchUserIdByNameReq) (miso.GnResp[int], error)
- func ItnFetchUserInfoEp(c *gin.Context, rail miso.Rail, req api.FindUserReq) (miso.GnResp[api.UserInfo], error)
- func ItnFetchUsernamesByNosEp(c *gin.Context, rail miso.Rail, req api.FetchNameByUserNoReq) (miso.GnResp[api.FetchUsernamesRes], error)
- func ItnFindNameOfUserNo(rail miso.Rail, tx *gorm.DB, req api.FetchNameByUserNoReq) (api.FetchUsernamesRes, error)
- func ItnFindUserInfo(rail miso.Rail, tx *gorm.DB, req api.FindUserReq) (api.UserInfo, error)
- func ItnFindUserWithRoleEp(c *gin.Context, rail miso.Rail, req api.FetchUsersWithRoleReq) (miso.GnResp[[]api.UserInfo], error)
- func ItnFindUsersWithRole(rail miso.Rail, db *gorm.DB, req api.FetchUsersWithRoleReq) ([]api.UserInfo, error)
- func ItnReportPathEp(c *gin.Context, rail miso.Rail, req CreatePathReq) (any, error)
- func ItnReportResourceEp(c *gin.Context, rail miso.Rail, req CreateResReq) (any, error)
- func ListAccessLogs(rail miso.Rail, tx *gorm.DB, user common.User, req ListAccessLogReq) (miso.PageRes[ListedAccessLog], error)
- func ListAllResBriefEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]ResBrief], error)
- func ListResCandidatesEp(c *gin.Context, rail miso.Rail, req ListResCandidatesReq) (miso.GnResp[[]ResBrief], error)
- func ListUserAccessibleResEp(c *gin.Context, rail miso.Rail) (miso.GnResp[[]ResBrief], error)
- func ListUserKeys(rail miso.Rail, tx *gorm.DB, req ListUserKeysReq, user common.User) (miso.PageRes[ListedUserKey], error)
- func ListUsers(rail miso.Rail, tx *gorm.DB, req ListUserReq) (miso.PageRes[api.UserInfo], error)
- func LoadPathResCache(rail miso.Rail) error
- func LoadResCodeCache(rail miso.Rail) error
- func LoadRoleResCache(ec miso.Rail) error
- func QueryResourcePathAsync(rail miso.Rail, server miso.Server, m MonitoredService)
- func RegisterInternalPathResourcesOnBootstrapped()
- func RegisterRoutes(rail miso.Rail) error
- func RemoteAddr(forwardedFor string) string
- func RemoveResFromRole(ec miso.Rail, req RemoveRoleResReq) error
- func ReviewUserRegistration(rail miso.Rail, tx *gorm.DB, req AdminReviewUserReq) error
- func SaveAccessLogEvent(rail miso.Rail, tx *gorm.DB, evt AccessLogEvent) error
- func ScheduleTasks(rail miso.Rail) error
- func SubEventBus(rail miso.Rail) error
- func TriggerResourcePathCollection(rail miso.Rail, m MonitoredService)
- func UnbindPathRes(ec miso.Rail, req UnbindPathResReq) error
- func UpdatePassword(rail miso.Rail, tx *gorm.DB, username string, req UpdatePasswordReq) error
- func UpdatePath(ec miso.Rail, req UpdatePathReq) error
- func UserDeleteUserKeyEp(c *gin.Context, rail miso.Rail, req DeleteUserKeyReq) (any, error)
- func UserGenUserKeyEp(c *gin.Context, rail miso.Rail, req GenUserKeyReq) (any, error)
- func UserGetUserInfoEp(c *gin.Context, rail miso.Rail) (miso.GnResp[UserInfoRes], error)
- func UserListAccessHistoryEp(c *gin.Context, rail miso.Rail, req ListAccessLogReq) (miso.GnResp[miso.PageRes[ListedAccessLog]], error)
- func UserListUserKeysEp(c *gin.Context, rail miso.Rail, req ListUserKeysReq) (miso.GnResp[miso.PageRes[ListedUserKey]], error)
- func UserLoginEp(gin *gin.Context, rail miso.Rail, req LoginReq) (miso.GnResp[string], error)
- func UserRegister(rail miso.Rail, tx *gorm.DB, req RegisterReq) error
- func UserRegisterEp(c *gin.Context, rail miso.Rail, req RegisterReq) (any, error)
- func UserUpdatePasswordEp(c *gin.Context, rail miso.Rail, req UpdatePasswordReq) (any, error)
- type AccessLog
- type AccessLogEvent
- type AddRoleReq
- type AddRoleResReq
- type AddUserParam
- type AdminAddUserReq
- type AdminReviewUserReq
- type AdminUpdateUserReq
- type BindPathResReq
- type CachedUrlRes
- type CreatePathReq
- type CreateResReq
- type DeletePathReq
- type DeleteResourceReq
- type DeleteUserKeyReq
- type EPath
- type ERes
- type ERole
- type ERoleRes
- type ExchangeTokenReq
- type ExtendedPathRes
- type FetchUserIdByNameReq
- type GenResScriptReq
- type GenUserKeyReq
- type GetTokenUserReq
- type ListAccessLogReq
- type ListPathReq
- type ListPathResp
- type ListResCandidatesReq
- type ListResReq
- type ListResResp
- type ListRoleReq
- type ListRoleResReq
- type ListRoleResResp
- type ListRoleResp
- type ListUserKeysReq
- type ListUserReq
- type ListedAccessLog
- type ListedRoleRes
- type ListedUserKey
- type LoginReq
- type MonitorConf
- type MonitoredService
- type NewUserKey
- type PasswordLoginParam
- type PathRes
- type PathType
- type QueryResourcePathRes
- type RegisterReq
- type RemoveRoleResReq
- type ResBrief
- type RoleBrief
- type TestResAccessReq
- type TestResAccessResp
- type TokenUser
- type UnbindPathResReq
- type UpdatePasswordReq
- type UpdatePathReq
- type User
- type UserDetail
- type UserInfoBrief
- type UserInfoRes
- type WPath
- type WRes
- type WRole
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 AdminAddResourceEp ¶ added in v0.0.17
func AdminAddRoleEp ¶ added in v0.0.17
func AdminAddUserEp ¶ added in v0.0.17
func AdminBindResPathEp ¶ added in v0.0.17
func AdminBindRoleResEp ¶ added in v0.0.17
func AdminDeletePathEp ¶ added in v0.0.17
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 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 AdminRemoveResourceEp ¶ added in v0.0.17
func AdminReviewUserEp ¶ added in v0.0.17
func AdminUnbindResPathEp ¶ added in v0.0.17
func AdminUnbindRoleResEp ¶ added in v0.0.17
func AdminUpdatePathEp ¶ added in v0.0.17
func AdminUpdateUser ¶
func AdminUpdateUserEp ¶ added in v0.0.17
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 CreatePathIfNotExist ¶ added in v0.0.16
func CreateResourceIfNotExist ¶ added in v0.0.16
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 ExchangeToken ¶
func ExchangeTokenEp ¶
func GenUserKey ¶
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 GetTokenUserInfoEp ¶ added in v0.0.17
func GetTokenUserInfoEp(c *gin.Context, rail miso.Rail, req GetTokenUserReq) (miso.GnResp[UserInfoBrief], 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 ItnFetchUserInfoEp ¶ added in v0.0.15
func ItnFetchUsernamesByNosEp ¶ added in v0.0.17
func ItnFindNameOfUserNo ¶
func ItnFindNameOfUserNo(rail miso.Rail, tx *gorm.DB, req api.FetchNameByUserNoReq) (api.FetchUsernamesRes, error)
func ItnFindUserInfo ¶
func ItnFindUserWithRoleEp ¶ added in v0.0.17
func ItnFindUsersWithRole ¶ added in v0.0.15
func ItnReportPathEp ¶ added in v0.0.17
func ItnReportResourceEp ¶ added in v0.0.17
func ListAccessLogs ¶
func ListAllResBriefEp ¶ added in v0.0.17
func ListResCandidatesEp ¶ added in v0.0.17
func ListUserAccessibleResEp ¶ added in v0.0.17
func ListUserKeys ¶
func LoadPathResCache ¶ added in v0.0.16
Load cache for path -> resource
func LoadResCodeCache ¶ added in v0.0.16
Load cache for resource code
func LoadRoleResCache ¶ added in v0.0.16
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 RemoteAddr ¶
func RemoveResFromRole ¶ added in v0.0.16
func RemoveResFromRole(ec miso.Rail, req RemoveRoleResReq) error
func ReviewUserRegistration ¶
func SaveAccessLogEvent ¶
func ScheduleTasks ¶ added in v0.0.16
func SubEventBus ¶ added in v0.0.16
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 UpdatePath ¶ added in v0.0.16
func UpdatePath(ec miso.Rail, req UpdatePathReq) error
func UserDeleteUserKeyEp ¶ added in v0.0.17
func UserGenUserKeyEp ¶ added in v0.0.17
func UserGetUserInfoEp ¶ added in v0.0.17
func UserListAccessHistoryEp ¶ added in v0.0.17
func UserListUserKeysEp ¶ added in v0.0.17
func UserLoginEp ¶
func UserRegister ¶
func UserRegisterEp ¶ added in v0.0.17
func UserUpdatePasswordEp ¶ added in v0.0.17
Types ¶
type AccessLogEvent ¶
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 AddUserParam ¶
type AdminAddUserReq ¶
type AdminReviewUserReq ¶
type AdminUpdateUserReq ¶
type BindPathResReq ¶ added in v0.0.16
type CachedUrlRes ¶ added in v0.0.16
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 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 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 GetTokenUserReq ¶ added in v0.0.17
type GetTokenUserReq struct {
Token string `form:"token" desc:"jwt token"`
}
type ListAccessLogReq ¶
type ListPathReq ¶ added in v0.0.16
type ListPathResp ¶ added in v0.0.16
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 ListResResp ¶ added in v0.0.16
func ListResources ¶ added in v0.0.16
func ListResources(ec miso.Rail, req ListResReq) (ListResResp, error)
type ListRoleReq ¶ added in v0.0.16
type ListRoleResReq ¶ added in v0.0.16
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
func ListRoles ¶ added in v0.0.16
func ListRoles(ec miso.Rail, req ListRoleReq) (ListRoleResp, error)
type ListUserKeysReq ¶
type ListUserReq ¶
type ListedAccessLog ¶
type ListedRoleRes ¶ added in v0.0.16
type ListedUserKey ¶
type MonitorConf ¶ added in v0.0.16
type MonitorConf struct {
Monitor []MonitoredService
}
type MonitoredService ¶ added in v0.0.16
func LoadMonitoredServices ¶ added in v0.0.16
func LoadMonitoredServices() []MonitoredService
type NewUserKey ¶
type PasswordLoginParam ¶
type QueryResourcePathRes ¶ added in v0.0.16
type QueryResourcePathRes struct { Resources []CreateResReq Paths []CreatePathReq }
func QueryResourcePath ¶ added in v0.0.16
type RegisterReq ¶
type RemoveRoleResReq ¶ added in v0.0.16
type ResBrief ¶ added in v0.0.16
func ListAllResBriefsOfRole ¶ added in v0.0.16
type TestResAccessReq ¶ added in v0.0.16
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 UnbindPathResReq ¶ added in v0.0.16
type UpdatePasswordReq ¶
type UpdatePathReq ¶ added in v0.0.16
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 }
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 LoadUserInfoBrief ¶
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 GetTokenUser ¶
type UserInfoRes ¶ added in v0.0.17
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"` }
Click to show internal directories.
Click to hide internal directories.