Documentation
¶
Index ¶
- Constants
- Variables
- func AccountChargeCycleTimeClose(cycle, ctc uint32) uint32
- func AccountChargeCycleTimeCloseNow(cycle uint32) uint32
- func AccountChargeId(prod types.NameIdentifier, start uint32) ([]byte, string)
- func AccountChargeTimeNow() uint32
- func AccountCurrencyTypeValid(v uint8) bool
- func AccountFloat64Round(f float64, pa_num int64) float64
- func ArrayStringDel(ls *[]string, a string) bool
- func ArrayStringEqual(lsa, lsb []string) bool
- func ArrayStringHas(ls []string, a string) bool
- func ArrayStringSet(ls *[]string, a string) bool
- func BytesToHexString(bs []byte) string
- func DataUserAuth(uname string, created uint32) []byte
- func DataUserAuthDeny(uname, remote_ip string) []byte
- func Hash32(v string) uint32
- func HexStringToBytes(s string) []byte
- func NsAccessKey(uname, id string) []byte
- func ObjKeyAccChargeMgr(id string) []byte
- func ObjKeyAccChargeUser(uname, id string) []byte
- func ObjKeyAccFundMgr(id string) []byte
- func ObjKeyAccFundUser(uname, id string) []byte
- func ObjKeyAccUser(uname string) []byte
- func ObjKeyAppInstance(key string) []byte
- func ObjKeyMsgQueue(id string) []byte
- func ObjKeyMsgSent(id string) []byte
- func ObjKeyPasswordReset(id string) []byte
- func ObjKeyRole(name string) []byte
- func ObjKeyRolePrivilege(rid uint32, appid string) []byte
- func ObjKeySysConfig(name string) []byte
- func ObjKeyUser(uname string) []byte
- func ObjKeyUserAuth(uname string, created uint32) []byte
- func ObjKeyUserAuthDeny(uname, remote_ip string) []byte
- func ObjKeyUserProfile(uname string) []byte
- func OpActionAllow(opbase, op uint32) bool
- func OpActionAppend(opbase, op uint32) uint32
- func OpActionRemove(opbase, op uint32) uint32
- func PrevDataMsgQueue(id string) []byte
- func PrevDataMsgSent(id string) []byte
- func ServiceRedirectTokenValid(tokenstr string) bool
- func Uint32ToBytes(v uint32) []byte
- func Uint32ToHexString(v uint32) string
- func Uint64ToBytes(v uint64) []byte
- func Uint64ToHexString(v uint64) string
- func UserId(name string) string
- func UserIdBytes(name string) []byte
- func UserNameFilter(name string) string
- func UserNameValid(user string) error
- type AccessKeyAuth
- type AccessKeySession
- type AccountCharge
- type AccountChargePayout
- type AccountChargePrepay
- type AccountCurrencyOption
- type AccountFund
- type AccountUser
- type AppAuthInfo
- type AppInstance
- type AppInstanceList
- type AppInstanceRegister
- type AppPrivilege
- type ServiceLoginAuth
- type ServiceRedirectToken
- type SysConfigList
- type SysConfigMailer
- type User
- type UserAccessEntry
- type UserEmailSet
- type UserEntry
- type UserGroupItem
- type UserGroupList
- type UserList
- type UserPasswordReset
- type UserPasswordSet
- type UserPhotoSet
- type UserPrivilege
- type UserPrivilegeList
- type UserProfile
- type UserRole
- type UserRoleList
- type UserSession
- type WebServiceKind
Constants ¶
View Source
const ( AccountCurrencyTypeCash uint8 = 1 AccountCurrencyTypeVirtual uint8 = 32 AccountCurrencyTypeCard uint8 = 33 )
View Source
const ( PayTypeLease uint8 = 1 PayTypeOrder uint8 = 2 )
View Source
const ( AccountChargeTypePrepay uint8 = 1 AccountChargeTypePayout uint8 = 2 AccountChargeCycleHour uint32 = 3600 AccountChargeCycleDay uint32 = 86400 AccountChargeCycleMonth uint32 = 2592000 )
View Source
const ( AccessTokenKey = "_iam_at" UserKeyDefault = "std" ErrCodeAccessDenied = "AccessDenied" ErrCodeInvalidArgument = "InvalidArgument" ErrCodeServerError = "ServerError" ErrCodeInternalError = "InternalError" ErrCodeNotFound = "NotFound" ErrCodeAccChargeOut = "AccChargeOut" )
View Source
const (
UserTypeGroup uint32 = 1 << 1
)
Variables ¶
View Source
var ( UsernameRE = regexp.MustCompile("^[a-z]{1}[a-z0-9-]{2,18}[a-z0-9]{1}$") EmailRE = regexp.MustCompile("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,10})$") AppIdRE = regexp.MustCompile("^[a-f0-9]{16,24}$") )
View Source
var (
AccGenIdReg = regexp.MustCompile("^[0-9a-f]{16,24}$")
)
Functions ¶
func AccountChargeId ¶
func AccountChargeId(prod types.NameIdentifier, start uint32) ([]byte, string)
func AccountChargeTimeNow ¶
func AccountChargeTimeNow() uint32
func AccountFloat64Round ¶
func ArrayStringDel ¶
func ArrayStringEqual ¶
func ArrayStringHas ¶
func ArrayStringSet ¶
func BytesToHexString ¶
func DataUserAuth ¶
func DataUserAuthDeny ¶
func HexStringToBytes ¶
func NsAccessKey ¶
func ObjKeyAccChargeMgr ¶
func ObjKeyAccChargeUser ¶
func ObjKeyAccFundMgr ¶
func ObjKeyAccFundUser ¶
func ObjKeyAccUser ¶
func ObjKeyAppInstance ¶
func ObjKeyMsgQueue ¶
func ObjKeyMsgSent ¶
func ObjKeyPasswordReset ¶
func ObjKeyRole ¶
func ObjKeyRolePrivilege ¶
func ObjKeySysConfig ¶
func ObjKeyUser ¶
func ObjKeyUserAuth ¶
func ObjKeyUserAuthDeny ¶
func ObjKeyUserProfile ¶
func OpActionAllow ¶
func OpActionAppend ¶
func OpActionRemove ¶
func PrevDataMsgQueue ¶
func PrevDataMsgSent ¶
func Uint32ToBytes ¶
func Uint32ToHexString ¶
func Uint64ToBytes ¶
func Uint64ToHexString ¶
func UserIdBytes ¶
func UserNameFilter ¶
func UserNameValid ¶
Types ¶
type AccessKeyAuth ¶
type AccessKeyAuth struct {
Type string `json:"t" toml:"t"`
User string `json:"u" toml:"u"`
Key string `json:"k" toml:"k"`
Time int64 `json:"rt" toml:"rt"`
Token string `json:"tk" toml:"tk"`
}
func AccessKeyAuthDecode ¶
func AccessKeyAuthDecode(auth string) (AccessKeyAuth, error)
func (AccessKeyAuth) Encode ¶
func (t AccessKeyAuth) Encode() string
func (AccessKeyAuth) Valid ¶
func (t AccessKeyAuth) Valid() error
type AccessKeySession ¶
type AccessKeySession struct {
AccessKey string `json:"ak" toml:"ak"`
SecretKey string `json:"sk" toml:"sk"`
User string `json:"ur" toml:"ur"`
Roles types.ArrayUint32 `json:"rs" toml:"rs"`
Expired int64 `json:"ex" toml:"ex"` // unix seconds
}
Access Key SESSION K1(2)VERIFY-SIGNATURE(36)PAYLOAD-DATA
type AccountCharge ¶
type AccountCharge struct {
types.TypeMeta `json:",inline" toml:",inline"`
Id string `json:"id" toml:"id"`
Fund string `json:"fund" toml:"fund"`
User string `json:"user" toml:"user"`
Product types.NameIdentifier `json:"product" toml:"product"`
Prepay float64 `json:"prepay" toml:"prepay"`
Payout float64 `json:"payout" toml:"payout"`
TimeStart uint32 `json:"time_start" toml:"time_start"`
TimeClose uint32 `json:"time_close" toml:"time_close"`
Created types.MetaTime `json:"created" toml:"created"`
Updated types.MetaTime `json:"updated" toml:"updated"`
Comment string `json:"comment,omitempty" toml:"comment,omitempty"`
}
iam/acc_charge/user-id/hash-id iam/acc_charge_mgr/hash-id
type AccountChargePayout ¶
type AccountChargePayout struct {
types.TypeMeta `json:",inline" toml:",inline"`
Id string `json:"id" toml:"id"`
User string `json:"user" toml:"user"`
Product types.NameIdentifier `json:"product" toml:"product"`
Payout float64 `json:"payout" toml:"payout"`
TimeStart uint32 `json:"time_start" toml:"time_start"`
TimeClose uint32 `json:"time_close" toml:"time_close"`
Comment string `json:"comment,omitempty" toml:"comment,omitempty"`
}
func (*AccountChargePayout) Valid ¶
func (this *AccountChargePayout) Valid() error
type AccountChargePrepay ¶
type AccountChargePrepay struct {
types.TypeMeta `json:",inline" toml:",inline"`
User string `json:"user" toml:"user"`
Product types.NameIdentifier `json:"product" toml:"product"`
Prepay float64 `json:"prepay" toml:"prepay"`
TimeStart uint32 `json:"time_start" toml:"time_start"`
TimeClose uint32 `json:"time_close" toml:"time_close"`
Comment string `json:"comment,omitempty" toml:"comment,omitempty"`
}
func (*AccountChargePrepay) Valid ¶
func (this *AccountChargePrepay) Valid() error
type AccountCurrencyOption ¶
type AccountFund ¶
type AccountFund struct {
Id string `json:"id" toml:"id"`
Type uint8 `json:"type" toml:"type"`
User string `json:"user" toml:"user"`
Operator string `json:"operator,omitempty" toml:"operator,omitempty"`
CashType uint16 `json:"cash_type,omitempty" toml:"cash_type,omitempty"`
CashAmount float32 `json:"cash_amount,omitempty" toml:"cash_amount,omitempty"`
Amount float64 `json:"amount" toml:"amount"`
Prepay float64 `json:"prepay" toml:"prepay"`
Payout float64 `json:"payout" toml:"payout"`
Priority uint8 `json:"priority" toml:"priority"`
Options types.Labels `json:"options,omitempty" toml:"options,omitempty"`
Created types.MetaTime `json:"created" toml:"created"`
Updated types.MetaTime `json:"updated" toml:"updated"`
Comment string `json:"comment,omitempty" toml:"comment,omitempty"`
ExpProductLimits types.ArrayNameIdentifier `json:"exp_product_limits,omitempty" toml:"exp_product_limits,omitempty"`
ExpProductMax int `json:"exp_product_max,omitempty" toml:"exp_product_max,omitempty"`
ExpProductInpay types.ArrayNameIdentifier `json:"exp_product_inpay,omitempty" toml:"exp_product_inpay,omitempty"`
}
iam/acc_fund/user-id/rand-id iam/acc_fund_mgr/rand-id
type AccountUser ¶
type AccountUser struct {
User string `json:"user" toml:"user"`
Balance float64 `json:"balance" toml:"balance"`
Prepay float64 `json:"prepay" toml:"prepay"`
Updated types.MetaTime `json:"updated" toml:"updated"`
}
iam/acc_user/user-id
type AppAuthInfo ¶
type AppInstance ¶
type AppInstance struct {
Meta types.InnerObjectMeta `json:"meta,omitempty" toml:"meta,omitempty"`
AppID string `json:"app_id,omitempty" toml:"app_id,omitempty"`
AppTitle string `json:"app_title,omitempty" toml:"app_title,omitempty"`
Version string `json:"version,omitempty" toml:"version,omitempty"`
Status uint8 `json:"status,omitempty" toml:"status,omitempty"`
Url string `json:"url,omitempty" toml:"url,omitempty"`
Privileges []AppPrivilege `json:"privileges,omitempty" toml:"privileges,omitempty"`
SecretKey string `json:"secret_key,omitempty" toml:"secret_key,omitempty"`
}
type AppInstanceList ¶
type AppInstanceList struct {
types.TypeMeta `json:",inline" toml:",inline"`
Meta types.ListMeta `json:"meta,omitempty" toml:"meta,omitempty"`
Items []AppInstance `json:"items,omitempty" toml:"items,omitempty"`
}
type AppInstanceRegister ¶
type AppInstanceRegister struct {
types.TypeMeta `json:",inline" toml:",inline"`
AccessToken string `json:"access_token,omitempty" toml:"access_token,omitempty"`
Instance AppInstance `json:"instance" toml:"instance"`
}
type AppPrivilege ¶
type AppPrivilege struct {
// ID uint32 `json:"id,omitempty" toml:"id,omitempty"`
Privilege string `json:"privilege" toml:"privilege"`
Desc string `json:"desc,omitempty" toml:"desc,omitempty"`
Roles types.ArrayUint32 `json:"roles,omitempty" toml:"roles,omitempty"`
}
type ServiceLoginAuth ¶
type ServiceRedirectToken ¶
type ServiceRedirectToken struct {
RedirectUri string `json:"uri,omitempty" toml:"uri,omitempty"`
State string `json:"state,omitempty" toml:"state,omitempty"`
ClientId string `json:"cid,omitempty" toml:"cid,omitempty"`
Persistent int `json:"pt,omitempty" toml:"pt,omitempty"`
}
func ServiceRedirectTokenDecode ¶
func ServiceRedirectTokenDecode(tokenstr string) ServiceRedirectToken
func (*ServiceRedirectToken) Encode ¶
func (s *ServiceRedirectToken) Encode() string
type SysConfigList ¶
type SysConfigMailer ¶
type User ¶
type User struct {
// Id string `json:"id,omitempty" toml:"id,omitempty"`
Name string `json:"name" toml:"name"`
Email string `json:"email,omitempty" toml:"email,omitempty"`
DisplayName string `json:"display_name,omitempty" toml:"display_name,omitempty"`
Keys types.KvPairs `json:"keys,omitempty" toml:"keys,omitempty"`
Roles types.ArrayUint32 `json:"roles,omitempty" toml:"roles,omitempty"`
Type uint32 `json:"type,omitempty" toml:"type,omitempty"`
Owners []string `json:"owners,omitempty" toml:"owners,omitempty"`
Members []string `json:"members,omitempty" toml:"members,omitempty"`
Status uint8 `json:"status,omitempty" toml:"status,omitempty"`
Created types.MetaTime `json:"created,omitempty" toml:"created,omitempty"`
Updated types.MetaTime `json:"updated,omitempty" toml:"updated,omitempty"`
}
type UserAccessEntry ¶
type UserEmailSet ¶
type UserEntry ¶
type UserEntry struct {
types.TypeMeta `json:",inline" toml:",inline"`
Login User `json:"login,omitempty" toml:"login,omitempty"`
Profile *UserProfile `json:"profile,omitempty" toml:"profile,omitempty"`
}
type UserGroupItem ¶
type UserGroupItem struct {
types.TypeMeta `json:",inline" toml:",inline"`
Name string `json:"name" toml:"name"`
DisplayName string `json:"display_name,omitempty" toml:"display_name,omitempty"`
Owners []string `json:"owners,omitempty" toml:"owners,omitempty"`
Members []string `json:"members,omitempty" toml:"members,omitempty"`
Status uint8 `json:"status" toml:"status"`
Created types.MetaTime `json:"created" toml:"created"`
Updated types.MetaTime `json:"updated" toml:"updated"`
}
type UserGroupList ¶
type UserGroupList struct {
types.TypeMeta `json:",inline" toml:",inline"`
Items []*UserGroupItem `json:"items,omitempty" toml:"items,omitempty"`
}
type UserPasswordReset ¶
type UserPasswordReset struct {
types.TypeMeta `json:",inline" toml:",inline"`
Id string `json:"id,omitempty" toml:"id,omitempty"`
UserName string `json:"username,omitempty" toml:"username,omitempty"`
Email string `json:"email,omitempty" toml:"email,omitempty"`
Expired string `json:"expired,omitempty" toml:"expired,omitempty"`
}
type UserPasswordSet ¶
type UserPhotoSet ¶
type UserPrivilege ¶
type UserPrivilegeList ¶
type UserPrivilegeList struct {
types.TypeMeta `json:",inline" toml:",inline"`
Items []UserPrivilege `json:"items,omitempty" toml:"items,omitempty"`
}
type UserProfile ¶
type UserProfile struct {
Login *User `json:"login,omitempty" toml:"login,omitempty"`
Gender uint8 `json:"gender,omitempty" toml:"gender,omitempty"`
Photo string `json:"photo,omitempty" toml:"photo,omitempty"`
PhotoSource string `json:"photo_source,omitempty" toml:"photo_source,omitempty"`
Birthday string `json:"birthday,omitempty" toml:"birthday,omitempty"`
About string `json:"about,omitempty" toml:"about,omitempty"`
Updated types.MetaTime `json:"updated,omitempty" toml:"updated,omitempty"`
}
type UserRole ¶
type UserRole struct {
Id uint32 `json:"id" toml:"id"`
Name string `json:"name" toml:"name"`
User string `json:"user,omitempty" toml:"user,omitempty"`
Status uint8 `json:"status,omitempty" toml:"status,omitempty"`
Desc string `json:"desc,omitempty" toml:"desc,omitempty"`
Privileges []string `json:"privileges,omitempty" toml:"privileges,omitempty"`
Created types.MetaTime `json:"created,omitempty" toml:"created,omitempty"`
Updated types.MetaTime `json:"updated,omitempty" toml:"updated,omitempty"`
}
type UserRoleList ¶
type UserSession ¶
type UserSession struct {
AccessToken string `json:"access_token" toml:"access_token"`
RefreshToken string `json:"refresh_token,omitempty" toml:"refresh_token,omitempty"`
UserName string `json:"username" toml:"username"`
DisplayName string `json:"display_name,omitempty" toml:"display_name,omitempty"`
Roles types.ArrayUint32 `json:"roles,omitempty" toml:"roles,omitempty"`
Groups []string `json:"groups,omitempty" toml:"groups,omitempty"`
ClientAddr string `json:"client_addr,omitempty" toml:"client_addr,omitempty"`
Created int64 `json:"created" toml:"created"`
Expired int64 `json:"expired" toml:"expired"`
Cached int64 `json:"cached,omitempty" toml:"cached,omitempty"`
}
func (*UserSession) AccessAllow ¶
func (s *UserSession) AccessAllow(name string) bool
func (*UserSession) IsLogin ¶
func (s *UserSession) IsLogin() bool
func (*UserSession) UserId ¶
func (s *UserSession) UserId() string
Click to show internal directories.
Click to hide internal directories.