2018-02-08 16:13:58 -06:00
|
|
|
package models
|
|
|
|
|
2018-03-19 16:09:49 -05:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-02-08 16:13:58 -06:00
|
|
|
type UserAuth struct {
|
|
|
|
Id int64
|
|
|
|
UserId int64
|
|
|
|
AuthModule string
|
|
|
|
AuthId string
|
2018-03-19 16:09:49 -05:00
|
|
|
Created time.Time
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type ExternalUserInfo struct {
|
2018-07-16 09:56:42 -05:00
|
|
|
AuthModule string
|
|
|
|
AuthId string
|
|
|
|
UserId int64
|
|
|
|
Email string
|
|
|
|
Login string
|
|
|
|
Name string
|
|
|
|
Groups []string
|
|
|
|
OrgRoles map[int64]RoleType
|
|
|
|
IsGrafanaAdmin *bool // This is a pointer to know if we should sync this or not (nil = ignore sync)
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------
|
|
|
|
// COMMANDS
|
|
|
|
|
|
|
|
type UpsertUserCommand struct {
|
2018-03-23 14:50:07 -05:00
|
|
|
ReqContext *ReqContext
|
2018-02-08 16:13:58 -06:00
|
|
|
ExternalUser *ExternalUserInfo
|
|
|
|
SignupAllowed bool
|
|
|
|
|
2018-03-23 10:16:11 -05:00
|
|
|
Result *User
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type SetAuthInfoCommand struct {
|
|
|
|
AuthModule string
|
|
|
|
AuthId string
|
|
|
|
UserId int64
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteAuthInfoCommand struct {
|
|
|
|
UserAuth *UserAuth
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------
|
|
|
|
// QUERIES
|
|
|
|
|
|
|
|
type LoginUserQuery struct {
|
2018-03-23 14:50:07 -05:00
|
|
|
ReqContext *ReqContext
|
|
|
|
Username string
|
|
|
|
Password string
|
|
|
|
User *User
|
|
|
|
IpAddress string
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type GetUserByAuthInfoQuery struct {
|
|
|
|
AuthModule string
|
|
|
|
AuthId string
|
|
|
|
UserId int64
|
|
|
|
Email string
|
|
|
|
Login string
|
|
|
|
|
2018-03-28 20:26:35 -05:00
|
|
|
Result *User
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type GetAuthInfoQuery struct {
|
|
|
|
AuthModule string
|
|
|
|
AuthId string
|
|
|
|
|
2018-03-28 17:06:22 -05:00
|
|
|
Result *UserAuth
|
2018-02-08 16:13:58 -06:00
|
|
|
}
|
2018-07-01 09:01:43 -05:00
|
|
|
|
|
|
|
type SyncTeamsCommand struct {
|
|
|
|
ExternalUser *ExternalUserInfo
|
|
|
|
User *User
|
|
|
|
}
|