Documentation ¶
Overview ¶
Package user contains the functionality and types needed to interact with the User API.
Index ¶
- type CreateRequest
- type GroupMembership
- type LoginAttributes
- type SSOSource
- type Service
- func (u *Service) Create(ctx context.Context, request *CreateRequest) (int64, error)
- func (u *Service) Disable(ctx context.Context, id int64) error
- func (u *Service) Get(ctx context.Context, id int64) (*User, error)
- func (u *Service) GetCurrentUser(ctx context.Context) (*User, error)
- func (u *Service) Reactivate(ctx context.Context, id int64) error
- func (u *Service) Update(ctx context.Context, id int64, request *UpdateRequest) error
- type UpdateRequest
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct { Email string `json:"email"` FirstName *string `json:"first_name"` LastName *string `json:"last_name"` GroupMemberships *[]GroupMembership `json:"user_group_memberships"` LoginAttributes *LoginAttributes `json:"login_attributes"` }
CreateRequest represents the request body used to create a new user.
type GroupMembership ¶
type LoginAttributes ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
New returns an initialised user Service for use by the client. This should only be used internally by the SDK.
func (*Service) Create ¶
Create creates a new user and returns the user's ID. This will automatically remove the permissions.GroupAllUsers and permissions.GroupAdministrators groups if specified, as users cannot be opted into these via the GroupMemberships field.
func (*Service) Disable ¶
Disable is used to deactivate users, as users cannot be deleted in Metabase. Deactivated users are unable to log into or access Metabase.
func (*Service) GetCurrentUser ¶
GetCurrentUser fetches the details of the currently authenticated user. For API keys, the FirstName field is set to the name of the API key and the Email field is set to an invalid email address.
func (*Service) Reactivate ¶
Reactivate is used to enable a user that has previously been disabled so that they can access Metabase again.
func (*Service) Update ¶
Update updates the details of an existing user. This will automatically remove the permissions.GroupAllUsers and permissions.GroupAdministrators groups if specified, as users cannot be opted into these via the GroupMemberships field. The Id field is also set automatically, so consumers do not need to set this explicitly.
type UpdateRequest ¶
type UpdateRequest struct { Id int64 `json:"id"` Email *string `json:"email"` FirstName *string `json:"first_name"` LastName *string `json:"last_name"` Locale *string `json:"locale"` IsGroupManager *bool `json:"is_group_manager"` IsSuperuser *bool `json:"is_superuser"` LoginAttributes *LoginAttributes `json:"login_attributes"` GroupMemberships *[]GroupMembership `json:"user_group_memberships"` }
UpdateRequest represents the request body to update an existing user.
type User ¶
type User struct { Id int64 `json:"id"` FirstName *string `json:"first_name"` LastName *string `json:"last_name"` CommonName *string `json:"common_name"` Email string `json:"email"` Locale *string `json:"locale"` IsActive bool `json:"is_active"` IsQbnewb bool `json:"is_qbnewb"` IsSuperuser bool `json:"is_superuser"` IsInstaller *bool `json:"is_installer"` LoginAttributes *LoginAttributes `json:"login_attributes"` GroupMemberships []GroupMembership `json:"user_group_memberships"` GoogleAuth bool `json:"google_auth"` SSOSource *SSOSource `json:"sso_source"` HasInvitedSecondUser bool `json:"has_invited_second_user"` HasQuestionAndDashboard bool `json:"has_question_and_dashboard"` PersonalCollectionId interface{} `json:"personal_collection_id"` DateJoined string `json:"date_joined"` FirstLogin *string `json:"first_login"` LastLogin *string `json:"last_login"` UpdatedAt *string `json:"updated_at"` }
User represents the details of an existing user returned from the Metabase API.