Documentation
¶
Index ¶
- Variables
- func CanClone(caps string) bool
- func CanPull(caps string) bool
- func CanPush(caps string) bool
- func CanPushUV(caps string) bool
- func CanSyncPrivate(caps string) bool
- func CreateUser(d *db.DB, projectCode, login, password, caps string) error
- func DeleteUser(d *db.DB, login string) error
- func HasCapability(caps string, required byte) bool
- func SetPassword(d *db.DB, projectCode, login, password string) error
- func UpdateCaps(d *db.DB, login, caps string) error
- type InviteToken
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrAuthFailed = errors.New("authentication failed")
Functions ¶
func CanSyncPrivate ¶
func CreateUser ¶
CreateUser inserts a new user into the user table. Panics if d is nil or login is empty.
func DeleteUser ¶
DeleteUser deletes a user by login. Returns an error if the user is not found (0 rows affected). Panics if d is nil.
func HasCapability ¶
func SetPassword ¶
SetPassword updates the password for a user. Returns an error if the user is not found (0 rows affected). Panics if d is nil.
Types ¶
type InviteToken ¶
type InviteToken struct {
URL string `json:"url"`
Login string `json:"login"`
Password string `json:"password"`
Caps string `json:"caps"`
}
func DecodeInviteToken ¶
func DecodeInviteToken(s string) (InviteToken, error)
func (InviteToken) Encode ¶
func (t InviteToken) Encode() string
type User ¶
type User struct {
UID int
Login string
Cap string
CExpire time.Time // zero value = no expiry
Info string
MTime time.Time
}
func GetUser ¶
GetUser retrieves a user by login. Returns an error if the user is not found. Panics if d is nil.
func VerifyLogin ¶
VerifyLogin validates a login card against the user table. The server does NOT need the raw payload — the nonce is in card.Nonce. Returns the authenticated User on success, or ErrAuthFailed on any failure. Panics if d or card is nil (TigerStyle preconditions).