Skip to content

webserver.auth.identity #

fn new #

fn new() !IdentityManager

fn new_backend #

fn new_backend(config DBBackendConfig) !DBBackend

factory for

interface IIdentity #

interface IIdentity {
mut:
	register(User) !string
}

struct Client #

struct Client {
	url string @[required]
}

fn (Client) register #

fn (mut c Client) register(user User) !string

fn (Client) get_user #

fn (c Client) get_user(user User) !User

fn (Client) get_users #

fn (c Client) get_users() ![]User

fn (Client) get_groups #

fn (c Client) get_groups() ![]Group

fn (Client) user_exists #

fn (c Client) user_exists(user User) !bool

fn (Client) create_group #

fn (c Client) create_group(group Group) !

struct Controller #

struct Controller {
	vweb.Context
pub mut:
	db sqlite.DB
}

fn (Controller) before_request #

fn (mut ctrl Controller) before_request()

fn (Controller) register #

fn (mut ctrl Controller) register() vweb.Result

fn (Controller) create_group #

fn (mut ctrl Controller) create_group() vweb.Result

fn (Controller) get_users #

fn (mut ctrl Controller) get_users() vweb.Result

fn (Controller) get_groups #

fn (mut ctrl Controller) get_groups() vweb.Result

struct DBBackend #

@[noinit]
struct DBBackend {
mut:
	db sqlite.DB
}

struct DBBackendConfig #

@[params]
struct DBBackendConfig {
	db_path string = 'identity.sqlite'
mut:
	// db     sqlite.DB
	logger &log.Logger = &log.Logger(&log.Log{
	level: .info
})
}

struct Group #

struct Group {
pub:
	name    string
	members []string @[fkey: group_id]
}

struct IdentityManager #

struct IdentityManager {
mut:
	backend DBBackend
}

fn (IdentityManager) login_user #

fn (mut auth IdentityManager) login_user(email string) !User

pub struct User { pub: id string @[primary] pub mut: email string }

fn (IdentityManager) register_user #

fn (mut auth IdentityManager) register_user(identifier string) User

fn (IdentityManager) get_user #

fn (mut auth IdentityManager) get_user(user User) ?User

fn (IdentityManager) get_users #

fn (mut auth IdentityManager) get_users() ![]User

struct ReadUserParams #

struct ReadUserParams {
	id    string
	email string
}

struct User #

struct User {
pub:
	id string
pub mut:
	group_id int
	name     string
	email    string
	phone    string
}