casdoorsdk

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 46

Documentation

Index

Constants

View Source
const MfaRecoveryCodesSession = "mfa_recovery_codes"

Variables

View Source
var (
	CasdoorApplication  = "app-built-in"
	CasdoorOrganization = "built-in"
)
View Source
var (
	TestCasdoorEndpoint     = "https://demo.casdoor.com"
	TestClientId            = "294b09fbc17f95daf2fe"
	TestClientSecret        = "dd8982f7046ccba1bbd7851d5c1ece4e52bf039d"
	TestCasdoorOrganization = "casbin"
	TestCasdoorApplication  = "app-vue-python-example"
)
View Source
var TestJwtPublicKey = `` /* 1784-byte string literal not displayed */

Functions

func AddAdapter added in v0.29.0

func AddAdapter(adapter *Adapter) (bool, error)

func AddApplication

func AddApplication(application *Application) (bool, error)

func AddCert added in v0.29.0

func AddCert(cert *Cert) (bool, error)

func AddEnforcer added in v0.29.0

func AddEnforcer(enforcer *Enforcer) (bool, error)

func AddGroup added in v0.29.0

func AddGroup(group *Group) (bool, error)

func AddModel added in v0.29.0

func AddModel(model *Model) (bool, error)

func AddOrganization

func AddOrganization(organization *Organization) (bool, error)

func AddPayment added in v0.29.0

func AddPayment(payment *Payment) (bool, error)

func AddPermission

func AddPermission(permission *Permission) (bool, error)

func AddPlan added in v0.29.0

func AddPlan(plan *Plan) (bool, error)

func AddPricing added in v0.29.0

func AddPricing(pricing *Pricing) (bool, error)

func AddProduct added in v0.29.0

func AddProduct(product *Product) (bool, error)

func AddProvider added in v0.28.0

func AddProvider(provider *Provider) (bool, error)

func AddRecord added in v0.9.1

func AddRecord(record *Record) (bool, error)

func AddRole added in v0.13.0

func AddRole(role *Role) (bool, error)

func AddSession added in v0.28.0

func AddSession(session *Session) (bool, error)

func AddSubscription added in v0.29.0

func AddSubscription(subscription *Subscription) (bool, error)

func AddSyncer added in v0.29.0

func AddSyncer(syncer *Syncer) (bool, error)

func AddToken added in v0.34.0

func AddToken(token *Token) (bool, error)

func AddUser

func AddUser(user *User) (bool, error)

func AddWebhook added in v0.29.0

func AddWebhook(webhook *Webhook) (bool, error)

func BatchEnforce added in v0.17.0

func BatchEnforce(permissionId, modelId, resourceId string, casbinRequests []CasbinRequest) ([][]bool, error)

func CheckUserPassword

func CheckUserPassword(user *User) (bool, error)

func DeleteAdapter added in v0.29.0

func DeleteAdapter(adapter *Adapter) (bool, error)

func DeleteApplication

func DeleteApplication(application *Application) (bool, error)

func DeleteCert added in v0.29.0

func DeleteCert(cert *Cert) (bool, error)

func DeleteEnforcer added in v0.29.0

func DeleteEnforcer(enforcer *Enforcer) (bool, error)

func DeleteGroup added in v0.29.0

func DeleteGroup(group *Group) (bool, error)

func DeleteModel added in v0.29.0

func DeleteModel(model *Model) (bool, error)

func DeleteOrganization

func DeleteOrganization(organization *Organization) (bool, error)

func DeletePayment added in v0.29.0

func DeletePayment(payment *Payment) (bool, error)

func DeletePermission added in v0.11.0

func DeletePermission(permission *Permission) (bool, error)

func DeletePlan added in v0.29.0

func DeletePlan(plan *Plan) (bool, error)

func DeletePricing added in v0.29.0

func DeletePricing(pricing *Pricing) (bool, error)

func DeleteProduct added in v0.29.0

func DeleteProduct(product *Product) (bool, error)

func DeleteProvider added in v0.28.0

func DeleteProvider(provider *Provider) (bool, error)

func DeleteResource

func DeleteResource(resource *Resource) (bool, error)

func DeleteRole added in v0.13.0

func DeleteRole(role *Role) (bool, error)

func DeleteSession added in v0.28.0

func DeleteSession(session *Session) (bool, error)

func DeleteSubscription added in v0.29.0

func DeleteSubscription(subscription *Subscription) (bool, error)

func DeleteSyncer added in v0.29.0

func DeleteSyncer(syncer *Syncer) (bool, error)

func DeleteToken added in v0.21.0

func DeleteToken(token *Token) (bool, error)

func DeleteUser

func DeleteUser(user *User) (bool, error)

func DeleteWebhook added in v0.29.0

func DeleteWebhook(webhook *Webhook) (bool, error)

func DoGetBytes

func DoGetBytes(url string) ([]byte, error)

DoGetBytes is a general function to get response data in bytes from param url through HTTP Get method.

func DoGetBytesRaw

func DoGetBytesRaw(url string) ([]byte, error)

DoGetBytesRaw is a general function to get response from param url through HTTP Get method.

func DoPostBytesRaw added in v0.17.0

func DoPostBytesRaw(url string, contentType string, body io.Reader) ([]byte, error)

DoPostBytesRaw is a general function to post a request from url, body through HTTP Post method.

func Enforce added in v0.17.0

func Enforce(permissionId, modelId, resourceId string, casbinRequest CasbinRequest) (bool, error)

func GetCurrentTime added in v0.31.1

func GetCurrentTime() string

func GetMyProfileUrl

func GetMyProfileUrl(accessToken string) string

func GetOAuthToken

func GetOAuthToken(code string, state string) (*oauth2.Token, error)

func GetSigninUrl

func GetSigninUrl(redirectUri string) string

func GetSignupUrl

func GetSignupUrl(enablePassword bool, redirectUri string) string

func GetUrl

func GetUrl(action string, queryMap map[string]string) string

func GetUserCount

func GetUserCount(isOnline string) (int, error)

func GetUserProfileUrl

func GetUserProfileUrl(userName string, accessToken string) string

func InitConfig

func InitConfig(endpoint string, clientId string, clientSecret string, certificate string, organizationName string, applicationName string)

func InvoicePayment added in v0.29.0

func InvoicePayment(payment *Payment) (bool, error)

func NotifyPayment added in v0.29.0

func NotifyPayment(payment *Payment) (bool, error)

func RefreshOAuthToken

func RefreshOAuthToken(refreshToken string) (*oauth2.Token, error)

func SendEmail

func SendEmail(title string, content string, sender string, receivers ...string) error

func SendSms

func SendSms(content string, receivers ...string) error

func SetHttpClient added in v0.20.0

func SetHttpClient(httpClient HttpClient)

SetHttpClient sets custom http Client.

func SetPassword added in v0.9.0

func SetPassword(owner, name, oldPassword, newPassword string) (bool, error)

note: oldPassword is not required, if you don't need, just pass a empty string

func UpdateAdapter added in v0.29.0

func UpdateAdapter(adapter *Adapter) (bool, error)

func UpdateApplication added in v0.28.0

func UpdateApplication(application *Application) (bool, error)

func UpdateCert added in v0.29.0

func UpdateCert(cert *Cert) (bool, error)

func UpdateEnforcer added in v0.29.0

func UpdateEnforcer(enforcer *Enforcer) (bool, error)

func UpdateGroup added in v0.29.0

func UpdateGroup(group *Group) (bool, error)

func UpdateModel added in v0.29.0

func UpdateModel(model *Model) (bool, error)

func UpdateOrganization added in v0.28.0

func UpdateOrganization(organization *Organization) (bool, error)

func UpdatePayment added in v0.29.0

func UpdatePayment(payment *Payment) (bool, error)

func UpdatePermission added in v0.11.0

func UpdatePermission(permission *Permission) (bool, error)

func UpdatePermissionForColumns added in v0.11.0

func UpdatePermissionForColumns(permission *Permission, columns []string) (bool, error)

func UpdatePlan added in v0.29.0

func UpdatePlan(plan *Plan) (bool, error)

func UpdatePricing added in v0.29.0

func UpdatePricing(pricing *Pricing) (bool, error)

func UpdateProduct added in v0.29.0

func UpdateProduct(product *Product) (bool, error)

func UpdateProvider added in v0.28.0

func UpdateProvider(provider *Provider) (bool, error)

func UpdateRole added in v0.13.0

func UpdateRole(role *Role) (bool, error)

func UpdateRoleForColumns added in v0.13.0

func UpdateRoleForColumns(role *Role, columns []string) (bool, error)

func UpdateSession added in v0.28.0

func UpdateSession(session *Session) (bool, error)

func UpdateSessionForColumns added in v0.28.0

func UpdateSessionForColumns(session *Session, columns []string) (bool, error)

func UpdateSubscription added in v0.29.0

func UpdateSubscription(subscription *Subscription) (bool, error)

func UpdateSyncer added in v0.29.0

func UpdateSyncer(syncer *Syncer) (bool, error)

func UpdateToken added in v0.34.0

func UpdateToken(token *Token) (bool, error)

func UpdateTokenForColumns added in v0.34.0

func UpdateTokenForColumns(token *Token, columns []string) (bool, error)

func UpdateUser

func UpdateUser(user *User) (bool, error)

func UpdateUserById added in v0.18.0

func UpdateUserById(id string, user *User) (bool, error)

func UpdateUserForColumns

func UpdateUserForColumns(user *User, columns []string) (bool, error)

func UpdateWebhook added in v0.29.0

func UpdateWebhook(webhook *Webhook) (bool, error)

func UploadResource

func UploadResource(user string, tag string, parent string, fullFilePath string, fileBytes []byte) (string, string, error)

func UploadResourceEx

func UploadResourceEx(user string, tag string, parent string, fullFilePath string, fileBytes []byte, createdTime string, description string) (string, string, error)

Types

type AccountItem added in v0.10.0

type AccountItem struct {
	Name       string `json:"name"`
	Visible    bool   `json:"visible"`
	ViewRule   string `json:"viewRule"`
	ModifyRule string `json:"modifyRule"`
}

type Adapter added in v0.29.0

type Adapter struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Type            string `xorm:"varchar(100)" json:"type"`
	DatabaseType    string `xorm:"varchar(100)" json:"databaseType"`
	Host            string `xorm:"varchar(100)" json:"host"`
	Port            int    `json:"port"`
	User            string `xorm:"varchar(100)" json:"user"`
	Password        string `xorm:"varchar(100)" json:"password"`
	Database        string `xorm:"varchar(100)" json:"database"`
	Table           string `xorm:"varchar(100)" json:"table"`
	TableNamePrefix string `xorm:"varchar(100)" json:"tableNamePrefix"`

	IsEnabled bool `json:"isEnabled"`
}

func GetAdapter added in v0.29.0

func GetAdapter(name string) (*Adapter, error)

func GetAdapters added in v0.29.0

func GetAdapters() ([]*Adapter, error)

func GetPaginationAdapters added in v0.29.0

func GetPaginationAdapters(p int, pageSize int, queryMap map[string]string) ([]*Adapter, int, error)

type Application

type Application struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName         string          `xorm:"varchar(100)" json:"displayName"`
	HomepageUrl         string          `xorm:"varchar(100)" json:"homepageUrl"`
	Description         string          `xorm:"varchar(100)" json:"description"`
	Organization        string          `xorm:"varchar(100)" json:"organization"`
	Cert                string          `xorm:"varchar(100)" json:"cert"`
	EnablePassword      bool            `json:"enablePassword"`
	EnableSignUp        bool            `json:"enableSignUp"`
	EnableSigninSession bool            `json:"enableSigninSession"`
	EnableAutoSignin    bool            `json:"enableAutoSignin"`
	EnableCodeSignin    bool            `json:"enableCodeSignin"`
	EnableSamlCompress  bool            `json:"enableSamlCompress"`
	EnableWebAuthn      bool            `json:"enableWebAuthn"`
	EnableLinkWithEmail bool            `json:"enableLinkWithEmail"`
	OrgChoiceMode       string          `json:"orgChoiceMode"`
	SamlReplyUrl        string          `xorm:"varchar(100)" json:"samlReplyUrl"`
	Providers           []*ProviderItem `xorm:"mediumtext" json:"providers"`
	SignupItems         []*SignupItem   `xorm:"varchar(1000)" json:"signupItems"`
	GrantTypes          []string        `xorm:"varchar(1000)" json:"grantTypes"`
	OrganizationObj     *Organization   `xorm:"-" json:"organizationObj"`
	Tags                []string        `xorm:"mediumtext" json:"tags"`

	ClientId             string     `xorm:"varchar(100)" json:"clientId"`
	ClientSecret         string     `xorm:"varchar(100)" json:"clientSecret"`
	RedirectUris         []string   `xorm:"varchar(1000)" json:"redirectUris"`
	TokenFormat          string     `xorm:"varchar(100)" json:"tokenFormat"`
	ExpireInHours        int        `json:"expireInHours"`
	RefreshExpireInHours int        `json:"refreshExpireInHours"`
	SignupUrl            string     `xorm:"varchar(200)" json:"signupUrl"`
	SigninUrl            string     `xorm:"varchar(200)" json:"signinUrl"`
	ForgetUrl            string     `xorm:"varchar(200)" json:"forgetUrl"`
	AffiliationUrl       string     `xorm:"varchar(100)" json:"affiliationUrl"`
	TermsOfUse           string     `xorm:"varchar(100)" json:"termsOfUse"`
	SignupHtml           string     `xorm:"mediumtext" json:"signupHtml"`
	SigninHtml           string     `xorm:"mediumtext" json:"signinHtml"`
	ThemeData            *ThemeData `xorm:"json" json:"themeData"`
	FormCss              string     `xorm:"text" json:"formCss"`
	FormCssMobile        string     `xorm:"text" json:"formCssMobile"`
	FormOffset           int        `json:"formOffset"`
	FormSideHtml         string     `xorm:"mediumtext" json:"formSideHtml"`
	FormBackgroundUrl    string     `xorm:"varchar(200)" json:"formBackgroundUrl"`
}

Application has the same definition as https://github.com/casdoor/casdoor/blob/master/object/application.go#L24

func GetApplication added in v0.28.0

func GetApplication(name string) (*Application, error)

func GetApplications added in v0.28.0

func GetApplications() ([]*Application, error)

func GetOrganizationApplications added in v0.28.4

func GetOrganizationApplications() ([]*Application, error)

type AuthConfig

type AuthConfig struct {
	Endpoint         string
	ClientId         string
	ClientSecret     string
	Certificate      string
	OrganizationName string
	ApplicationName  string
}

AuthConfig is the core configuration. The first step to use this SDK is to use the InitConfig function to initialize the global authConfig.

type CasbinRequest added in v0.23.0

type CasbinRequest = []interface{}

type Cert added in v0.28.2

type Cert struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName     string `xorm:"varchar(100)" json:"displayName"`
	Scope           string `xorm:"varchar(100)" json:"scope"`
	Type            string `xorm:"varchar(100)" json:"type"`
	CryptoAlgorithm string `xorm:"varchar(100)" json:"cryptoAlgorithm"`
	BitSize         int    `json:"bitSize"`
	ExpireInYears   int    `json:"expireInYears"`

	Certificate            string `xorm:"mediumtext" json:"certificate"`
	PrivateKey             string `xorm:"mediumtext" json:"privateKey"`
	AuthorityPublicKey     string `xorm:"mediumtext" json:"authorityPublicKey"`
	AuthorityRootPublicKey string `xorm:"mediumtext" json:"authorityRootPublicKey"`
}

Cert has the same definition as https://github.com/casdoor/casdoor/blob/master/object/cert.go#L24

func GetCert added in v0.30.0

func GetCert(name string) (*Cert, error)

func GetCerts added in v0.28.2

func GetCerts() ([]*Cert, error)

func GetGlobalCerts added in v0.28.2

func GetGlobalCerts() ([]*Cert, error)

type Claims

type Claims struct {
	User
	AccessToken string `json:"accessToken"`
	jwt.RegisteredClaims
	TokenType        string `json:"tokenType"`
	RefreshTokenType string `json:"TokenType"`
}

func ParseJwtToken

func ParseJwtToken(token string) (*Claims, error)

func (Claims) IsRefreshToken added in v0.36.0

func (c Claims) IsRefreshToken() bool

IsRefreshToken returns true if the token is a refresh token

type Client added in v0.27.0

type Client struct {
	AuthConfig
}

func NewClient added in v0.27.0

func NewClient(endpoint string, clientId string, clientSecret string, certificate string, organizationName string, applicationName string) *Client

func NewClientWithConf added in v0.27.0

func NewClientWithConf(config *AuthConfig) *Client

func (*Client) AddAdapter added in v0.29.0

func (c *Client) AddAdapter(adapter *Adapter) (bool, error)

func (*Client) AddApplication added in v0.27.0

func (c *Client) AddApplication(application *Application) (bool, error)

func (*Client) AddCert added in v0.29.0

func (c *Client) AddCert(cert *Cert) (bool, error)

func (*Client) AddEnforcer added in v0.29.0

func (c *Client) AddEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) AddGroup added in v0.29.0

func (c *Client) AddGroup(group *Group) (bool, error)

func (*Client) AddModel added in v0.29.0

func (c *Client) AddModel(model *Model) (bool, error)

func (*Client) AddOrganization added in v0.27.0

func (c *Client) AddOrganization(organization *Organization) (bool, error)

func (*Client) AddPayment added in v0.29.0

func (c *Client) AddPayment(payment *Payment) (bool, error)

func (*Client) AddPermission added in v0.27.0

func (c *Client) AddPermission(permission *Permission) (bool, error)

func (*Client) AddPlan added in v0.29.0

func (c *Client) AddPlan(plan *Plan) (bool, error)

func (*Client) AddPricing added in v0.29.0

func (c *Client) AddPricing(pricing *Pricing) (bool, error)

func (*Client) AddProduct added in v0.29.0

func (c *Client) AddProduct(product *Product) (bool, error)

func (*Client) AddProvider added in v0.28.0

func (c *Client) AddProvider(provider *Provider) (bool, error)

func (*Client) AddRecord added in v0.27.0

func (c *Client) AddRecord(record *Record) (bool, error)

func (*Client) AddRole added in v0.27.0

func (c *Client) AddRole(role *Role) (bool, error)

func (*Client) AddSession added in v0.28.0

func (c *Client) AddSession(session *Session) (bool, error)

func (*Client) AddSubscription added in v0.29.0

func (c *Client) AddSubscription(subscription *Subscription) (bool, error)

func (*Client) AddSyncer added in v0.29.0

func (c *Client) AddSyncer(syncer *Syncer) (bool, error)

func (*Client) AddToken added in v0.34.0

func (c *Client) AddToken(token *Token) (bool, error)

func (*Client) AddUser added in v0.27.0

func (c *Client) AddUser(user *User) (bool, error)

func (*Client) AddWebhook added in v0.29.0

func (c *Client) AddWebhook(webhook *Webhook) (bool, error)

func (*Client) BatchEnforce added in v0.27.0

func (c *Client) BatchEnforce(permissionId, modelId, resourceId string, casbinRequests []CasbinRequest) ([][]bool, error)

func (*Client) BuyProduct added in v0.29.0

func (c *Client) BuyProduct(name string, providerName string) (*Product, error)

func (*Client) CheckUserPassword added in v0.27.0

func (c *Client) CheckUserPassword(user *User) (bool, error)

func (*Client) DeleteAdapter added in v0.29.0

func (c *Client) DeleteAdapter(adapter *Adapter) (bool, error)

func (*Client) DeleteApplication added in v0.27.0

func (c *Client) DeleteApplication(application *Application) (bool, error)

func (*Client) DeleteCert added in v0.29.0

func (c *Client) DeleteCert(cert *Cert) (bool, error)

func (*Client) DeleteEnforcer added in v0.29.0

func (c *Client) DeleteEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) DeleteGroup added in v0.29.0

func (c *Client) DeleteGroup(group *Group) (bool, error)

func (*Client) DeleteModel added in v0.29.0

func (c *Client) DeleteModel(model *Model) (bool, error)

func (*Client) DeleteOrganization added in v0.27.0

func (c *Client) DeleteOrganization(organization *Organization) (bool, error)

func (*Client) DeletePayment added in v0.29.0

func (c *Client) DeletePayment(payment *Payment) (bool, error)

func (*Client) DeletePermission added in v0.27.0

func (c *Client) DeletePermission(permission *Permission) (bool, error)

func (*Client) DeletePlan added in v0.29.0

func (c *Client) DeletePlan(plan *Plan) (bool, error)

func (*Client) DeletePricing added in v0.29.0

func (c *Client) DeletePricing(pricing *Pricing) (bool, error)

func (*Client) DeleteProduct added in v0.29.0

func (c *Client) DeleteProduct(product *Product) (bool, error)

func (*Client) DeleteProvider added in v0.28.0

func (c *Client) DeleteProvider(provider *Provider) (bool, error)

func (*Client) DeleteResource added in v0.27.0

func (c *Client) DeleteResource(resource *Resource) (bool, error)

func (*Client) DeleteRole added in v0.27.0

func (c *Client) DeleteRole(role *Role) (bool, error)

func (*Client) DeleteSession added in v0.28.0

func (c *Client) DeleteSession(session *Session) (bool, error)

func (*Client) DeleteSubscription added in v0.29.0

func (c *Client) DeleteSubscription(subscription *Subscription) (bool, error)

func (*Client) DeleteSyncer added in v0.29.0

func (c *Client) DeleteSyncer(syncer *Syncer) (bool, error)

func (*Client) DeleteToken added in v0.27.0

func (c *Client) DeleteToken(token *Token) (bool, error)

func (*Client) DeleteUser added in v0.27.0

func (c *Client) DeleteUser(user *User) (bool, error)

func (*Client) DeleteWebhook added in v0.29.0

func (c *Client) DeleteWebhook(webhook *Webhook) (bool, error)

func (*Client) DoGetBytes added in v0.27.0

func (c *Client) DoGetBytes(url string) ([]byte, error)

DoGetBytes is a general function to get response data in bytes from param url through HTTP Get method.

func (*Client) DoGetBytesRaw added in v0.27.0

func (c *Client) DoGetBytesRaw(url string) ([]byte, error)

DoGetBytesRaw is a general function to get response from param url through HTTP Get method.

func (*Client) DoGetResponse added in v0.27.0

func (c *Client) DoGetResponse(url string) (*Response, error)

DoGetResponse is a general function to get response from param url through HTTP Get method.

func (*Client) DoPost added in v0.27.0

func (c *Client) DoPost(action string, queryMap map[string]string, postBytes []byte, isForm, isFile bool) (*Response, error)

func (*Client) DoPostBytesRaw added in v0.27.0

func (c *Client) DoPostBytesRaw(url string, contentType string, body io.Reader) ([]byte, error)

DoPostBytesRaw is a general function to post a request from url, body through HTTP Post method.

func (*Client) Enforce added in v0.27.0

func (c *Client) Enforce(permissionId, modelId, resourceId string, casbinRequest CasbinRequest) (bool, error)

func (*Client) GetAdapter added in v0.29.0

func (c *Client) GetAdapter(name string) (*Adapter, error)

func (*Client) GetAdapters added in v0.29.0

func (c *Client) GetAdapters() ([]*Adapter, error)

func (*Client) GetApplication added in v0.28.0

func (c *Client) GetApplication(name string) (*Application, error)

func (*Client) GetApplications added in v0.28.0

func (c *Client) GetApplications() ([]*Application, error)

func (*Client) GetCert added in v0.29.0

func (c *Client) GetCert(name string) (*Cert, error)

func (*Client) GetCerts added in v0.28.2

func (c *Client) GetCerts() ([]*Cert, error)

func (*Client) GetEnforcer added in v0.29.0

func (c *Client) GetEnforcer(name string) (*Enforcer, error)

func (*Client) GetEnforcers added in v0.29.0

func (c *Client) GetEnforcers() ([]*Enforcer, error)

func (*Client) GetGlobalCerts added in v0.28.2

func (c *Client) GetGlobalCerts() ([]*Cert, error)

func (*Client) GetGlobalUsers added in v0.28.0

func (c *Client) GetGlobalUsers() ([]*User, error)

func (*Client) GetGroup added in v0.29.0

func (c *Client) GetGroup(name string) (*Group, error)

func (*Client) GetGroups added in v0.29.0

func (c *Client) GetGroups() ([]*Group, error)

func (*Client) GetId added in v0.27.0

func (c *Client) GetId(name string) string

func (*Client) GetModel added in v0.29.0

func (c *Client) GetModel(name string) (*Model, error)

func (*Client) GetModels added in v0.29.0

func (c *Client) GetModels() ([]*Model, error)

func (*Client) GetMyProfileUrl added in v0.27.0

func (c *Client) GetMyProfileUrl(accessToken string) string

func (*Client) GetOAuthToken added in v0.27.0

func (c *Client) GetOAuthToken(code string, state string) (*oauth2.Token, error)

GetOAuthToken gets the pivotal and necessary secret to interact with the Casdoor server

func (*Client) GetOrganization added in v0.28.0

func (c *Client) GetOrganization(name string) (*Organization, error)

func (*Client) GetOrganizationApplications added in v0.28.4

func (c *Client) GetOrganizationApplications() ([]*Application, error)

func (*Client) GetOrganizationNames added in v0.28.0

func (c *Client) GetOrganizationNames() ([]*Organization, error)

func (*Client) GetOrganizations added in v0.28.0

func (c *Client) GetOrganizations() ([]*Organization, error)

func (*Client) GetPaginationAdapters added in v0.29.0

func (c *Client) GetPaginationAdapters(p int, pageSize int, queryMap map[string]string) ([]*Adapter, int, error)

func (*Client) GetPaginationEnforcers added in v0.29.0

func (c *Client) GetPaginationEnforcers(p int, pageSize int, queryMap map[string]string) ([]*Enforcer, int, error)

func (*Client) GetPaginationGroups added in v0.29.0

func (c *Client) GetPaginationGroups(p int, pageSize int, queryMap map[string]string) ([]*Group, int, error)

func (*Client) GetPaginationModels added in v0.29.0

func (c *Client) GetPaginationModels(p int, pageSize int, queryMap map[string]string) ([]*Model, int, error)

func (*Client) GetPaginationPayments added in v0.29.0

func (c *Client) GetPaginationPayments(p int, pageSize int, queryMap map[string]string) ([]*Payment, int, error)

func (*Client) GetPaginationPermissions added in v0.27.0

func (c *Client) GetPaginationPermissions(p int, pageSize int, queryMap map[string]string) ([]*Permission, int, error)

func (*Client) GetPaginationPlans added in v0.29.0

func (c *Client) GetPaginationPlans(p int, pageSize int, queryMap map[string]string) ([]*Plan, int, error)

func (*Client) GetPaginationPricings added in v0.29.0

func (c *Client) GetPaginationPricings(p int, pageSize int, queryMap map[string]string) ([]*Pricing, int, error)

func (*Client) GetPaginationProducts added in v0.29.0

func (c *Client) GetPaginationProducts(p int, pageSize int, queryMap map[string]string) ([]*Product, int, error)

func (*Client) GetPaginationProviders added in v0.28.0

func (c *Client) GetPaginationProviders(p int, pageSize int, queryMap map[string]string) ([]*Provider, int, error)

func (*Client) GetPaginationRecords added in v0.28.0

func (c *Client) GetPaginationRecords(p int, pageSize int, queryMap map[string]string) ([]*Record, int, error)

func (*Client) GetPaginationResources added in v0.27.0

func (c *Client) GetPaginationResources(owner, user, field, value string, pageSize, page int, sortField, sortOrder string) ([]*Resource, error)

func (*Client) GetPaginationRoles added in v0.27.0

func (c *Client) GetPaginationRoles(p int, pageSize int, queryMap map[string]string) ([]*Role, int, error)

func (*Client) GetPaginationSessions added in v0.28.0

func (c *Client) GetPaginationSessions(p int, pageSize int, queryMap map[string]string) ([]*Session, int, error)

func (*Client) GetPaginationSubscriptions added in v0.29.0

func (c *Client) GetPaginationSubscriptions(p int, pageSize int, queryMap map[string]string) ([]*Subscription, int, error)

func (*Client) GetPaginationSyncers added in v0.29.0

func (c *Client) GetPaginationSyncers(p int, pageSize int, queryMap map[string]string) ([]*Syncer, int, error)

func (*Client) GetPaginationTokens added in v0.34.0

func (c *Client) GetPaginationTokens(p int, pageSize int, queryMap map[string]string) ([]*Token, int, error)

func (*Client) GetPaginationUsers added in v0.27.0

func (c *Client) GetPaginationUsers(p int, pageSize int, queryMap map[string]string) ([]*User, int, error)

func (*Client) GetPaginationWebhooks added in v0.29.0

func (c *Client) GetPaginationWebhooks(p int, pageSize int, queryMap map[string]string) ([]*Webhook, int, error)

func (*Client) GetPayment added in v0.29.0

func (c *Client) GetPayment(name string) (*Payment, error)

func (*Client) GetPayments added in v0.29.0

func (c *Client) GetPayments() ([]*Payment, error)

func (*Client) GetPermission added in v0.27.0

func (c *Client) GetPermission(name string) (*Permission, error)

func (*Client) GetPermissions added in v0.27.0

func (c *Client) GetPermissions() ([]*Permission, error)

func (*Client) GetPermissionsByRole added in v0.27.0

func (c *Client) GetPermissionsByRole(name string) ([]*Permission, error)

func (*Client) GetPlan added in v0.29.0

func (c *Client) GetPlan(name string) (*Plan, error)

func (*Client) GetPlans added in v0.29.0

func (c *Client) GetPlans() ([]*Plan, error)

func (*Client) GetPricing added in v0.29.0

func (c *Client) GetPricing(name string) (*Pricing, error)

func (*Client) GetPricings added in v0.29.0

func (c *Client) GetPricings() ([]*Pricing, error)

func (*Client) GetProduct added in v0.29.0

func (c *Client) GetProduct(name string) (*Product, error)

func (*Client) GetProducts added in v0.29.0

func (c *Client) GetProducts() ([]*Product, error)

func (*Client) GetProvider added in v0.28.0

func (c *Client) GetProvider(name string) (*Provider, error)

func (*Client) GetProviders added in v0.28.0

func (c *Client) GetProviders() ([]*Provider, error)

func (*Client) GetRecord added in v0.28.0

func (c *Client) GetRecord(name string) (*Record, error)

func (*Client) GetRecords added in v0.28.0

func (c *Client) GetRecords() ([]*Record, error)

func (*Client) GetResource added in v0.27.0

func (c *Client) GetResource(id string) (*Resource, error)

func (*Client) GetResourceEx added in v0.27.0

func (c *Client) GetResourceEx(owner, name string) (*Resource, error)

func (*Client) GetResources added in v0.27.0

func (c *Client) GetResources(owner, user, field, value, sortField, sortOrder string) ([]*Resource, error)

func (*Client) GetRole added in v0.27.0

func (c *Client) GetRole(name string) (*Role, error)

func (*Client) GetRoles added in v0.27.0

func (c *Client) GetRoles() ([]*Role, error)

func (*Client) GetSession added in v0.28.0

func (c *Client) GetSession(name string, application string) (*Session, error)

func (*Client) GetSessions added in v0.28.0

func (c *Client) GetSessions() ([]*Session, error)

func (*Client) GetSigninUrl added in v0.27.0

func (c *Client) GetSigninUrl(redirectUri string) string

func (*Client) GetSignupUrl added in v0.27.0

func (c *Client) GetSignupUrl(enablePassword bool, redirectUri string) string

func (*Client) GetSortedUsers added in v0.27.0

func (c *Client) GetSortedUsers(sorter string, limit int) ([]*User, error)

func (*Client) GetSubscription added in v0.29.0

func (c *Client) GetSubscription(name string) (*Subscription, error)

func (*Client) GetSubscriptions added in v0.29.0

func (c *Client) GetSubscriptions() ([]*Subscription, error)

func (*Client) GetSyncer added in v0.29.0

func (c *Client) GetSyncer(name string) (*Syncer, error)

func (*Client) GetSyncers added in v0.29.0

func (c *Client) GetSyncers() ([]*Syncer, error)

func (*Client) GetToken added in v0.34.0

func (c *Client) GetToken(name string) (*Token, error)

func (*Client) GetTokens added in v0.27.0

func (c *Client) GetTokens() ([]*Token, error)

func (*Client) GetUrl added in v0.27.0

func (c *Client) GetUrl(action string, queryMap map[string]string) string

func (*Client) GetUser added in v0.27.0

func (c *Client) GetUser(name string) (*User, error)

func (*Client) GetUserByEmail added in v0.27.0

func (c *Client) GetUserByEmail(email string) (*User, error)

func (*Client) GetUserByPhone added in v0.27.0

func (c *Client) GetUserByPhone(phone string) (*User, error)

func (*Client) GetUserByUserId added in v0.27.0

func (c *Client) GetUserByUserId(userId string) (*User, error)

func (*Client) GetUserCount added in v0.27.0

func (c *Client) GetUserCount(isOnline string) (int, error)

func (*Client) GetUserPayments added in v0.29.0

func (c *Client) GetUserPayments(userName string) ([]*Payment, error)

func (*Client) GetUserProfileUrl added in v0.27.0

func (c *Client) GetUserProfileUrl(userName string, accessToken string) string

func (*Client) GetUsers added in v0.27.0

func (c *Client) GetUsers() ([]*User, error)

func (*Client) GetWebhook added in v0.29.0

func (c *Client) GetWebhook(name string) (*Webhook, error)

func (*Client) GetWebhooks added in v0.29.0

func (c *Client) GetWebhooks() ([]*Webhook, error)

func (*Client) InvoicePayment added in v0.29.0

func (c *Client) InvoicePayment(payment *Payment) (bool, error)

func (*Client) NotifyPayment added in v0.29.0

func (c *Client) NotifyPayment(payment *Payment) (bool, error)

func (*Client) ParseJwtToken added in v0.27.0

func (c *Client) ParseJwtToken(token string) (*Claims, error)

func (*Client) RefreshOAuthToken added in v0.27.0

func (c *Client) RefreshOAuthToken(refreshToken string) (*oauth2.Token, error)

RefreshOAuthToken refreshes the OAuth token

func (*Client) SendEmail added in v0.27.0

func (c *Client) SendEmail(title string, content string, sender string, receivers ...string) error

func (*Client) SendSms added in v0.27.0

func (c *Client) SendSms(content string, receivers ...string) error

func (*Client) SetPassword added in v0.27.0

func (c *Client) SetPassword(owner, name, oldPassword, newPassword string) (bool, error)

note: oldPassword is not required, if you don't need, just pass a empty string

func (*Client) UpdateAdapter added in v0.29.0

func (c *Client) UpdateAdapter(adapter *Adapter) (bool, error)

func (*Client) UpdateApplication added in v0.28.0

func (c *Client) UpdateApplication(application *Application) (bool, error)

func (*Client) UpdateCert added in v0.29.0

func (c *Client) UpdateCert(cert *Cert) (bool, error)

func (*Client) UpdateEnforcer added in v0.29.0

func (c *Client) UpdateEnforcer(enforcer *Enforcer) (bool, error)

func (*Client) UpdateGroup added in v0.29.0

func (c *Client) UpdateGroup(group *Group) (bool, error)

func (*Client) UpdateModel added in v0.29.0

func (c *Client) UpdateModel(model *Model) (bool, error)

func (*Client) UpdateOrganization added in v0.28.0

func (c *Client) UpdateOrganization(organization *Organization) (bool, error)

func (*Client) UpdatePayment added in v0.29.0

func (c *Client) UpdatePayment(payment *Payment) (bool, error)

func (*Client) UpdatePermission added in v0.27.0

func (c *Client) UpdatePermission(permission *Permission) (bool, error)

func (*Client) UpdatePermissionForColumns added in v0.27.0

func (c *Client) UpdatePermissionForColumns(permission *Permission, columns []string) (bool, error)

func (*Client) UpdatePlan added in v0.29.0

func (c *Client) UpdatePlan(plan *Plan) (bool, error)

func (*Client) UpdatePricing added in v0.29.0

func (c *Client) UpdatePricing(pricing *Pricing) (bool, error)

func (*Client) UpdateProduct added in v0.29.0

func (c *Client) UpdateProduct(product *Product) (bool, error)

func (*Client) UpdateProvider added in v0.28.0

func (c *Client) UpdateProvider(provider *Provider) (bool, error)

func (*Client) UpdateRole added in v0.27.0

func (c *Client) UpdateRole(role *Role) (bool, error)

func (*Client) UpdateRoleForColumns added in v0.27.0

func (c *Client) UpdateRoleForColumns(role *Role, columns []string) (bool, error)

func (*Client) UpdateSession added in v0.28.0

func (c *Client) UpdateSession(session *Session) (bool, error)

func (*Client) UpdateSessionForColumns added in v0.28.0

func (c *Client) UpdateSessionForColumns(session *Session, columns []string) (bool, error)

func (*Client) UpdateSubscription added in v0.29.0

func (c *Client) UpdateSubscription(subscription *Subscription) (bool, error)

func (*Client) UpdateSyncer added in v0.29.0

func (c *Client) UpdateSyncer(syncer *Syncer) (bool, error)

func (*Client) UpdateToken added in v0.34.0

func (c *Client) UpdateToken(token *Token) (bool, error)

func (*Client) UpdateTokenForColumns added in v0.34.0

func (c *Client) UpdateTokenForColumns(token *Token, columns []string) (bool, error)

func (*Client) UpdateUser added in v0.27.0

func (c *Client) UpdateUser(user *User) (bool, error)

func (*Client) UpdateUserById added in v0.27.0

func (c *Client) UpdateUserById(id string, user *User) (bool, error)

func (*Client) UpdateUserForColumns added in v0.27.0

func (c *Client) UpdateUserForColumns(user *User, columns []string) (bool, error)

func (*Client) UpdateWebhook added in v0.29.0

func (c *Client) UpdateWebhook(webhook *Webhook) (bool, error)

func (*Client) UploadResource added in v0.27.0

func (c *Client) UploadResource(user string, tag string, parent string, fullFilePath string, fileBytes []byte) (string, string, error)

func (*Client) UploadResourceEx added in v0.27.0

func (c *Client) UploadResourceEx(user string, tag string, parent string, fullFilePath string, fileBytes []byte, createdTime string, description string) (string, string, error)

type Enforcer added in v0.29.0

type Enforcer struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100) updated" json:"updatedTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Model     string `xorm:"varchar(100)" json:"model"`
	Adapter   string `xorm:"varchar(100)" json:"adapter"`
	IsEnabled bool   `json:"isEnabled"`
}

func GetEnforcer added in v0.29.0

func GetEnforcer(name string) (*Enforcer, error)

func GetEnforcers added in v0.29.0

func GetEnforcers() ([]*Enforcer, error)

func GetPaginationEnforcers added in v0.29.0

func GetPaginationEnforcers(p int, pageSize int, queryMap map[string]string) ([]*Enforcer, int, error)

type Group added in v0.29.0

type Group struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`

	DisplayName  string  `xorm:"varchar(100)" json:"displayName"`
	Manager      string  `xorm:"varchar(100)" json:"manager"`
	ContactEmail string  `xorm:"varchar(100)" json:"contactEmail"`
	Type         string  `xorm:"varchar(100)" json:"type"`
	ParentId     string  `xorm:"varchar(100)" json:"parentId"`
	IsTopGroup   bool    `xorm:"bool" json:"isTopGroup"`
	Users        []*User `xorm:"-" json:"users"`

	Title    string   `json:"title,omitempty"`
	Key      string   `json:"key,omitempty"`
	Children []*Group `json:"children,omitempty"`

	IsEnabled bool `json:"isEnabled"`
}

func GetGroup added in v0.29.0

func GetGroup(name string) (*Group, error)

func GetGroups added in v0.29.0

func GetGroups() ([]*Group, error)

func GetPaginationGroups added in v0.29.0

func GetPaginationGroups(p int, pageSize int, queryMap map[string]string) ([]*Group, int, error)

type HttpClient added in v0.20.0

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

HttpClient interface has the method required to use a type as custom http client. The net/*http.Client type satisfies this interface.

type ManagedAccount added in v0.10.0

type ManagedAccount struct {
	Application string `xorm:"varchar(100)" json:"application"`
	Username    string `xorm:"varchar(100)" json:"username"`
	Password    string `xorm:"varchar(100)" json:"password"`
	SigninUrl   string `xorm:"varchar(200)" json:"signinUrl"`
}

type MfaItem added in v0.28.0

type MfaItem struct {
	Name string `json:"name"`
	Rule string `json:"rule"`
}

type MfaProps added in v0.28.0

type MfaProps struct {
	Enabled       bool     `json:"enabled"`
	IsPreferred   bool     `json:"isPreferred"`
	MfaType       string   `json:"mfaType" form:"mfaType"`
	Secret        string   `json:"secret,omitempty"`
	CountryCode   string   `json:"countryCode,omitempty"`
	URL           string   `json:"url,omitempty"`
	RecoveryCodes []string `json:"recoveryCodes,omitempty"`
}

type Model added in v0.29.0

type Model struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`

	DisplayName  string  `xorm:"varchar(100)" json:"displayName"`
	Manager      string  `xorm:"varchar(100)" json:"manager"`
	ContactEmail string  `xorm:"varchar(100)" json:"contactEmail"`
	Type         string  `xorm:"varchar(100)" json:"type"`
	ParentId     string  `xorm:"varchar(100)" json:"parentId"`
	IsTopModel   bool    `xorm:"bool" json:"isTopModel"`
	Users        []*User `xorm:"-" json:"users"`

	Title    string   `json:"title,omitempty"`
	Key      string   `json:"key,omitempty"`
	Children []*Model `json:"children,omitempty"`

	ModelText string `xorm:"mediumtext" json:"modelText"`
	IsEnabled bool   `json:"isEnabled"`
}

func GetModel added in v0.29.0

func GetModel(name string) (*Model, error)

func GetModels added in v0.29.0

func GetModels() ([]*Model, error)

func GetPaginationModels added in v0.29.0

func GetPaginationModels(p int, pageSize int, queryMap map[string]string) ([]*Model, int, error)

type Organization

type Organization struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName        string     `xorm:"varchar(100)" json:"displayName"`
	WebsiteUrl         string     `xorm:"varchar(100)" json:"websiteUrl"`
	Favicon            string     `xorm:"varchar(100)" json:"favicon"`
	PasswordType       string     `xorm:"varchar(100)" json:"passwordType"`
	PasswordSalt       string     `xorm:"varchar(100)" json:"passwordSalt"`
	PasswordOptions    []string   `xorm:"varchar(100)" json:"passwordOptions"`
	CountryCodes       []string   `xorm:"varchar(200)"  json:"countryCodes"`
	DefaultAvatar      string     `xorm:"varchar(200)" json:"defaultAvatar"`
	DefaultApplication string     `xorm:"varchar(100)" json:"defaultApplication"`
	Tags               []string   `xorm:"mediumtext" json:"tags"`
	Languages          []string   `xorm:"varchar(255)" json:"languages"`
	ThemeData          *ThemeData `xorm:"json" json:"themeData"`
	MasterPassword     string     `xorm:"varchar(100)" json:"masterPassword"`
	InitScore          int        `json:"initScore"`
	EnableSoftDeletion bool       `json:"enableSoftDeletion"`
	IsProfilePublic    bool       `json:"isProfilePublic"`

	MfaItems     []*MfaItem     `xorm:"varchar(300)" json:"mfaItems"`
	AccountItems []*AccountItem `xorm:"varchar(5000)" json:"accountItems"`
}

Organization has the same definition as https://github.com/casdoor/casdoor/blob/master/object/organization.go#L25

func GetOrganization added in v0.28.0

func GetOrganization(name string) (*Organization, error)

func GetOrganizationNames added in v0.28.0

func GetOrganizationNames() ([]*Organization, error)

func GetOrganizations added in v0.28.0

func GetOrganizations() ([]*Organization, error)

type Payment added in v0.29.0

type Payment struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	// Payment Provider Info
	Provider string `xorm:"varchar(100)" json:"provider"`
	Type     string `xorm:"varchar(100)" json:"type"`
	// Product Info
	ProductName        string  `xorm:"varchar(100)" json:"productName"`
	ProductDisplayName string  `xorm:"varchar(100)" json:"productDisplayName"`
	Detail             string  `xorm:"varchar(255)" json:"detail"`
	Tag                string  `xorm:"varchar(100)" json:"tag"`
	Currency           string  `xorm:"varchar(100)" json:"currency"`
	Price              float64 `json:"price"`
	ReturnUrl          string  `xorm:"varchar(1000)" json:"returnUrl"`
	// Payer Info
	User         string `xorm:"varchar(100)" json:"user"`
	PersonName   string `xorm:"varchar(100)" json:"personName"`
	PersonIdCard string `xorm:"varchar(100)" json:"personIdCard"`
	PersonEmail  string `xorm:"varchar(100)" json:"personEmail"`
	PersonPhone  string `xorm:"varchar(100)" json:"personPhone"`
	// Invoice Info
	InvoiceType   string `xorm:"varchar(100)" json:"invoiceType"`
	InvoiceTitle  string `xorm:"varchar(100)" json:"invoiceTitle"`
	InvoiceTaxId  string `xorm:"varchar(100)" json:"invoiceTaxId"`
	InvoiceRemark string `xorm:"varchar(100)" json:"invoiceRemark"`
	InvoiceUrl    string `xorm:"varchar(255)" json:"invoiceUrl"`
	// Order Info
	OutOrderId string `xorm:"varchar(100)" json:"outOrderId"`
	PayUrl     string `xorm:"varchar(2000)" json:"payUrl"`
	// State      pp.PaymentState `xorm:"varchaFr(100)" json:"state"`
	State   string `xorm:"varchar(100)" json:"state"`
	Message string `xorm:"varchar(2000)" json:"message"`
}

func GetPaginationPayments added in v0.29.0

func GetPaginationPayments(p int, pageSize int, queryMap map[string]string) ([]*Payment, int, error)

func GetPayment added in v0.29.0

func GetPayment(name string) (*Payment, error)

func GetPayments added in v0.29.0

func GetPayments() ([]*Payment, error)

func GetUserPayments added in v0.29.0

func GetUserPayments(userName string) ([]*Payment, error)

type Permission

type Permission struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Users   []string `xorm:"mediumtext" json:"users"`
	Groups  []string `xorm:"mediumtext" json:"groups"`
	Roles   []string `xorm:"mediumtext" json:"roles"`
	Domains []string `xorm:"mediumtext" json:"domains"`

	Model        string   `xorm:"varchar(100)" json:"model"`
	Adapter      string   `xorm:"varchar(100)" json:"adapter"`
	ResourceType string   `xorm:"varchar(100)" json:"resourceType"`
	Resources    []string `xorm:"mediumtext" json:"resources"`
	Actions      []string `xorm:"mediumtext" json:"actions"`
	Effect       string   `xorm:"varchar(100)" json:"effect"`
	IsEnabled    bool     `json:"isEnabled"`

	Submitter   string `xorm:"varchar(100)" json:"submitter"`
	Approver    string `xorm:"varchar(100)" json:"approver"`
	ApproveTime string `xorm:"varchar(100)" json:"approveTime"`
	State       string `xorm:"varchar(100)" json:"state"`
}

func GetPaginationPermissions added in v0.12.0

func GetPaginationPermissions(p int, pageSize int, queryMap map[string]string) ([]*Permission, int, error)

func GetPermission

func GetPermission(name string) (*Permission, error)

func GetPermissions added in v0.11.0

func GetPermissions() ([]*Permission, error)

func GetPermissionsByRole added in v0.15.0

func GetPermissionsByRole(name string) ([]*Permission, error)

type PermissionRule added in v0.17.0

type PermissionRule struct {
	Ptype string `xorm:"varchar(100) index not null default ''" json:"ptype"`
	V0    string `xorm:"varchar(100) index not null default ''" json:"v0"`
	V1    string `xorm:"varchar(100) index not null default ''" json:"v1"`
	V2    string `xorm:"varchar(100) index not null default ''" json:"v2"`
	V3    string `xorm:"varchar(100) index not null default ''" json:"v3"`
	V4    string `xorm:"varchar(100) index not null default ''" json:"v4"`
	V5    string `xorm:"varchar(100) index not null default ''" json:"v5"`
	Id    string `xorm:"varchar(100) index not null default ''" json:"id"`
}

type Plan added in v0.29.0

type Plan struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	PricePerMonth float64 `json:"pricePerMonth"`
	PricePerYear  float64 `json:"pricePerYear"`
	Currency      string  `xorm:"varchar(100)" json:"currency"`
	IsEnabled     bool    `json:"isEnabled"`

	Role    string   `xorm:"varchar(100)" json:"role"`
	Options []string `xorm:"-" json:"options"`
}

Plan has the same definition as https://github.com/casdoor/casdoor/blob/master/object/plan.go#L24

func GetPaginationPlans added in v0.29.0

func GetPaginationPlans(p int, pageSize int, queryMap map[string]string) ([]*Plan, int, error)

func GetPlan added in v0.29.0

func GetPlan(name string) (*Plan, error)

func GetPlans added in v0.29.0

func GetPlans() ([]*Plan, error)

type Pricing added in v0.29.0

type Pricing struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Plans         []string `xorm:"mediumtext" json:"plans"`
	IsEnabled     bool     `json:"isEnabled"`
	TrialDuration int      `json:"trialDuration"`
	Application   string   `xorm:"varchar(100)" json:"application"`

	Submitter   string `xorm:"varchar(100)" json:"submitter"`
	Approver    string `xorm:"varchar(100)" json:"approver"`
	ApproveTime string `xorm:"varchar(100)" json:"approveTime"`

	State string `xorm:"varchar(100)" json:"state"`
}

Pricing has the same definition as https://github.com/casdoor/casdoor/blob/master/object/pricing.go#L24

func GetPaginationPricings added in v0.29.0

func GetPaginationPricings(p int, pageSize int, queryMap map[string]string) ([]*Pricing, int, error)

func GetPricing added in v0.29.0

func GetPricing(name string) (*Pricing, error)

func GetPricings added in v0.29.0

func GetPricings() ([]*Pricing, error)

type Product added in v0.29.0

type Product struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	Image       string   `xorm:"varchar(100)" json:"image"`
	Detail      string   `xorm:"varchar(255)" json:"detail"`
	Description string   `xorm:"varchar(100)" json:"description"`
	Tag         string   `xorm:"varchar(100)" json:"tag"`
	Currency    string   `xorm:"varchar(100)" json:"currency"`
	Price       float64  `json:"price"`
	Quantity    int      `json:"quantity"`
	Sold        int      `json:"sold"`
	Providers   []string `xorm:"varchar(100)" json:"providers"`
	ReturnUrl   string   `xorm:"varchar(1000)" json:"returnUrl"`

	State string `xorm:"varchar(100)" json:"state"`

	ProviderObjs []*Provider `xorm:"-" json:"providerObjs"`
}

func BuyProduct added in v0.29.0

func BuyProduct(name string, providerName string) (*Product, error)

func GetPaginationProducts added in v0.29.0

func GetPaginationProducts(p int, pageSize int, queryMap map[string]string) ([]*Product, int, error)

func GetProduct added in v0.29.0

func GetProduct(name string) (*Product, error)

func GetProducts added in v0.29.0

func GetProducts() ([]*Product, error)

type Provider added in v0.10.0

type Provider struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk unique" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	DisplayName       string            `xorm:"varchar(100)" json:"displayName"`
	Category          string            `xorm:"varchar(100)" json:"category"`
	Type              string            `xorm:"varchar(100)" json:"type"`
	SubType           string            `xorm:"varchar(100)" json:"subType"`
	Method            string            `xorm:"varchar(100)" json:"method"`
	ClientId          string            `xorm:"varchar(100)" json:"clientId"`
	ClientSecret      string            `xorm:"varchar(2000)" json:"clientSecret"`
	ClientId2         string            `xorm:"varchar(100)" json:"clientId2"`
	ClientSecret2     string            `xorm:"varchar(100)" json:"clientSecret2"`
	Cert              string            `xorm:"varchar(100)" json:"cert"`
	CustomAuthUrl     string            `xorm:"varchar(200)" json:"customAuthUrl"`
	CustomTokenUrl    string            `xorm:"varchar(200)" json:"customTokenUrl"`
	CustomUserInfoUrl string            `xorm:"varchar(200)" json:"customUserInfoUrl"`
	Scopes            string            `xorm:"varchar(100)" json:"scopes"`
	UserMapping       map[string]string `xorm:"varchar(500)" json:"userMapping"`

	Host       string `xorm:"varchar(100)" json:"host"`
	Port       int    `json:"port"`
	DisableSsl bool   `json:"disableSsl"` // If the provider type is WeChat, DisableSsl means EnableQRCode
	Title      string `xorm:"varchar(100)" json:"title"`
	Content    string `xorm:"varchar(1000)" json:"content"` // If provider type is WeChat, Content means QRCode string by Base64 encoding
	Receiver   string `xorm:"varchar(100)" json:"receiver"`

	RegionId     string `xorm:"varchar(100)" json:"regionId"`
	SignName     string `xorm:"varchar(100)" json:"signName"`
	TemplateCode string `xorm:"varchar(100)" json:"templateCode"`
	AppId        string `xorm:"varchar(100)" json:"appId"`

	Endpoint         string `xorm:"varchar(1000)" json:"endpoint"`
	IntranetEndpoint string `xorm:"varchar(100)" json:"intranetEndpoint"`
	Domain           string `xorm:"varchar(100)" json:"domain"`
	Bucket           string `xorm:"varchar(100)" json:"bucket"`
	PathPrefix       string `xorm:"varchar(100)" json:"pathPrefix"`

	Metadata               string `xorm:"mediumtext" json:"metadata"`
	IdP                    string `xorm:"mediumtext" json:"idP"`
	IssuerUrl              string `xorm:"varchar(100)" json:"issuerUrl"`
	EnableSignAuthnRequest bool   `json:"enableSignAuthnRequest"`

	ProviderUrl string `xorm:"varchar(200)" json:"providerUrl"`
}

func GetPaginationProviders added in v0.28.0

func GetPaginationProviders(p int, pageSize int, queryMap map[string]string) ([]*Provider, int, error)

func GetProvider added in v0.28.0

func GetProvider(name string) (*Provider, error)

func GetProviders added in v0.28.0

func GetProviders() ([]*Provider, error)

type ProviderItem added in v0.10.0

type ProviderItem struct {
	Owner string `json:"owner"`
	Name  string `json:"name"`

	CanSignUp bool      `json:"canSignUp"`
	CanSignIn bool      `json:"canSignIn"`
	CanUnlink bool      `json:"canUnlink"`
	Prompted  bool      `json:"prompted"`
	AlertType string    `json:"alertType"`
	Rule      string    `json:"rule"`
	Provider  *Provider `json:"provider"`
}

type Record added in v0.9.1

type Record struct {
	Id int `xorm:"int notnull pk autoincr" json:"id"`

	Owner       string `xorm:"varchar(100) index" json:"owner"`
	Name        string `xorm:"varchar(100) index" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	ClientIp     string `xorm:"varchar(100)" json:"clientIp"`
	User         string `xorm:"varchar(100)" json:"user"`
	Method       string `xorm:"varchar(100)" json:"method"`
	RequestUri   string `xorm:"varchar(1000)" json:"requestUri"`
	Action       string `xorm:"varchar(1000)" json:"action"`

	Object       string `xorm:"-" json:"object"`
	ExtendedUser *User  `xorm:"-" json:"extendedUser"`

	IsTriggered bool `json:"isTriggered"`
}

func GetPaginationRecords added in v0.28.0

func GetPaginationRecords(p int, pageSize int, queryMap map[string]string) ([]*Record, int, error)

func GetRecord added in v0.28.0

func GetRecord(name string) (*Record, error)

func GetRecords added in v0.28.0

func GetRecords() ([]*Record, error)

type Resource

type Resource struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(180) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	User        string `xorm:"varchar(100)" json:"user"`
	Provider    string `xorm:"varchar(100)" json:"provider"`
	Application string `xorm:"varchar(100)" json:"application"`
	Tag         string `xorm:"varchar(100)" json:"tag"`
	Parent      string `xorm:"varchar(100)" json:"parent"`
	FileName    string `xorm:"varchar(255)" json:"fileName"`
	FileType    string `xorm:"varchar(100)" json:"fileType"`
	FileFormat  string `xorm:"varchar(100)" json:"fileFormat"`
	FileSize    int    `json:"fileSize"`
	Url         string `xorm:"varchar(255)" json:"url"`
	Description string `xorm:"varchar(255)" json:"description"`
}

Resource has the same definition as https://github.com/casdoor/casdoor/blob/master/object/resource.go#L24

func GetPaginationResources added in v0.25.0

func GetPaginationResources(owner, user, field, value string, pageSize, page int, sortField, sortOrder string) ([]*Resource, error)

func GetResource added in v0.25.0

func GetResource(id string) (*Resource, error)

func GetResourceEx added in v0.25.0

func GetResourceEx(owner, name string) (*Resource, error)

func GetResources added in v0.25.0

func GetResources(owner, user, field, value, sortField, sortOrder string) ([]*Resource, error)

type Response

type Response struct {
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
	Data2  interface{} `json:"data2"`
}

func DoGetResponse added in v0.12.0

func DoGetResponse(url string) (*Response, error)

DoGetResponse is a general function to get response from param url through HTTP Get method.

func DoPost added in v0.9.0

func DoPost(action string, queryMap map[string]string, postBytes []byte, isForm, isFile bool) (*Response, error)

type Role added in v0.8.0

type Role struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`
	Description string `xorm:"varchar(100)" json:"description"`

	Users     []string `xorm:"mediumtext" json:"users"`
	Roles     []string `xorm:"mediumtext" json:"roles"`
	Domains   []string `xorm:"mediumtext" json:"domains"`
	IsEnabled bool     `json:"isEnabled"`
}

Role has the same definition as https://github.com/casdoor/casdoor/blob/master/object/role.go#L24

func GetPaginationRoles added in v0.13.0

func GetPaginationRoles(p int, pageSize int, queryMap map[string]string) ([]*Role, int, error)

func GetRole added in v0.13.0

func GetRole(name string) (*Role, error)

func GetRoles added in v0.13.0

func GetRoles() ([]*Role, error)

type Session added in v0.28.0

type Session struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	Application string `xorm:"varchar(100) notnull pk" json:"application"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	SessionId []string `json:"sessionId"`
}

func GetPaginationSessions added in v0.28.0

func GetPaginationSessions(p int, pageSize int, queryMap map[string]string) ([]*Session, int, error)

func GetSession added in v0.28.0

func GetSession(name string, application string) (*Session, error)

func GetSessions added in v0.28.0

func GetSessions() ([]*Session, error)

type SignupItem added in v0.10.0

type SignupItem struct {
	Name     string `json:"name"`
	Visible  bool   `json:"visible"`
	Required bool   `json:"required"`
	Prompted bool   `json:"prompted"`
	Rule     string `json:"rule"`
}

type Subscription added in v0.29.0

type Subscription struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
	DisplayName string `xorm:"varchar(100)" json:"displayName"`

	StartDate   time.Time `json:"startDate"`
	EndDate     time.Time `json:"endDate"`
	Duration    int       `json:"duration"`
	Description string    `xorm:"varchar(100)" json:"description"`

	User string `xorm:"mediumtext" json:"user"`
	Plan string `xorm:"varchar(100)" json:"plan"`

	IsEnabled   bool   `json:"isEnabled"`
	Submitter   string `xorm:"varchar(100)" json:"submitter"`
	Approver    string `xorm:"varchar(100)" json:"approver"`
	ApproveTime string `xorm:"varchar(100)" json:"approveTime"`

	State string `xorm:"varchar(100)" json:"state"`
}

Subscription has the same definition as https://github.com/casdoor/casdoor/blob/master/object/subscription.go#L24

func GetPaginationSubscriptions added in v0.29.0

func GetPaginationSubscriptions(p int, pageSize int, queryMap map[string]string) ([]*Subscription, int, error)

func GetSubscription added in v0.29.0

func GetSubscription(name string) (*Subscription, error)

func GetSubscriptions added in v0.29.0

func GetSubscriptions() ([]*Subscription, error)

type Syncer added in v0.29.0

type Syncer struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	Type         string `xorm:"varchar(100)" json:"type"`

	Host             string         `xorm:"varchar(100)" json:"host"`
	Port             int            `json:"port"`
	User             string         `xorm:"varchar(100)" json:"user"`
	Password         string         `xorm:"varchar(100)" json:"password"`
	DatabaseType     string         `xorm:"varchar(100)" json:"databaseType"`
	Database         string         `xorm:"varchar(100)" json:"database"`
	Table            string         `xorm:"varchar(100)" json:"table"`
	TablePrimaryKey  string         `xorm:"varchar(100)" json:"tablePrimaryKey"`
	TableColumns     []*TableColumn `xorm:"mediumtext" json:"tableColumns"`
	AffiliationTable string         `xorm:"varchar(100)" json:"affiliationTable"`
	AvatarBaseUrl    string         `xorm:"varchar(100)" json:"avatarBaseUrl"`
	ErrorText        string         `xorm:"mediumtext" json:"errorText"`
	SyncInterval     int            `json:"syncInterval"`
	IsReadOnly       bool           `json:"isReadOnly"`
	IsEnabled        bool           `json:"isEnabled"`
}

Syncer has the same definition as https://github.com/casdoor/casdoor/blob/master/object/syncer.go#L24

func GetPaginationSyncers added in v0.29.0

func GetPaginationSyncers(p int, pageSize int, queryMap map[string]string) ([]*Syncer, int, error)

func GetSyncer added in v0.29.0

func GetSyncer(name string) (*Syncer, error)

func GetSyncers added in v0.29.0

func GetSyncers() ([]*Syncer, error)

type TableColumn added in v0.29.0

type TableColumn struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	CasdoorName string   `json:"casdoorName"`
	IsKey       bool     `json:"isKey"`
	IsHashed    bool     `json:"isHashed"`
	Values      []string `json:"values"`
}

type ThemeData added in v0.28.0

type ThemeData struct {
	ThemeType    string `xorm:"varchar(30)" json:"themeType"`
	ColorPrimary string `xorm:"varchar(10)" json:"colorPrimary"`
	BorderRadius int    `xorm:"int" json:"borderRadius"`
	IsCompact    bool   `xorm:"bool" json:"isCompact"`
	IsEnabled    bool   `xorm:"bool" json:"isEnabled"`
}

type Token added in v0.21.0

type Token struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Application  string `xorm:"varchar(100)" json:"application"`
	Organization string `xorm:"varchar(100)" json:"organization"`
	User         string `xorm:"varchar(100)" json:"user"`

	Code          string `xorm:"varchar(100) index" json:"code"`
	AccessToken   string `xorm:"mediumtext" json:"accessToken"`
	RefreshToken  string `xorm:"mediumtext" json:"refreshToken"`
	ExpiresIn     int    `json:"expiresIn"`
	Scope         string `xorm:"varchar(100)" json:"scope"`
	TokenType     string `xorm:"varchar(100)" json:"tokenType"`
	CodeChallenge string `xorm:"varchar(100)" json:"codeChallenge"`
	CodeIsUsed    bool   `json:"codeIsUsed"`
	CodeExpireIn  int64  `json:"codeExpireIn"`
}

Token has the same definition as https://github.com/casdoor/casdoor/blob/master/object/token.go#L45

func GetPaginationTokens added in v0.34.0

func GetPaginationTokens(p int, pageSize int, queryMap map[string]string) ([]*Token, int, error)

func GetToken added in v0.34.0

func GetToken(name string) (*Token, error)

func GetTokens added in v0.21.0

func GetTokens() ([]*Token, error)

type User

type User struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100) index" json:"createdTime"`
	UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`

	Id                string   `xorm:"varchar(100) index" json:"id"`
	Type              string   `xorm:"varchar(100)" json:"type"`
	Password          string   `xorm:"varchar(100)" json:"password"`
	PasswordSalt      string   `xorm:"varchar(100)" json:"passwordSalt"`
	PasswordType      string   `xorm:"varchar(100)" json:"passwordType"`
	DisplayName       string   `xorm:"varchar(100)" json:"displayName"`
	FirstName         string   `xorm:"varchar(100)" json:"firstName"`
	LastName          string   `xorm:"varchar(100)" json:"lastName"`
	Avatar            string   `xorm:"varchar(500)" json:"avatar"`
	AvatarType        string   `xorm:"varchar(100)" json:"avatarType"`
	PermanentAvatar   string   `xorm:"varchar(500)" json:"permanentAvatar"`
	Email             string   `xorm:"varchar(100) index" json:"email"`
	EmailVerified     bool     `json:"emailVerified"`
	Phone             string   `xorm:"varchar(20) index" json:"phone"`
	CountryCode       string   `xorm:"varchar(6)" json:"countryCode"`
	Region            string   `xorm:"varchar(100)" json:"region"`
	Location          string   `xorm:"varchar(100)" json:"location"`
	Address           []string `json:"address"`
	Affiliation       string   `xorm:"varchar(100)" json:"affiliation"`
	Title             string   `xorm:"varchar(100)" json:"title"`
	IdCardType        string   `xorm:"varchar(100)" json:"idCardType"`
	IdCard            string   `xorm:"varchar(100) index" json:"idCard"`
	Homepage          string   `xorm:"varchar(100)" json:"homepage"`
	Bio               string   `xorm:"varchar(100)" json:"bio"`
	Tag               string   `xorm:"varchar(100)" json:"tag"`
	Language          string   `xorm:"varchar(100)" json:"language"`
	Gender            string   `xorm:"varchar(100)" json:"gender"`
	Birthday          string   `xorm:"varchar(100)" json:"birthday"`
	Education         string   `xorm:"varchar(100)" json:"education"`
	Score             int      `json:"score"`
	Karma             int      `json:"karma"`
	Ranking           int      `json:"ranking"`
	IsDefaultAvatar   bool     `json:"isDefaultAvatar"`
	IsOnline          bool     `json:"isOnline"`
	IsAdmin           bool     `json:"isAdmin"`
	IsForbidden       bool     `json:"isForbidden"`
	IsDeleted         bool     `json:"isDeleted"`
	SignupApplication string   `xorm:"varchar(100)" json:"signupApplication"`
	Hash              string   `xorm:"varchar(100)" json:"hash"`
	PreHash           string   `xorm:"varchar(100)" json:"preHash"`
	AccessKey         string   `xorm:"varchar(100)" json:"accessKey"`
	AccessSecret      string   `xorm:"varchar(100)" json:"accessSecret"`

	CreatedIp      string `xorm:"varchar(100)" json:"createdIp"`
	LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"`
	LastSigninIp   string `xorm:"varchar(100)" json:"lastSigninIp"`

	GitHub          string `xorm:"github varchar(100)" json:"github"`
	Google          string `xorm:"varchar(100)" json:"google"`
	QQ              string `xorm:"qq varchar(100)" json:"qq"`
	WeChat          string `xorm:"wechat varchar(100)" json:"wechat"`
	Facebook        string `xorm:"facebook varchar(100)" json:"facebook"`
	DingTalk        string `xorm:"dingtalk varchar(100)" json:"dingtalk"`
	Weibo           string `xorm:"weibo varchar(100)" json:"weibo"`
	Gitee           string `xorm:"gitee varchar(100)" json:"gitee"`
	LinkedIn        string `xorm:"linkedin varchar(100)" json:"linkedin"`
	Wecom           string `xorm:"wecom varchar(100)" json:"wecom"`
	Lark            string `xorm:"lark varchar(100)" json:"lark"`
	Gitlab          string `xorm:"gitlab varchar(100)" json:"gitlab"`
	Adfs            string `xorm:"adfs varchar(100)" json:"adfs"`
	Baidu           string `xorm:"baidu varchar(100)" json:"baidu"`
	Alipay          string `xorm:"alipay varchar(100)" json:"alipay"`
	Casdoor         string `xorm:"casdoor varchar(100)" json:"casdoor"`
	Infoflow        string `xorm:"infoflow varchar(100)" json:"infoflow"`
	Apple           string `xorm:"apple varchar(100)" json:"apple"`
	AzureAD         string `xorm:"azuread varchar(100)" json:"azuread"`
	Slack           string `xorm:"slack varchar(100)" json:"slack"`
	Steam           string `xorm:"steam varchar(100)" json:"steam"`
	Bilibili        string `xorm:"bilibili varchar(100)" json:"bilibili"`
	Okta            string `xorm:"okta varchar(100)" json:"okta"`
	Douyin          string `xorm:"douyin varchar(100)" json:"douyin"`
	Line            string `xorm:"line varchar(100)" json:"line"`
	Amazon          string `xorm:"amazon varchar(100)" json:"amazon"`
	Auth0           string `xorm:"auth0 varchar(100)" json:"auth0"`
	BattleNet       string `xorm:"battlenet varchar(100)" json:"battlenet"`
	Bitbucket       string `xorm:"bitbucket varchar(100)" json:"bitbucket"`
	Box             string `xorm:"box varchar(100)" json:"box"`
	CloudFoundry    string `xorm:"cloudfoundry varchar(100)" json:"cloudfoundry"`
	Dailymotion     string `xorm:"dailymotion varchar(100)" json:"dailymotion"`
	Deezer          string `xorm:"deezer varchar(100)" json:"deezer"`
	DigitalOcean    string `xorm:"digitalocean varchar(100)" json:"digitalocean"`
	Discord         string `xorm:"discord varchar(100)" json:"discord"`
	Dropbox         string `xorm:"dropbox varchar(100)" json:"dropbox"`
	EveOnline       string `xorm:"eveonline varchar(100)" json:"eveonline"`
	Fitbit          string `xorm:"fitbit varchar(100)" json:"fitbit"`
	Gitea           string `xorm:"gitea varchar(100)" json:"gitea"`
	Heroku          string `xorm:"heroku varchar(100)" json:"heroku"`
	InfluxCloud     string `xorm:"influxcloud varchar(100)" json:"influxcloud"`
	Instagram       string `xorm:"instagram varchar(100)" json:"instagram"`
	Intercom        string `xorm:"intercom varchar(100)" json:"intercom"`
	Kakao           string `xorm:"kakao varchar(100)" json:"kakao"`
	Lastfm          string `xorm:"lastfm varchar(100)" json:"lastfm"`
	Mailru          string `xorm:"mailru varchar(100)" json:"mailru"`
	Meetup          string `xorm:"meetup varchar(100)" json:"meetup"`
	MicrosoftOnline string `xorm:"microsoftonline varchar(100)" json:"microsoftonline"`
	Naver           string `xorm:"naver varchar(100)" json:"naver"`
	Nextcloud       string `xorm:"nextcloud varchar(100)" json:"nextcloud"`
	OneDrive        string `xorm:"onedrive varchar(100)" json:"onedrive"`
	Oura            string `xorm:"oura varchar(100)" json:"oura"`
	Patreon         string `xorm:"patreon varchar(100)" json:"patreon"`
	Paypal          string `xorm:"paypal varchar(100)" json:"paypal"`
	SalesForce      string `xorm:"salesforce varchar(100)" json:"salesforce"`
	Shopify         string `xorm:"shopify varchar(100)" json:"shopify"`
	Soundcloud      string `xorm:"soundcloud varchar(100)" json:"soundcloud"`
	Spotify         string `xorm:"spotify varchar(100)" json:"spotify"`
	Strava          string `xorm:"strava varchar(100)" json:"strava"`
	Stripe          string `xorm:"stripe varchar(100)" json:"stripe"`
	TikTok          string `xorm:"tiktok varchar(100)" json:"tiktok"`
	Tumblr          string `xorm:"tumblr varchar(100)" json:"tumblr"`
	Twitch          string `xorm:"twitch varchar(100)" json:"twitch"`
	Twitter         string `xorm:"twitter varchar(100)" json:"twitter"`
	Typetalk        string `xorm:"typetalk varchar(100)" json:"typetalk"`
	Uber            string `xorm:"uber varchar(100)" json:"uber"`
	VK              string `xorm:"vk varchar(100)" json:"vk"`
	Wepay           string `xorm:"wepay varchar(100)" json:"wepay"`
	Xero            string `xorm:"xero varchar(100)" json:"xero"`
	Yahoo           string `xorm:"yahoo varchar(100)" json:"yahoo"`
	Yammer          string `xorm:"yammer varchar(100)" json:"yammer"`
	Yandex          string `xorm:"yandex varchar(100)" json:"yandex"`
	Zoom            string `xorm:"zoom varchar(100)" json:"zoom"`
	MetaMask        string `xorm:"metamask varchar(100)" json:"metamask"`
	Web3Onboard     string `xorm:"web3onboard varchar(100)" json:"web3onboard"`
	Custom          string `xorm:"custom varchar(100)" json:"custom"`

	// WebauthnCredentials []webauthn.Credential `xorm:"webauthnCredentials blob" json:"webauthnCredentials"`
	PreferredMfaType string   `xorm:"varchar(100)" json:"preferredMfaType"`
	RecoveryCodes    []string `xorm:"varchar(1000)" json:"recoveryCodes"`
	TotpSecret       string   `xorm:"varchar(100)" json:"totpSecret"`
	MfaPhoneEnabled  bool     `json:"mfaPhoneEnabled"`
	MfaEmailEnabled  bool     `json:"mfaEmailEnabled"`

	Ldap       string            `xorm:"ldap varchar(100)" json:"ldap"`
	Properties map[string]string `json:"properties"`

	Roles       []*Role       `json:"roles"`
	Permissions []*Permission `json:"permissions"`
	Groups      []string      `xorm:"groups varchar(1000)" json:"groups"`

	LastSigninWrongTime string `xorm:"varchar(100)" json:"lastSigninWrongTime"`
	SigninWrongTimes    int    `json:"signinWrongTimes"`

	ManagedAccounts []ManagedAccount `xorm:"managedAccounts blob" json:"managedAccounts"`
}

User has the same definition as https://github.com/casdoor/casdoor/blob/master/object/user.go#L24

func GetGlobalUsers added in v0.28.0

func GetGlobalUsers() ([]*User, error)

func GetPaginationUsers added in v0.16.0

func GetPaginationUsers(p int, pageSize int, queryMap map[string]string) ([]*User, int, error)

func GetSortedUsers

func GetSortedUsers(sorter string, limit int) ([]*User, error)

func GetUser

func GetUser(name string) (*User, error)

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

func GetUserByPhone added in v0.7.0

func GetUserByPhone(phone string) (*User, error)

func GetUserByUserId

func GetUserByUserId(userId string) (*User, error)

func GetUsers

func GetUsers() ([]*User, error)

func (User) GetId added in v0.18.0

func (u User) GetId() string

type Userinfo added in v0.28.0

type Userinfo struct {
	Sub         string   `json:"sub"`
	Iss         string   `json:"iss"`
	Aud         string   `json:"aud"`
	Name        string   `json:"preferred_username,omitempty"`
	DisplayName string   `json:"name,omitempty"`
	Email       string   `json:"email,omitempty"`
	Avatar      string   `json:"picture,omitempty"`
	Address     string   `json:"address,omitempty"`
	Phone       string   `json:"phone,omitempty"`
	Groups      []string `json:"groups,omitempty"`
}

type Webhook added in v0.29.0

type Webhook struct {
	Owner       string `xorm:"varchar(100) notnull pk" json:"owner"`
	Name        string `xorm:"varchar(100) notnull pk" json:"name"`
	CreatedTime string `xorm:"varchar(100)" json:"createdTime"`

	Organization string `xorm:"varchar(100)" json:"organization"`
	Type         string `xorm:"varchar(100)" json:"type"`

	Host             string         `xorm:"varchar(100)" json:"host"`
	Port             int            `json:"port"`
	User             string         `xorm:"varchar(100)" json:"user"`
	Password         string         `xorm:"varchar(100)" json:"password"`
	DatabaseType     string         `xorm:"varchar(100)" json:"databaseType"`
	Database         string         `xorm:"varchar(100)" json:"database"`
	Table            string         `xorm:"varchar(100)" json:"table"`
	TablePrimaryKey  string         `xorm:"varchar(100)" json:"tablePrimaryKey"`
	TableColumns     []*TableColumn `xorm:"mediumtext" json:"tableColumns"`
	AffiliationTable string         `xorm:"varchar(100)" json:"affiliationTable"`
	AvatarBaseUrl    string         `xorm:"varchar(100)" json:"avatarBaseUrl"`
	ErrorText        string         `xorm:"mediumtext" json:"errorText"`
	SyncInterval     int            `json:"syncInterval"`
	IsReadOnly       bool           `json:"isReadOnly"`
	IsEnabled        bool           `json:"isEnabled"`
}

Webhook has the same definition as https://github.com/casdoor/casdoor/blob/master/object/webhook.go#L24

func GetPaginationWebhooks added in v0.29.0

func GetPaginationWebhooks(p int, pageSize int, queryMap map[string]string) ([]*Webhook, int, error)

func GetWebhook added in v0.29.0

func GetWebhook(name string) (*Webhook, error)

func GetWebhooks added in v0.29.0

func GetWebhooks() ([]*Webhook, error)

Jump to

Keyboard shortcuts

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