Documentation
¶
Overview ¶
Package loginmodule provides functions related to user login.
Index ¶
- func Encode(data []byte, clientKey string) string
- func EncodeBody(requestParams map[string]string, clientID, clientKey string) (result []byte, err error)
- type Client
- func (client *Client) CreateUsers(ctx context.Context, clientID, clientKey string, params *CreateUsersParams) (bool, []CreateUsersResponseDataRow, error)
- func (client *Client) DeleteUsers(ctx context.Context, clientID, clientKey, loginPrefix string) (bool, error)
- func (client *Client) GetUserProfile(ctx context.Context, accessToken string) (profile *UserProfile, err error)
- func (client *Client) SendLTIResult(ctx context.Context, clientID, clientKey string, userLoginID, itemID int64, ...) (bool, error)
- func (client *Client) UnlinkClient(ctx context.Context, clientID, clientKey string, userLoginID int64) (bool, error)
- type CreateUsersParams
- type CreateUsersResponseDataRow
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is the login module client.
func (*Client) CreateUsers ¶
func (client *Client) CreateUsers(ctx context.Context, clientID, clientKey string, params *CreateUsersParams, ) (bool, []CreateUsersResponseDataRow, error)
CreateUsers creates a batch of users in the login module. Note that the context must have a logger (set by logging.ContextWithLogger), otherwise CreateUsers will panic on logging.
func (*Client) DeleteUsers ¶
func (client *Client) DeleteUsers(ctx context.Context, clientID, clientKey, loginPrefix string) (bool, error)
DeleteUsers deletes users specified by the given login prefix from the login module. Note that the context must have a logger (set by logging.ContextWithLogger), otherwise DeleteUsers will panic on logging.
func (*Client) GetUserProfile ¶
func (client *Client) GetUserProfile(ctx context.Context, accessToken string) (profile *UserProfile, err error)
GetUserProfile returns a user profile for given access token. Note that the context must have a logger (set by logging.ContextWithLogger), otherwise GetUserProfile will panic on logging.
func (*Client) SendLTIResult ¶
func (client *Client) SendLTIResult( ctx context.Context, clientID, clientKey string, userLoginID, itemID int64, score float32, ) (bool, error)
SendLTIResult sends item score to LTI. Note that the context must have a logger (set by logging.ContextWithLogger), otherwise SendLTIResult will panic on logging.
func (*Client) UnlinkClient ¶
func (client *Client) UnlinkClient(ctx context.Context, clientID, clientKey string, userLoginID int64) (bool, error)
UnlinkClient discards our client authorization for the login module user. Note that the context must have a logger (set by logging.ContextWithLogger), otherwise UnlinkClient will panic on logging.
type CreateUsersParams ¶
type CreateUsersParams struct {
Prefix string
Amount int
PostfixLength int
PasswordLength int
LoginFixed *bool
Language *string
}
CreateUsersParams represents parameters for Client.CreateUsers().
type CreateUsersResponseDataRow ¶
type CreateUsersResponseDataRow struct {
ID int64 `json:"id"`
Login string `json:"login"`
Password string `json:"password"`
}
CreateUsersResponseDataRow represents an element of the array returned by Client.CreateUsers() (id, login, password).
type UserProfile ¶ added in v2.30.7
type UserProfile struct {
Profile *map[string]interface{} `json:"profile"`
LoginID int64 `json:"login_id"`
Login string `json:"login"`
Email *string `json:"email"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
Sex *string `json:"sex"`
StudentID *string `json:"student_id"`
CountryCode string `json:"country_code"`
BirthDate *string `json:"birth_date"`
GraduationYear int64 `json:"graduation_year"`
Grade *int64 `json:"grade"`
Address *string `json:"address"`
Zipcode *string `json:"zipcode"`
City *string `json:"city"`
LandLineNumber *string `json:"land_line_number"`
CellPhoneNumber *string `json:"cell_phone_number"`
DefaultLanguage *string `json:"default_language"`
FreeText *string `json:"free_text"`
WebSite *string `json:"web_site"`
TimeZone *string `json:"time_zone"`
EmailVerified bool `json:"email_verified"`
PhotoUpload bool `json:"photo_autoload"`
NotifyNews bool `json:"notify_news"`
PublicFirstName bool `json:"public_first_name"`
PublicLastName bool `json:"public_last_name"`
Badges []database.Badge `json:"badges"`
}
UserProfile represents normalized user profile data returned by the login module.
func (*UserProfile) ToMap ¶ added in v2.30.7
func (up *UserProfile) ToMap() map[string]interface{}
ToMap converts UserProfile to a map[string]interface{}.