Documentation ¶
Index ¶
- Constants
- Variables
- func APIToPB(in *API) *apipb.APIInfo
- func APIsToPB(in []API) []*apipb.APIInfo
- func AddMenu(menu *Menu) error
- func Authenticate(t, method, url string, checkAuth bool) (*apipb.CurrentUser, int, error)
- func AutoMigrate() error
- func BindPhone(userID string, phoneNuber string) error
- func CheckRegisterWithWechat(openID string) (string, error)
- func ClearCasbin(v int, p ...string) (bool, error)
- func ConditionsToGormQuery(db *gorm.DB, conditions []string, combineType CombineType) *gorm.DB
- func CopyTenant(id string) error
- func CreateAPI(api *API) error
- func CreateAPP(md *APP) error
- func CreateDictionaries(m *Dictionaries) (string, error)
- func CreateFormComponent(m *FormComponent) (string, error)
- func CreateLanguage(m *Language) (string, error)
- func CreateProject(m *Project) (string, error)
- func CreateRole(newRole *Role) error
- func CreateSystemConfig(m *SystemConfig) (string, error)
- func CreateTenant(m *Tenant) error
- func CreateUser(user *User, isCreateFromWechat bool) error
- func CreateWebSite(m *WebSite) (string, error)
- func CreateWechatConfig(m *WechatConfig) (string, error)
- func DeleteAPP(id string) (err error)
- func DeleteApi(id string) (err error)
- func DeleteDictionaries(id string) (err error)
- func DeleteFormComponent(id string) (err error)
- func DeleteLanguage(id string) (err error)
- func DeleteMenu(id string) (err error)
- func DeleteProject(id string) (err error)
- func DeleteRole(roleID string) (err error)
- func DeleteSystemConfig(id string) (err error)
- func DeleteTenant(id string) (err error)
- func DeleteUser(id string) (err error)
- func DeleteWebSite(id string) (err error)
- func DeleteWechatConfig(id string) (err error)
- func DictionariesArrayToPB(in []*Dictionaries) []*apipb.DictionariesInfo
- func DictionariesToPB(in *Dictionaries) *apipb.DictionariesInfo
- func EnableAPI(id string, enable bool) error
- func EnableTenant(id string, enable bool) error
- func EnableUser(id string, enable bool) error
- func EncryptedPassword(password string) (string, error)
- func ExportAllAPPs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllApis(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllDictionaries(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllLanguages(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllMenus(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllProjects(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllRoles(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllSystemConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllTenants(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllUsers(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllWebSites(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func ExportAllWechatConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
- func FormComponentResourceToPB(in *FormComponentResource) *apipb.FormComponentResource
- func FormComponentToPB(in *FormComponent) *apipb.FormComponentInfo
- func FormComponentsToPB(in []*FormComponent) []*apipb.FormComponentInfo
- func GetOpenIDByUserIDAndConfigID(userID, wechatConfigID string) (string, error)
- func GetUserProfile(id string, needMenu bool) (*apipb.UserProfile, error)
- func Init(connStr string, debug bool)
- func InitCasbin()
- func InitDB(client db.DBClientInterface, debug bool)
- func InitSqlite(database string, debug bool)
- func LanguageToPB(in *Language) *apipb.LanguageInfo
- func LanguagesToPB(in []*Language) []*apipb.LanguageInfo
- func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse)
- func LoginByStaffNo(req *apipb.LoginByStaffNoRequest, resp *apipb.LoginByStaffNoResponse)
- func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse)
- func Logout(t string) error
- func LogoutByUserName(req *apipb.LogoutByUserNameRequest, resp *apipb.CommonResponse)
- func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi
- func MenuFuncsToPB(params []*MenuFunc) []*apipb.MenuFunc
- func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter
- func MenuToPB(in *Menu) *apipb.MenuInfo
- func MenusToPB(in []*Menu) []*apipb.MenuInfo
- func NewEnforcer() *casbin.Enforcer
- func ParamsMatch(fullNameKey1 string, key2 string) bool
- func ParamsMatchFunc(args ...interface{}) (interface{}, error)
- func ProjectFormComponentToPB(in *ProjectFormComponent) *apipb.ProjectFormComponent
- func ProjectFormComponentsToPB(in []*ProjectFormComponent) []*apipb.ProjectFormComponent
- func ProjectToPB(in *Project) *apipb.ProjectInfo
- func ProjectsToPB(in []*Project) []*apipb.ProjectInfo
- func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse)
- func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse)
- func QueryDictionaries(req *apipb.QueryDictionariesRequest, resp *apipb.QueryDictionariesResponse, ...)
- func QueryFormComponent(req *apipb.QueryFormComponentRequest, resp *apipb.QueryFormComponentResponse, ...)
- func QueryLanguage(req *apipb.QueryLanguageRequest, resp *apipb.QueryLanguageResponse, ...)
- func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse, preload bool)
- func QueryProject(req *apipb.QueryProjectRequest, resp *apipb.QueryProjectResponse, preload bool)
- func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse, preload bool)
- func QuerySystemConfig(req *apipb.QuerySystemConfigRequest, resp *apipb.QuerySystemConfigResponse, ...)
- func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse)
- func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse, preload bool)
- func QueryWebSite(req *apipb.QueryWebSiteRequest, resp *apipb.QueryWebSiteResponse, preload bool)
- func QueryWechatConfig(req *apipb.QueryWechatConfigRequest, resp *apipb.QueryWechatConfigResponse, ...)
- func ResetPwd(id string, pwd string) error
- func RoleMenusToPB(roleMenus []*RoleMenu) []*apipb.RoleMenu
- func RoleToPB(in *Role) *apipb.RoleInfo
- func RolesToPB(in []*Role) []*apipb.RoleInfo
- func SetDefaultPwd(defaultPwd string)
- func StatisticRoleCount(tenantID string) (int64, error)
- func StatisticTenantCount() (int64, error)
- func StatisticUserCount(t int, tenantID, group string) (int64, error)
- func SystemConfigToPB(in *SystemConfig) *apipb.SystemConfigInfo
- func SystemConfigsToPB(in []*SystemConfig) []*apipb.SystemConfigInfo
- func TenantCertificateToPB(in *TenantCertificate) *apipb.TenantCertificate
- func TenantMenusToPB(tenantMenus []*TenantMenu) []*apipb.TenantMenu
- func TenantToPB(in *Tenant) *apipb.TenantInfo
- func TenantsToPB(in []*Tenant) []*apipb.TenantInfo
- func TurnOffAutoMigrate(db *gorm.DB)
- func UpdateAPI(api *API) error
- func UpdateAPP(md *APP) error
- func UpdateBasics(m *User) error
- func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error
- func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error
- func UpdateDictionaries(m *Dictionaries) error
- func UpdateFormComponent(m *FormComponent) error
- func UpdateLanguage(m *Language) error
- func UpdateMenu(menu *Menu) (err error)
- func UpdateProfile(m *User, updateUserName bool) error
- func UpdateProfileAndUserName(m *User) error
- func UpdateProject(m *Project) error
- func UpdateProjectAll(m *Project) error
- func UpdatePwd(id string, oldPwd, newPwd string) error
- func UpdateRole(newRole *Role) error
- func UpdateSystemConfig(m *SystemConfig) error
- func UpdateTenant(newTenant *Tenant) error
- func UpdateUser(user *User) error
- func UpdateUserAgeHeightWeight(m *User) error
- func UpdateWebSite(m *WebSite) error
- func UpdateWechatConfig(m *WechatConfig) error
- func UserRolesToPB(userRoles []*UserRole) []*apipb.UserRole
- func UserToPB(in *User) *apipb.UserInfo
- func UserWechatOpenIDMapsToPB(maps []*UserWechatOpenIDMap) []*apipb.UserWechatOpenIDMap
- func UsersToPB(in []*User) []*apipb.UserInfo
- func ValidPasswdStrength(str string) bool
- func WebSiteToPB(in *WebSite) *apipb.WebSiteInfo
- func WebSitesToPB(in []*WebSite) []*apipb.WebSiteInfo
- func WechatConfigToPB(in *WechatConfig) *apipb.WechatConfigInfo
- func WechatConfigsToPB(in []*WechatConfig) []*apipb.WechatConfigInfo
- type API
- type APP
- type APPProp
- type Adapter
- func NewAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error)
- func NewAdapterByDB(db *gorm.DB) (*Adapter, error)
- func NewAdapterByDBUseTableName(db *gorm.DB, prefix string, tableName string) (*Adapter, error)
- func NewAdapterByDBWithCustomTable(db *gorm.DB, t interface{}, tableName ...string) (*Adapter, error)
- func NewAdapterByMulDb(dbPool DbPool, dbName string, prefix string, tableName string) (*Adapter, error)
- func NewFilteredAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error)
- func NewFilteredAdapterByDB(db *gorm.DB, prefix string, tableName string) (*Adapter, error)
- func (a *Adapter) AddLogger(l logger.Interface)
- func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) AddPolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error
- func (a *Adapter) Close() error
- func (a *Adapter) GetDb() *gorm.DB
- func (a *Adapter) IsFiltered() bool
- func (a *Adapter) LoadFilteredPolicy(model model.Model, filter interface{}) error
- func (a *Adapter) LoadPolicy(model model.Model) error
- func (a *Adapter) LoadPolicyCtx(ctx context.Context, model model.Model) error
- func (a *Adapter) Open() error
- func (a *Adapter) Preview(rules *[]CasbinRule, model model.Model) error
- func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
- func (a *Adapter) RemoveFilteredPolicyCtx(ctx context.Context, sec string, ptype string, fieldIndex int, ...) error
- func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error
- func (a *Adapter) RemovePoliciesCtx(ctx context.Context, sec string, ptype string, rules [][]string) error
- func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error
- func (a *Adapter) RemovePolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error
- func (a *Adapter) SavePolicy(model model.Model) error
- func (a *Adapter) SavePolicyCtx(ctx context.Context, model model.Model) error
- func (a *Adapter) Transaction(e casbin.IEnforcer, fc func(casbin.IEnforcer) error, opts ...*sql.TxOptions) error
- func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int, ...) ([][]string, error)
- func (a *Adapter) UpdatePolicies(sec string, ptype string, oldRules, newRules [][]string) error
- func (a *Adapter) UpdatePolicy(sec string, ptype string, oldRule, newPolicy []string) error
- type BatchFilter
- type CasbinRule
- type CheckRegisterWithWechatResp
- type CombineType
- type DbPool
- type Dictionaries
- func GetAllDictionaries() (list []*Dictionaries, err error)
- func GetDictionariesByID(id string) (*Dictionaries, error)
- func GetDictionariesByIDs(ids []string) ([]*Dictionaries, error)
- func PBToDictionaries(in []*apipb.DictionariesInfo) []*Dictionaries
- func PBToDictionariesArray(in *apipb.DictionariesInfo) *Dictionaries
- type Filter
- type FormComponent
- type FormComponentResource
- type Language
- type Menu
- func GetAllMenus(req *apipb.QueryMenuRequest) (menus []*Menu, err error)
- func GetAuthorizedMenu[T interface{ ... }](tx *gorm.DB, authiruzedMenu map[string]T, hidden bool) ([]*Menu, error)
- func GetAuthorizedMenuTree(tenantID string) (list []*Menu, total int64, err error)
- func GetBaseMenuTree() (menus []*Menu, err error)
- func GetMenuByID(id string) (*Menu, error)
- func GetMenuTreeByRoleID(roleID string) (menus []*Menu, err error)
- func PBToMenu(in *apipb.MenuInfo) *Menu
- type MenuFunc
- type MenuFuncApi
- type MenuParameter
- type Project
- type ProjectFormComponent
- type PwdStrength
- type QueryAPIRequest
- type QueryAPIResponse
- type QueryAPPRequest
- type QueryAPPResponse
- type QueryUserRequest
- type QueryUserResponse
- type Role
- type RoleCopyResponse
- type RoleMenu
- type RoleResponse
- type SystemConfig
- func GetAllSystemConfigs() (list []*SystemConfig, err error)
- func GetSystemConfigByID(id string) (*SystemConfig, error)
- func GetSystemConfigByIDs(ids []string) ([]*SystemConfig, error)
- func PBToSystemConfig(in *apipb.SystemConfigInfo) *SystemConfig
- func PBToSystemConfigs(in []*apipb.SystemConfigInfo) []*SystemConfig
- type Tenant
- type TenantCertificate
- type TenantMenu
- type User
- type UserProfile
- type UserRole
- type UserWechatOpenIDMap
- type WebSite
- type WechatConfig
- func GetAllWechatConfigs() (list []*WechatConfig, err error)
- func GetWechatConfigByID(id string) (*WechatConfig, error)
- func GetWechatConfigByIDs(ids []string) ([]*WechatConfig, error)
- func PBToWechatConfig(in *apipb.WechatConfigInfo) *WechatConfig
- func PBToWechatConfigs(in []*apipb.WechatConfigInfo) []*WechatConfig
Constants ¶
const ( NUmStr = "0123456789" CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" SpecStr = "+=-@#~,.[]()!%^*$" )
Variables ¶
var DefaultPwd = "ABC123def"
Functions ¶
func Authenticate ¶
func CheckRegisterWithWechat ¶
func ClearCasbin ¶
@author: [guoxf](https://github.com/guoxf) @function: ClearCasbin @description: 清除匹配的权限 @param: v int, p ...string @return: bool
func ConditionsToGormQuery ¶
ConditionsToGormQuery is a function that converts multiple query conditions into a GORM query statement You can use the GetAllowedObjectConditions() API of Casbin to get conditions, and choose the way of combining conditions through combineType.
func CopyTenant ¶
func CreateDictionaries ¶
func CreateDictionaries(m *Dictionaries) (string, error)
func CreateFormComponent ¶
func CreateFormComponent(m *FormComponent) (string, error)
func CreateLanguage ¶
func CreateProject ¶
func CreateRole ¶
func CreateSystemConfig ¶
func CreateSystemConfig(m *SystemConfig) (string, error)
func CreateTenant ¶
func CreateUser ¶
@author: [guoxf](https://github.com/guoxf) @function: CreateUser @description: 新增User @param: user User @return: err error
func CreateWebSite ¶
func CreateWechatConfig ¶
func CreateWechatConfig(m *WechatConfig) (string, error)
func DeleteDictionaries ¶
func DeleteFormComponent ¶
func DeleteLanguage ¶
func DeleteMenu ¶
func DeleteProject ¶
func DeleteRole ¶
func DeleteSystemConfig ¶
func DeleteTenant ¶
func DeleteUser ¶
@author: [guoxf](https://github.com/guoxf) @function: DeleteUser @description: 删除User @param: user User @return: err error
func DeleteWebSite ¶
func DeleteWechatConfig ¶
func DictionariesArrayToPB ¶
func DictionariesArrayToPB(in []*Dictionaries) []*apipb.DictionariesInfo
func DictionariesToPB ¶
func DictionariesToPB(in *Dictionaries) *apipb.DictionariesInfo
func EnableTenant ¶
func EnableUser ¶
func EncryptedPassword ¶
EncryptedPassword 对密码进行加密
func ExportAllAPPs ¶
func ExportAllAPPs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllApis ¶
func ExportAllApis(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllDictionaries ¶
func ExportAllDictionaries(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllLanguages ¶
func ExportAllLanguages(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllMenus ¶
func ExportAllMenus(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllProjects ¶
func ExportAllProjects(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllRoles ¶
func ExportAllRoles(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllSystemConfigs ¶
func ExportAllSystemConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllTenants ¶
func ExportAllTenants(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllUsers ¶
func ExportAllUsers(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllWebSites ¶
func ExportAllWebSites(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func ExportAllWechatConfigs ¶
func ExportAllWechatConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)
func FormComponentResourceToPB ¶
func FormComponentResourceToPB(in *FormComponentResource) *apipb.FormComponentResource
func FormComponentToPB ¶
func FormComponentToPB(in *FormComponent) *apipb.FormComponentInfo
func FormComponentsToPB ¶
func FormComponentsToPB(in []*FormComponent) []*apipb.FormComponentInfo
func GetUserProfile ¶
func GetUserProfile(id string, needMenu bool) (*apipb.UserProfile, error)
func InitCasbin ¶
func InitCasbin()
func InitDB ¶
func InitDB(client db.DBClientInterface, debug bool)
func InitSqlite ¶
func LanguageToPB ¶
func LanguageToPB(in *Language) *apipb.LanguageInfo
func LanguagesToPB ¶
func LanguagesToPB(in []*Language) []*apipb.LanguageInfo
func Login ¶
func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse)
func LoginByStaffNo ¶
func LoginByStaffNo(req *apipb.LoginByStaffNoRequest, resp *apipb.LoginByStaffNoResponse)
func LoginByWechat ¶
func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse)
func LogoutByUserName ¶
func LogoutByUserName(req *apipb.LogoutByUserNameRequest, resp *apipb.CommonResponse)
func MenuFuncApisToPB ¶
func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi
func MenuFuncsToPB ¶
func MenuParametersToPB ¶
func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter
func NewEnforcer ¶
func NewEnforcer() *casbin.Enforcer
@author: [guoxf](https://github.com/guoxf) @function: NewEnforcer @description: 持久化到数据库 引入自定义规则 @return: *casbin.Enforcer
func ParamsMatch ¶
@author: [guoxf](https://github.com/guoxf) @function: ParamsMatch @description: 自定义规则函数 @param: fullNameKey1 string, key2 string @return: bool
func ParamsMatchFunc ¶
func ParamsMatchFunc(args ...interface{}) (interface{}, error)
@author: [guoxf](https://github.com/guoxf) @function: ParamsMatchFunc @description: 自定义规则函数 @param: args ...interface{} @return: interface{}, error
func ProjectFormComponentToPB ¶
func ProjectFormComponentToPB(in *ProjectFormComponent) *apipb.ProjectFormComponent
func ProjectFormComponentsToPB ¶
func ProjectFormComponentsToPB(in []*ProjectFormComponent) []*apipb.ProjectFormComponent
func ProjectToPB ¶
func ProjectToPB(in *Project) *apipb.ProjectInfo
func ProjectsToPB ¶
func ProjectsToPB(in []*Project) []*apipb.ProjectInfo
func QueryAPI ¶
func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse)
@author: [guoxf](https://github.com/guoxf) @function: GetAPIInfoList @description: 分页查询API @param: api API, info PageInfo, order string, desc bool @return: list []*API, total int64 , err error
func QueryAPP ¶
func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse)
func QueryDictionaries ¶
func QueryDictionaries(req *apipb.QueryDictionariesRequest, resp *apipb.QueryDictionariesResponse, preload bool)
func QueryFormComponent ¶
func QueryFormComponent(req *apipb.QueryFormComponentRequest, resp *apipb.QueryFormComponentResponse, preload bool)
func QueryLanguage ¶
func QueryLanguage(req *apipb.QueryLanguageRequest, resp *apipb.QueryLanguageResponse, preload bool)
func QueryMenu ¶
func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse, preload bool)
func QueryProject ¶
func QueryProject(req *apipb.QueryProjectRequest, resp *apipb.QueryProjectResponse, preload bool)
func QueryRole ¶
func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse, preload bool)
func QuerySystemConfig ¶
func QuerySystemConfig(req *apipb.QuerySystemConfigRequest, resp *apipb.QuerySystemConfigResponse, preload bool)
func QueryTenant ¶
func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse)
func QueryUser ¶
func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse, preload bool)
@author: [guoxf](https://github.com/guoxf) @function: GetUserInfoList @description: 分页查询User @param: user User, info PageInfo, order string, desc bool @return: list []*User, total int64 , err error
func QueryWebSite ¶
func QueryWebSite(req *apipb.QueryWebSiteRequest, resp *apipb.QueryWebSiteResponse, preload bool)
func QueryWechatConfig ¶
func QueryWechatConfig(req *apipb.QueryWechatConfigRequest, resp *apipb.QueryWechatConfigResponse, preload bool)
func RoleMenusToPB ¶
func SetDefaultPwd ¶
func SetDefaultPwd(defaultPwd string)
func StatisticRoleCount ¶
func StatisticTenantCount ¶
func SystemConfigToPB ¶
func SystemConfigToPB(in *SystemConfig) *apipb.SystemConfigInfo
func SystemConfigsToPB ¶
func SystemConfigsToPB(in []*SystemConfig) []*apipb.SystemConfigInfo
func TenantCertificateToPB ¶
func TenantCertificateToPB(in *TenantCertificate) *apipb.TenantCertificate
func TenantMenusToPB ¶
func TenantMenusToPB(tenantMenus []*TenantMenu) []*apipb.TenantMenu
func TenantToPB ¶
func TenantToPB(in *Tenant) *apipb.TenantInfo
func TenantsToPB ¶
func TenantsToPB(in []*Tenant) []*apipb.TenantInfo
func TurnOffAutoMigrate ¶
func UpdateBasics ¶
func UpdateCasbin ¶
func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error
@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbin @description: 更新casbin权限 @param: roleID string, casbinInfos []CasbinRule @return: error
func UpdateCasbinApi ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbinApi @description: API更新随动 @param: oldPath string, newPath string, oldMethod string, newMethod string @return: error
func UpdateDictionaries ¶
func UpdateDictionaries(m *Dictionaries) error
func UpdateFormComponent ¶
func UpdateFormComponent(m *FormComponent) error
func UpdateLanguage ¶
func UpdateMenu ¶
func UpdateProject ¶
func UpdateProjectAll ¶
func UpdateRole ¶
func UpdateSystemConfig ¶
func UpdateSystemConfig(m *SystemConfig) error
func UpdateTenant ¶
func UpdateUser ¶
@author: [guoxf](https://github.com/guoxf) @function: UpdateUser @description: 根据id更新user @param: user User @return: err error
func UpdateWebSite ¶
func UpdateWechatConfig ¶
func UpdateWechatConfig(m *WechatConfig) error
func UserRolesToPB ¶
func UserWechatOpenIDMapsToPB ¶
func UserWechatOpenIDMapsToPB(maps []*UserWechatOpenIDMap) []*apipb.UserWechatOpenIDMap
func ValidPasswdStrength ¶
func WebSiteToPB ¶
func WebSiteToPB(in *WebSite) *apipb.WebSiteInfo
func WebSitesToPB ¶
func WebSitesToPB(in []*WebSite) []*apipb.WebSiteInfo
func WechatConfigToPB ¶
func WechatConfigToPB(in *WechatConfig) *apipb.WechatConfigInfo
func WechatConfigsToPB ¶
func WechatConfigsToPB(in []*WechatConfig) []*apipb.WechatConfigInfo
Types ¶
type API ¶
type API struct { commonmodel.Model TenantID string `json:"tenantID" gorm:"index;size:36"` ProjectID string `json:"projectID" gorm:"index;size:36"` Path string `json:"path" gorm:"size:200;index;comment:路径"` Group string `json:"group" gorm:"size:50;index;comment:分组"` Method string `json:"method" gorm:"size:50;index;default:POST;comment:方法"` Description string `json:"description" gorm:"size:200;index;comment:中文描述"` Enable bool `json:"enable" gorm:"index;comment:是否启用API"` //如果不开启权限校验,那么在每个角色都加上casbin rule //1. 不需要登录就可以直接访问 //2. 需要登录但不需要校验权限,也就是所有人都可以访问 //3. 需要登录并且校验权限 CheckAuth bool `json:"checkAuth" gorm:"index;comment:是否校验权限"` CheckLogin bool `json:"checkLogin" gorm:"index;comment:是否校验登录"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAPIById ¶
func GetAllAPIs ¶
func GetAllAPIs(req *apipb.QueryAPIRequest) (apis []API, err error)
type APP ¶
type APP struct { model.Model TenantID string `json:"tenantID" gorm:"size:36;index" ` ProjectID string `json:"projectID" gorm:"index;size:36"` Name string `json:"name" gorm:"size:200;index"` Entry string `json:"entry" gorm:"size:200;"` DevEntry string `json:"devEntry" gorm:"size:200;"` TestEntry string `json:"testEntry" gorm:"size:200;"` PreEntry string `json:"preEntry" gorm:"size:200;"` DisplayName string `json:"displayName" gorm:"size:100;comment:显示名字"` Credentials bool `json:"credentials"` Description string `json:"description" gorm:"size:200;"` Props []APPProp `json:"props"` Container string `json:"container" gorm:"size:100"` ActiveRule string `json:"activeRule" gorm:"size:200"` Enable bool `json:"enable"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAPPById ¶
func GetAllAPPs ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter represents the Gorm adapter for policy storage.
func NewAdapter ¶
NewAdapter is the constructor for Adapter. Params : databaseName,tableName,dbSpecified
databaseName,{tableName/dbSpecified} {database/dbSpecified}
databaseName and tableName are user defined. Their default value are "casbin" and "casbin_rule"
dbSpecified is an optional bool parameter. The default value is false. It's up to whether you have specified an existing DB in dataSourceName. If dbSpecified == true, you need to make sure the DB in dataSourceName exists. If dbSpecified == false, the adapter will automatically create a DB named databaseName.
func NewAdapterByDB ¶
NewAdapterByDB creates gorm-adapter by an existing Gorm instance
func NewAdapterByDBUseTableName ¶
NewAdapterByDBUseTableName creates gorm-adapter by an existing Gorm instance and the specified table prefix and table name Example: gormadapter.NewAdapterByDBUseTableName(&db, "cms", "casbin") Automatically generate table name like this "cms_casbin"
func NewAdapterByMulDb ¶
func NewFilteredAdapter ¶
func NewFilteredAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error)
NewFilteredAdapter is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.
func NewFilteredAdapterByDB ¶
NewFilteredAdapterByDB is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.
func (*Adapter) AddPolicies ¶
AddPolicies adds multiple policy rules to the storage.
func (*Adapter) AddPolicyCtx ¶
AddPolicyCtx adds a policy rule to the storage.
func (*Adapter) IsFiltered ¶
IsFiltered returns true if the loaded policy has been filtered.
func (*Adapter) LoadFilteredPolicy ¶
LoadFilteredPolicy loads only policy rules that match the filter.
func (*Adapter) LoadPolicy ¶
LoadPolicy loads policy from database.
func (*Adapter) LoadPolicyCtx ¶
LoadPolicyCtx loads policy from database.
func (*Adapter) Preview ¶
func (a *Adapter) Preview(rules *[]CasbinRule, model model.Model) error
Preview Pre-checking to avoid causing partial load success and partial failure deep
func (*Adapter) RemoveFilteredPolicy ¶
func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicy removes policy rules that match the filter from the storage.
func (*Adapter) RemoveFilteredPolicyCtx ¶
func (a *Adapter) RemoveFilteredPolicyCtx(ctx context.Context, sec string, ptype string, fieldIndex int, fieldValues ...string) error
RemoveFilteredPolicyCtx removes policy rules that match the filter from the storage.
func (*Adapter) RemovePolicies ¶
RemovePolicies removes multiple policy rules from the storage.
func (*Adapter) RemovePoliciesCtx ¶
func (a *Adapter) RemovePoliciesCtx(ctx context.Context, sec string, ptype string, rules [][]string) error
RemovePoliciesCtx removes multiple policy rules from the storage.
func (*Adapter) RemovePolicy ¶
RemovePolicy removes a policy rule from the storage.
func (*Adapter) RemovePolicyCtx ¶
func (a *Adapter) RemovePolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error
RemovePolicyCtx removes a policy rule from the storage.
func (*Adapter) SavePolicy ¶
SavePolicy saves policy to database.
func (*Adapter) SavePolicyCtx ¶
SavePolicyCtx saves policy to database.
func (*Adapter) Transaction ¶
func (a *Adapter) Transaction(e casbin.IEnforcer, fc func(casbin.IEnforcer) error, opts ...*sql.TxOptions) error
Transaction perform a set of operations within a transaction
func (*Adapter) UpdateFilteredPolicies ¶
func (*Adapter) UpdatePolicies ¶
type BatchFilter ¶
type BatchFilter struct {
// contains filtered or unexported fields
}
type CasbinRule ¶
type CasbinRule struct { ID uint `gorm:"primaryKey;autoIncrement"` Ptype string `json:"ptype" gorm:"column:ptype;size:8;uniqueIndex:unique_index"` RoleID string `json:"roleID" gorm:"column:v0;size:36;uniqueIndex:unique_index"` Path string `json:"path" gorm:"column:v1;size:200;uniqueIndex:unique_index"` Method string `json:"method" gorm:"column:v2;size:10;uniqueIndex:unique_index"` CheckAuth string `gorm:"column:v3;size:10;uniqueIndex:unique_index"` V4 string `gorm:"size:128;uniqueIndex:unique_index"` V5 string `gorm:"size:128;uniqueIndex:unique_index"` }
func GetPolicyPathByRoleID ¶
func GetPolicyPathByRoleID(roleID string) (pathMaps []*CasbinRule)
@author: [guoxf](https://github.com/guoxf) @function: GetPolicyPathByRoleID @description: 获取权限列表 @param: roleID string @return: pathMaps []CasbinRule
func (CasbinRule) TableName ¶
func (CasbinRule) TableName() string
type CheckRegisterWithWechatResp ¶
type CheckRegisterWithWechatResp struct { model.CommonResponse Data bool `json:"data"` }
type CombineType ¶
type CombineType uint32
CombineType represents different types of condition combining strategies
const ( CombineTypeOr CombineType = iota // Combine conditions with OR operator CombineTypeAnd // Combine conditions with AND operator )
type DbPool ¶
type DbPool struct {
// contains filtered or unexported fields
}
func InitDbResolver ¶
InitDbResolver multiple databases support Example usage: dbPool,err := InitDbResolver([]gorm.Dialector{mysql.Open(dsn),mysql.Open(dsn2)},[]string{"casbin1","casbin2"}) a := initAdapterWithGormInstanceByMulDb(t,dbPool,"casbin1","","casbin_rule1") a = initAdapterWithGormInstanceByMulDb(t,dbPool,"casbin2","","casbin_rule2")/*
type Dictionaries ¶
type Dictionaries struct { commonmodel.Model //Description Description string `json:"description" gorm:"size:200" ` //Name Name string `json:"name" gorm:"size:100" ` //Type Type string `json:"type" gorm:"size:100" ` //Value Value string `json:"value" gorm:"" ` //租户ID TenantID string `json:"tenantID" gorm:"size:36;index" ` ProjectID string `json:"projectID" gorm:"index;size:36"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllDictionaries ¶
func GetAllDictionaries() (list []*Dictionaries, err error)
func GetDictionariesByID ¶
func GetDictionariesByID(id string) (*Dictionaries, error)
func GetDictionariesByIDs ¶
func GetDictionariesByIDs(ids []string) ([]*Dictionaries, error)
func PBToDictionaries ¶
func PBToDictionaries(in []*apipb.DictionariesInfo) []*Dictionaries
func PBToDictionariesArray ¶
func PBToDictionariesArray(in *apipb.DictionariesInfo) *Dictionaries
type FormComponent ¶
type FormComponent struct { commonmodel.Model Name string `json:"name" gorm:"size:200;index"` Title string `gorm:"size:200"` Group string `gorm:"size:100;index"` Index int32 Description string `gorm:"size:1000"` Extends string `gorm:"size:200"` Selector string `gorm:"size:200"` DesignerProps string DesignerLocales string Resource *FormComponentResource Byo bool `gorm:"comment:formily自带"` }
func GetFormComponentByID ¶
func GetFormComponentByID(id string) (*FormComponent, error)
func PBToFormComponent ¶
func PBToFormComponent(in *apipb.FormComponentInfo) *FormComponent
func PBToFormComponents ¶
func PBToFormComponents(in []*apipb.FormComponentInfo) []*FormComponent
type FormComponentResource ¶
type FormComponentResource struct { commonmodel.Model FormComponentID string `gorm:"size:36;index"` Icon string `gorm:"size:500"` Thumb string `gorm:"size:500"` Title string `gorm:"size:200"` Description string `gorm:"size:1000"` Span int32 Elements string }
func PBToFormComponentResource ¶
func PBToFormComponentResource(in *apipb.FormComponentResource) *FormComponentResource
type Language ¶
type Language struct { commonmodel.Model //Chinese Chinese string `json:"chinese" gorm:"size:200" ` //Description Description string `json:"description" gorm:"size:400" ` //English English string `json:"english" gorm:"size:200" ` //Group Group string `json:"group" gorm:"size:100" ` //Japan Japan string `json:"japan" gorm:"size:200" ` //Name Name string `json:"name" gorm:"size:100" ` //System Admin-管理后台 APP System string `json:"system" gorm:"size:50;comment:Admin-管理后台 APP" ` //所属站点 WebSiteID string `json:"webSiteID" gorm:"size:36;index" ` TenantID string `json:"tenantID" gorm:"size:36;index" ` ProjectID string `json:"projectID" gorm:"index;size:36"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllLanguages ¶
func GetLanguageByID ¶
func GetLanguageByIDs ¶
func PBToLanguage ¶
func PBToLanguage(in *apipb.LanguageInfo) *Language
func PBToLanguages ¶
func PBToLanguages(in []*apipb.LanguageInfo) []*Language
type Menu ¶
type Menu struct { model.Model TenantID string `json:"tenantID" gorm:"size:36;index" ` ProjectID string `json:"projectID" gorm:"index;size:36"` Level uint32 `json:"level"` ParentID string `json:"parentID" gorm:"comment:父菜单ID"` Path string `json:"path" gorm:"size:200;comment:路由path"` Name string `json:"name" gorm:"size:100;comment:路由name"` Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` Component string `json:"component" gorm:"size:200;comment:对应前端文件路径"` Sort int32 `json:"sort" gorm:"comment:排序标记"` Cache bool `json:"cache" gorm:"comment:是否缓存"` DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` Title string `json:"title" gorm:"size:100;comment:菜单名"` Icon string `json:"icon" gorm:"size:100;comment:菜单图标"` CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` Children []*Menu `json:"children" gorm:"-"` Parameters []*MenuParameter `json:"parameters"` MenuFuncs []*MenuFunc `json:"menuFuncs"` }
func GetAllMenus ¶
func GetAllMenus(req *apipb.QueryMenuRequest) (menus []*Menu, err error)
func GetAuthorizedMenu ¶
func GetAuthorizedMenu[T interface { GetMenuID() string GetFuncs() []string GetShow() bool *RoleMenu | *TenantMenu }](tx *gorm.DB, authiruzedMenu map[string]T, hidden bool) ([]*Menu, error)
GetAuthorizedMenu 获取有权限的菜单 hidden为True时,隐藏在菜单中不显示的数据
func GetAuthorizedMenuTree ¶
func GetBaseMenuTree ¶
func GetMenuByID ¶
func GetMenuTreeByRoleID ¶
type MenuFunc ¶
type MenuFunc struct { model.Model MenuID string `json:"menuID" gorm:"index"` Name string `json:"name" gorm:"size:100;comment:功能名称"` Title string `json:"title" gorm:"size:100;comment:显示名称"` Hidden bool `json:"hidden" gorm:"comment:是否隐藏"` MenuFuncApis []MenuFuncApi `json:"menuFuncApis"` }
func PBToMenuFuncs ¶
type MenuFuncApi ¶
type MenuFuncApi struct { model.Model MenuFuncID string `json:"menuFuncID" gorm:"index"` APIID string `json:"apiID" gorm:"column:api_id"` API *API `json:"apiInfo"` }
func PBToMenuFuncApis ¶
func PBToMenuFuncApis(params []*apipb.MenuFuncApi) []MenuFuncApi
type MenuParameter ¶
type MenuParameter struct { model.Model MenuID string `json:"menuID" gorm:"index"` Type string `json:"type" gorm:"size:50;comment:地址栏携带参数为params还是query"` Key string `json:"key" gorm:"size:100;comment:地址栏携带参数的key"` Value string `json:"value" gorm:"size:200;comment:地址栏携带参数的值"` }
func PBToMenuParameters ¶
func PBToMenuParameters(params []*apipb.MenuParameter) []*MenuParameter
type Project ¶
type Project struct { commonmodel.Model TenantID string `json:"tenantID" gorm:"size:36;index" ` Name string `json:"name" gorm:"size:200;index" ` FormCount int32 `json:"formCount" gorm:"comment:可以创建的表单数量,-1为不限制" ` PageCount int32 `json:"pageCount" gorm:"comment:可以创建的页面数量,-1为不限制" ` Expired time.Time `json:"expired" gorm:"comment:项目继续维护表单和页面的过期时间" ` Description string `json:"description" gorm:"size:500" ` CellCount int32 `json:"cellCount" gorm:"" ` FormComponents []*ProjectFormComponent `json:"formComponents" gorm:"size:36" ` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllProjects ¶
func GetProjectByID ¶
func PBToProject ¶
func PBToProject(in *apipb.ProjectInfo) *Project
func PBToProjects ¶
func PBToProjects(in []*apipb.ProjectInfo) []*Project
type ProjectFormComponent ¶
type ProjectFormComponent struct { commonmodel.Model ProjectID string `json:"projectID" gorm:"size:36;index" ` Name string `json:"name" gorm:"size:200;index" ` }
func PBToProjectFormComponent ¶
func PBToProjectFormComponent(in *apipb.ProjectFormComponent) *ProjectFormComponent
func PBToProjectFormComponents ¶
func PBToProjectFormComponents(in []*apipb.ProjectFormComponent) []*ProjectFormComponent
type PwdStrength ¶
type PwdStrength int
const ( PwdStrengthOnliyNumber PwdStrength = iota PwdStrengthOnliyChar PwdStrengthMix PwdStrengthAdvance )
type QueryAPIRequest ¶
type QueryAPIRequest struct { commonmodel.CommonRequest Path string `json:"path" form:"path" path:"path"` Method string `json:"method" form:"method" path:"method"` Group string `json:"group" form:"group" path:"group"` CheckAuth int `json:"checkAuth" form:"checkAuth" path:"checkAuth"` CheckLogin int `json:"checkLogin" form:"checkLogin" path:"checkLogin"` }
type QueryAPIResponse ¶
type QueryAPIResponse struct { commonmodel.CommonResponse Data []API `json:"data"` }
type QueryAPPRequest ¶
type QueryAPPResponse ¶
type QueryAPPResponse struct { model.CommonResponse Data []*APP `json:"data"` }
type QueryUserRequest ¶
type QueryUserRequest struct { model.CommonRequest UserName string `json:"userName" form:"userName" uri:"userName"` Nickname string `json:"nickname" form:"nickname" uri:"nickname"` IDCard string `json:"idCard" form:"idCard" uri:"idCard"` Mobile string `json:"mobile" form:"mobile" uri:"mobile"` WechatID string `json:"wechatID" form:"wechatID" uri:"wechatID"` Title string `json:"title" form:"title" uri:"title"` UserNames string `json:"userNames" form:"userNames" uri:"userNames"` }
type QueryUserResponse ¶
type QueryUserResponse struct { model.CommonResponse Data []*User `json:"data"` }
type Role ¶
type Role struct { model.Model TenantID string `gorm:"index;size:36"` ProjectID string `gorm:"index;size:36"` Name string `json:"name" gorm:"size:100;comment:角色名"` ParentID string `json:"parentID" gorm:"comment:父角色ID"` Children []*Role `json:"children" gorm:"-"` RoleMenus []*RoleMenu `json:"roleMenus"` DefaultRouter string `json:"defaultRouter" gorm:"size:100;comment:默认菜单;default:dashboard"` Description string `json:"description" gorm:"size:200;"` CanDel bool `json:"canDel" gorm:"default:1"` Tenant *Tenant `json:"tenant"` Public bool `gorm:"comment:是否是公共角色;default:0"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func CopyRole ¶
func CopyRole(copyInfo RoleCopyResponse) (*Role, error)
func GetAllRole ¶
GetAllRole 获取所有用户 containerCommon true-包含公共角色 false-不包含公共角色 公共角色定义:不设置租户的角色
func GetFullRoleByID ¶
func GetRoleByID ¶
type RoleCopyResponse ¶
type RoleMenu ¶
type RoleMenu struct { model.Model RoleID string `json:"roleID" gorm:"index;comment:角色ID"` MenuID string `json:"menuID" gorm:"index;comment:菜单ID"` Funcs string `json:"funcs" gorm:"size:500;comment:功能名称,多个以逗号隔开"` Show bool Menu *Menu `json:"menu"` }
func GetMenuRole ¶
func PBToRoleMenus ¶
type RoleResponse ¶
type RoleResponse struct {
Role Role `json:"role"`
}
type SystemConfig ¶
type SystemConfig struct { commonmodel.Model //加密key Key string `json:"key" gorm:"size:36" ` //Redis地址 RedisAddr string `json:"redisAddr" gorm:"size:100" ` //Redis用户名 RedisName string `json:"redisName" gorm:"size:100" ` //Redis密码 RedisPwd string `json:"redisPwd" gorm:"size:36" ` //Token过期时间 单位分钟 Expired string `json:"expired" gorm:"size:36;comment:单位分钟" ` //重置默认密码 DefaultPwd string `json:"defaultPwd" gorm:"size:36" ` //超级管理员角色 SuperAdminRoleID string `json:"superAdminRoleID" gorm:"size:36" ` //平台租户 PlatformTenantID string `json:"platformTenantID" gorm:"size:36" ` //启用租户 EnableTenant bool `json:"enableTenant" gorm:"" ` TenantID string `json:"tenantID" gorm:"size:36;index" ` ProjectID string `json:"projectID" gorm:"index;size:36"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllSystemConfigs ¶
func GetAllSystemConfigs() (list []*SystemConfig, err error)
func GetSystemConfigByID ¶
func GetSystemConfigByID(id string) (*SystemConfig, error)
func GetSystemConfigByIDs ¶
func GetSystemConfigByIDs(ids []string) ([]*SystemConfig, error)
func PBToSystemConfig ¶
func PBToSystemConfig(in *apipb.SystemConfigInfo) *SystemConfig
func PBToSystemConfigs ¶
func PBToSystemConfigs(in []*apipb.SystemConfigInfo) []*SystemConfig
type Tenant ¶
type Tenant struct { model.Model // 租户名称 // required: true // @inject_tag: validate:"required" Name string `json:"name" validate:"required" gorm:"index;size:200"` // 联系人 Contact string `json:"contact" gorm:"size:100"` // 联系人电话 CellPhone string `json:"cellPhone" gorm:"size:50"` // 地址 Address string `json:"address" gorm:"size:200"` // 业务范围 BusinessScope string `json:"businessScope" gorm:"size:200"` // 占地面积 AreaCovered string `json:"areaCovered" gorm:"size:100"` // 人员规模 StaffSize int32 `json:"staffSize"` Enable bool `json:"enable" gorm:"index"` //省份 Province string `gorm:"index;size:12"` //城市 City string `gorm:"index;size:12"` //区/县 Area string `gorm:"index;size:12"` //街道/镇 Town string `gorm:"index;size:12"` UserCount int32 RoleCount int32 ProjectCount int32 Expired time.Time TenantMenus []*TenantMenu Certificate *TenantCertificate IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllTenant ¶
func GetTenantByID ¶
func PBToTenant ¶
func PBToTenant(in *apipb.TenantInfo) *Tenant
type TenantCertificate ¶
type TenantCertificate struct { model.Model TenantID string `json:"tenantID" gorm:"index;comment:租户ID"` PrivateKey string `gorm:"size:1000"` PublicKey string `gorm:"size:1000"` }
func PBToTenantCertificate ¶
func PBToTenantCertificate(in *apipb.TenantCertificate) *TenantCertificate
type TenantMenu ¶
type TenantMenu struct { model.Model TenantID string `json:"tenantID" gorm:"index;comment:租户ID"` MenuID string `json:"menuID" gorm:"index;comment:菜单ID"` Funcs string `json:"funcs" gorm:"size:500;comment:功能名称,多个以逗号隔开"` Menu *Menu `json:"menu"` }
func PBToTenantMenus ¶
func PBToTenantMenus(tenantMenus []*apipb.TenantMenu) []*TenantMenu
func (*TenantMenu) GetFuncs ¶
func (r *TenantMenu) GetFuncs() []string
func (*TenantMenu) GetMenuID ¶
func (r *TenantMenu) GetMenuID() string
func (*TenantMenu) GetShow ¶
func (r *TenantMenu) GetShow() bool
type User ¶
type User struct { model.TenantModel ProjectID string `json:"projectID" gorm:"index;size:36"` //账号信息 UserName string `json:"userName" validate:"required" gorm:"size:50;index;comment:用户登录名"` Password string `json:"password" gorm:"size:200;comment:用户登录密码"` Nickname string `json:"nickname" validate:"required" gorm:"size:100;index;default:未设置;comment:用户昵称" ` UserRoles []*UserRole `json:"userRoles"` RoleIDs []string `json:"roleIDs" gorm:"-"` WechatUnionID string `json:"wechatUnionID" gorm:"size:36;index;comment:微信UionID"` WechatOpenID string `json:"wechatOpenID" gorm:"size:36;index;comment:微信OpenID"` WechatConfigID string `json:"wechatConfigID" gorm:"size:36;index;comment:微信配置ID"` //用户类型 Type int32 `json:"type" gorm:"index"` Group string `json:"group" gorm:"index;size:50"` //启用账号后可以登录系统 Enable bool `json:"enable" gorm:"index"` // 用户名/密码错误次数 ErrNumber int32 `json:"errNumber"` // 随着密码/用户名错误次数增加,用户被锁定的时间也就越长,一天最多错误5次 LockedExpired int64 `json:"lockedExpired"` // 强制修改密码 ForceChangePwd bool `json:"forceChangePwd"` // 用户过期时间 Expired int64 `json:"expired"` ChangePwdErrNum int32 `json:"changePwdErrNum"` ChangePwdLockedExpired int64 `json:"changePwdLockedExpired"` CanDel bool `json:"canDel"` //基本信息 Email string `json:"email" gorm:"size:100;"` Mobile string `json:"mobile" gorm:"size:20;index;comment:手机号"` IDCard string `json:"idCard" gorm:"size:18;index;comment:身份证号"` Avatar string `json:"avatar" gorm:"size:200;comment:用户头像"` EID string `json:"eid" gorm:"size:50;"` Title string `json:"title" gorm:"size:100;comment:职位"` Description string `json:"description" gorm:"size:200;"` RealName string `json:"realName" gorm:"index;size:50;"` Gender bool `json:"gender"` //性别 true=男 Age int32 `json:"age" gorm:"" ` //年龄 Height float32 `json:"height" gorm:""` //身高 Weight float32 `json:"weight" gorm:""` //体重 ChineseName string `json:"chineseName" gorm:"size:50"` EnglishName string `json:"englishName" gorm:"size:50"` StaffNo string `json:"staffNo" gorm:"index;size:50"` Country string `json:"country" gorm:"size:100;"` //国家 Province string `json:"province" gorm:"size:100;"` //省份 City string `json:"city" gorm:"size:100;"` //城市 County string `json:"county" gorm:"size:100;"` //区县 Birthday int64 `json:"birthday"` //公历出生日期包含时分 IsVip bool `json:"isVip"` VipExpired time.Time `json:"vipExpired"` Tenant *Tenant `json:"tenant"` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` WechatOpenIDMaps []*UserWechatOpenIDMap `json:"wechatOpenIDMaps"` }
func GetAllUsers ¶
func GetAllUsers(req *apipb.GetAllUsersRequest) (users []*User, err error)
@author: [guoxf](https://github.com/guoxf) @function: GetAllUsers @description: 获取所有User @return: users []User , err error
func GetUserById ¶
@author: [guoxf](https://github.com/guoxf) @function: GetUserById @description: 根据id获取user @param: id uint @return: user User , err error
func UserProfileToUser ¶
func UserProfileToUser(in *apipb.UserProfile) *User
func (User) GetRoleIDs ¶
type UserProfile ¶
type UserProfile struct { apipb.UserProfile Menus []*Menu `json:"menus"` }
type UserRole ¶
type UserRole struct { model.Model UserID string `json:"userID" gorm:"index"` RoleID string `json:"roleID" gorm:"index"` Role *Role }
func PBToUserRoles ¶
type UserWechatOpenIDMap ¶
type UserWechatOpenIDMap struct { model.Model UserID string `json:"userID" gorm:"index"` UnionID string `json:"unionID" gorm:"size:36;index;comment:微信UionID"` OpenID string `json:"openID" gorm:"size:36;index;comment:微信OpenID"` WechatConfigID string `json:"wechatConfigID" gorm:"size:36;index;comment:微信配置ID"` }
func PBToUserWechatOpenIDMaps ¶
func PBToUserWechatOpenIDMaps(maps []*apipb.UserWechatOpenIDMap) []*UserWechatOpenIDMap
type WebSite ¶
type WebSite struct { commonmodel.Model //网站名称 Name string `json:"name" gorm:"size:200;index" ` //网站编号 Code string `json:"code" gorm:"size:100;uniqueindex:WebSite_uidx1" ` //网站Logo Logo string `json:"logo" gorm:"size:36" ` //所属项目 ProjectID string `json:"projectID" gorm:"size:36" ` //租户ID TenantID string `json:"tenantID" gorm:"size:36;index" ` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllWebSites ¶
func GetWebSiteByID ¶
func GetWebSiteByIDs ¶
func PBToWebSite ¶
func PBToWebSite(in *apipb.WebSiteInfo) *WebSite
func PBToWebSites ¶
func PBToWebSites(in []*apipb.WebSiteInfo) []*WebSite
type WechatConfig ¶
type WechatConfig struct { commonmodel.Model //APP ID AppID string `json:"appID" gorm:"size:36" ` //APP名称 AppName string `json:"appName" gorm:"size:100;uniqueindex:wechatconfig_uidx1" ` //显示名称 DisplayName string `json:"displayName" gorm:"size:100" ` //秘钥 Secret string `json:"secret" gorm:"size:512" ` //租户ID TenantID string `json:"tenantID" gorm:"size:36;index" ` //类型 1-微信小程序 2-微信公众号 3-微信APP应用 4-微信网站应用 5-企业微信应用 AppType int32 `` /* 132-byte string literal not displayed */ //默认角色 用户通过微信注册时赋予默认角色 DefaultRoleID string `json:"defaultRoleID" gorm:"size:36;comment:用户通过微信注册时赋予默认角色" ` RedirectUrl string Token string `json:"token" gorm:"size:32;"` EncodingAESKey string `json:"encodingAESKey" gorm:"size:43;"` EncodingMethod int32 `json:"encodingMethod" gorm:"comment:1-明文模式 2-兼容模式 3-安全模式" ` ProjectID string `json:"projectID" gorm:"index;size:36"` AgentID string `json:"agentID" gorm:"size:36;comment:企业微信应用ID" ` IsMust bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"` }
func GetAllWechatConfigs ¶
func GetAllWechatConfigs() (list []*WechatConfig, err error)
func GetWechatConfigByID ¶
func GetWechatConfigByID(id string) (*WechatConfig, error)
func GetWechatConfigByIDs ¶
func GetWechatConfigByIDs(ids []string) ([]*WechatConfig, error)
func PBToWechatConfig ¶
func PBToWechatConfig(in *apipb.WechatConfigInfo) *WechatConfig
func PBToWechatConfigs ¶
func PBToWechatConfigs(in []*apipb.WechatConfigInfo) []*WechatConfig