Documentation
¶
Index ¶
- Constants
- func ApplySchemas(sqlClient db.SQLClient) error
- func BootstrapPermissions(client db.SQLClient) error
- func BootstrapSuperuser(client db.SQLClient, clientID, clientSecret string) error
- func CreateDebugSession(ctx context.Context, client db.SQLClient, backend string, expiresAt time.Time) (int64, error)
- func CreateDebugSessionCall(ctx context.Context, client db.SQLClient, sessionID int64, ...) (int64, error)
- func CreateGroup(ctx context.Context, client db.SQLClient, name string) (int64, error)
- func CreateSession(ctx context.Context, client db.SQLClient, userID int64, refreshID string, ...) error
- func CreateUser(ctx context.Context, client db.SQLClient, ...) (int64, error)
- func DeleteDebugSession(ctx context.Context, client db.SQLClient, backend string, id int64) error
- func DeleteGroup(ctx context.Context, client db.SQLClient, groupID int64) error
- func DeleteSession(ctx context.Context, client db.SQLClient, sessionID string) error
- func DeleteSuperuserSessions(ctx context.Context, client db.SQLClient) error
- func DeleteUser(ctx context.Context, client db.SQLClient, userID int64) error
- func GetDebugSession(ctx context.Context, client db.SQLClient, backend string, id int64) (*adminapi.DebugSession, error)
- func GetDebugSessionCall(ctx context.Context, client db.SQLClient, callID int64) (*adminapi.DebugSessionCall, error)
- func GetGroup(ctx context.Context, client db.SQLClient, groupID int64) (*adminapi.Group, error)
- func GetGroupPermissions(ctx context.Context, client db.SQLClient, groupID int64) ([]adminapi.Permission, error)
- func GetSession(ctx context.Context, client db.SQLClient, sessionID string) (*model.Session, error)
- func GetSessionByRefresh(ctx context.Context, client db.SQLClient, refreshID string) (*model.Session, error)
- func GetSuperuser(ctx context.Context, client db.SQLClient) (*model.User, error)
- func GetUser(ctx context.Context, client db.SQLClient, userID int64) (*adminapi.User, error)
- func GetUserAuth(ctx context.Context, client db.SQLClient, userID int64) (*model.UserAuth, error)
- func GetUserPermissionIDs(ctx context.Context, client db.SQLClient, userID int64) ([]int64, error)
- func ListDebugSessionCalls(ctx context.Context, client db.SQLClient, sessionID int64, ...) ([]adminapi.DebugSessionCall, error)
- func ListDebugSessionFlowTransitions(ctx context.Context, client db.SQLClient, callID int64) ([]adminapi.FlowTransition, error)
- func ListDebugSessions(ctx context.Context, client db.SQLClient, backend string) ([]adminapi.DebugSession, error)
- func ListGroupBindings(ctx context.Context, client db.SQLClient, userID int64) ([]*model.GroupBinding, error)
- func ListGroups(ctx context.Context, client db.SQLClient) ([]adminapi.Group, error)
- func ListPermissions(ctx context.Context, client db.SQLClient) ([]adminapi.Permission, error)
- func ListUsers(ctx context.Context, client db.SQLClient) ([]adminapi.User, error)
- func LoginLookup(ctx context.Context, client db.SQLClient, username string) (*model.SuperuserLoginUser, error)
- func SetGroupPermissions(ctx context.Context, client db.SQLClient, groupID int64, permissionIDs []int) error
- func UpdateDebugSession(ctx context.Context, client db.SQLClient, debugSession adminapi.DebugSession) error
- func UpdateGroup(ctx context.Context, client db.SQLClient, groupID int64, name string) error
- func UpdateSuperuserPassword(ctx context.Context, client db.SQLClient, salt, hashedPassword string) error
- func UpdateUser(ctx context.Context, client db.SQLClient, userID int64, username string) error
- func UpdateUserGroupBindings(ctx context.Context, client db.SQLClient, userID int64, desiredGroupIDs []int) error
- func UpdateUserPassword(ctx context.Context, client db.SQLClient, userID int64, ...) error
Constants ¶
const ( SessionExpiry = 15 * time.Minute SessionRefreshExpiry = 60 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func ApplySchemas ¶
ApplySchemas applies the admin DB schema to the given SQL client.
func BootstrapPermissions ¶
BootstrapPermissions inserts the fixed set of permissions if they do not yet exist.
func BootstrapSuperuser ¶
bootstrapSuperuser checks if a super user exists and if not, creates one with the provided credentials. This is to allow bootstrapping of the first super user. Subsequent calls to this function will not have any effect. This is to prevent re-provisioning of the super-user, potentially allowing an attacker to reset powerful credentials.
func CreateDebugSession ¶
func CreateDebugSessionCall ¶
func CreateGroup ¶
func CreateSession ¶
func CreateUser ¶
func DeleteDebugSession ¶
func DeleteSession ¶
func DeleteSuperuserSessions ¶
func GetDebugSession ¶
func GetDebugSessionCall ¶
func GetGroup ¶
GetGroup returns an admin group by ID. Returns (nil, errNoGroup) when no matching group exists.
func GetGroupPermissions ¶
func GetGroupPermissions( ctx context.Context, client db.SQLClient, groupID int64, ) ([]adminapi.Permission, error)
GetGroupPermissions returns the permissions assigned to the given group.
func GetSession ¶
func GetSession( ctx context.Context, client db.SQLClient, sessionID string, ) (*model.Session, error)
GetSession returns a session by its session ID. Returns (nil, errNoSession) when no matching session exists.
func GetSessionByRefresh ¶
func GetSessionByRefresh( ctx context.Context, client db.SQLClient, refreshID string, ) (*model.Session, error)
GetSessionByRefresh returns when the session associated with the given refresh ID expires. Returns (0, errNoSession) when no matching session exists.
func GetSuperuser ¶
GetSuperuser returns the superuser row. Returns (nil, errNoSuperuser) when no superuser exists.
func GetUser ¶
GetUser returns a non-superuser admin user by ID. Returns (nil, errNoUser) when no matching user exists.
func GetUserAuth ¶
func GetUserAuth( ctx context.Context, client db.SQLClient, userID int64, ) (*model.UserAuth, error)
GetUserAuth returns authentication credentials for a non-superuser admin user. Returns (nil, errNoUser) when no matching user exists.
func GetUserPermissionIDs ¶
func GetUserPermissionIDs( ctx context.Context, client db.SQLClient, userID int64, ) ([]int64, error)
GetUserPermissionIDs returns all permission IDs available to the given user via their group memberships.
func ListDebugSessionCalls ¶
func ListDebugSessions ¶
func ListGroupBindings ¶
func ListGroups ¶
func ListPermissions ¶
ListPermissions returns all available permissions.
func LoginLookup ¶
func LoginLookup( ctx context.Context, client db.SQLClient, username string, ) (*model.SuperuserLoginUser, error)
LoginLookup looks up a non-superuser admin user by username for authentication. Returns (nil, errNoUser) when no matching user exists.
func SetGroupPermissions ¶
func SetGroupPermissions( ctx context.Context, client db.SQLClient, groupID int64, permissionIDs []int, ) error
SetGroupPermissions atomically replaces a group's permission bindings with the provided set.
func UpdateDebugSession ¶
func UpdateGroup ¶
func UpdateSuperuserPassword ¶
func UpdateUser ¶
Types ¶
This section is empty.