Documentation ¶
Index ¶
- func Connect(user, password, dbname string)
- func Init() error
- func Initialized() bool
- type MagicLink
- type Scope
- type User
- func (u *User) CleanDataRead(auth authentication.Level)
- func (u *User) CreateToken() (string, error)
- func (u *User) CreateUser() res.ServerError
- func (u *User) DeleteUser() res.ServerError
- func (u *User) GetUser(auth authentication.Level) res.ServerError
- func (u *User) GetUserByEmail(auth authentication.Level) res.ServerError
- func (u *User) GetUserByName(auth authentication.Level) res.ServerError
- func (u *User) ScanAll(row *sql.Row) error
- func (u *User) ScanAlls(rows *sql.Rows) error
- func (u *User) ToString() string
- func (u *User) UnflagDeletion() res.ServerError
- func (u *User) UpdateUser(auth authentication.Level) res.ServerError
- type UserList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialized ¶
func Initialized() bool
Types ¶
type MagicLink ¶
type MagicLink struct { ID int64 `json:"id"` // Read: SERVER // Write: Nobody UserID int64 `json:"userid"` // Read: SERVER // Write: SERVER Magic string `json:"magic"` }
func (*MagicLink) CreateMagicLink ¶
func (ml *MagicLink) CreateMagicLink() res.ServerError
func (*MagicLink) DeleteMagicLinkFromMagicString ¶
func (ml *MagicLink) DeleteMagicLinkFromMagicString() res.ServerError
func (*MagicLink) GetMagicLinkFromMagicString ¶
func (ml *MagicLink) GetMagicLinkFromMagicString() res.ServerError
type Scope ¶
type Scope struct { ID int64 `json:"id"` Name *string `json:"name"` Description *string `json:"description"` }
func CreateScope ¶
func CreateScope(name, description string) (res.ServerError, *Scope)
type User ¶
type User struct { // PUBLIC < USER == ADMINUSER < ADMIN < SERVER ID int64 `json:"id"` // Read: PUBLIC // Write: Nobody Name *string `json:"name,omitempty"` // Read: PUBLIC // Write: USER (offensive names, all included due to offensive names) Password *string `json:"password,omitempty"` // Read: SERVER // Write: USER or SERVER Email *string `json:"email,omitempty"` // Read: USER // Write: USER or SERVER Country *string `json:"country,omitempty"` // Read: PUBLIC // Write: USER or SERVER Locale *string `json:"locale,omitempty"` // Read: PUBLIC // Write: USER or SERVER DateCreated *time.Time `json:"date_created,omitempty"` // Read: PUBLIC // Write: Nobody (This is only ever set on creation.) Verified *bool `json:"verified,omitempty"` // Read: PUBLIC // Write: Nobody (by logging into sql only) Banned *bool `json:"banned,omitempty"` // Read: PUBLIC // Write: ADMIN only Admin *bool `json:"admin,omitempty"` // Read: PUBLIC // Write: Nobody (by logging into sql only) LastToken *string `json:"last_token,omitempty"` // ? is this needed // Read: SERVER // Write: SERVER LastLogin *time.Time `json:"last_login,omitempty"` // Read: PUBLIC // Write: SERVER LastIP *string `json:"last_ip,omitempty"` // Read: ADMIN // Write: SERVER Deleted *bool `json:"deleted,omitempty"` // READ: ADMIN // WRITE: USER (if false) Nobody (if true [sql only]) DateDeleted *time.Time `json:"date_deleted,omitempty"` // READ: ADMIN // WRITE: SERVER UUID *string `json:"uuid"` }
func (*User) CleanDataRead ¶
func (u *User) CleanDataRead(auth authentication.Level)
applies read user data permissions of a fully retrieved user
func (*User) CreateToken ¶
func (*User) CreateUser ¶
func (u *User) CreateUser() res.ServerError
func (*User) DeleteUser ¶
func (u *User) DeleteUser() res.ServerError
func (*User) GetUser ¶
func (u *User) GetUser(auth authentication.Level) res.ServerError
func (*User) GetUserByEmail ¶
func (u *User) GetUserByEmail(auth authentication.Level) res.ServerError
func (*User) GetUserByName ¶
func (u *User) GetUserByName(auth authentication.Level) res.ServerError
func (*User) UnflagDeletion ¶
func (u *User) UnflagDeletion() res.ServerError
func (*User) UpdateUser ¶
func (u *User) UpdateUser(auth authentication.Level) res.ServerError
type UserList ¶
type UserList struct { StartIndex int `json:"startIndex"` // starting index TotalItems int `json:"totalItems"` // how many items are returned Users []User `json:"users,omitempty"` // user array }
func GetUsers ¶
func GetUsers(start, count int, auth authentication.Level) (*UserList, res.ServerError)
Click to show internal directories.
Click to hide internal directories.