db

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2015 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(cfg shared.DBSettings) (db gorm.DB, err error)

func CreateDefaults

func CreateDefaults(db gorm.DB) error

func InitTables

func InitTables(db gorm.DB) error

func NotFound

func NotFound(err error) bool

Types

type GroupACLs

type GroupACLs struct {
	Id       uint
	UID      uint `gorm:"column:uid"`
	GID      uint `gorm:"column:gid"`
	TargetID uint `gorm:"column:targetid"`
}

ACL controls for groups

func (GroupACLs) TableName

func (_ GroupACLs) TableName() string

type GroupSecrets

type GroupSecrets struct {
	Id     uint
	GID    uint `gorm:"column:gid"`
	SID    uint `gorm:"column:sid"`
	Secret []byte
	Path   string `sql:"type:varchar(2048)"`
}

func (GroupSecrets) TableName

func (_ GroupSecrets) TableName() string

type Groups

type Groups struct {
	Id      uint
	Name    string
	Admin   bool
	PubKey  []byte
	PrivKey []byte // Key encrypted with supergroup key
}

func (Groups) Lookup

func (g Groups) Lookup(db gorm.DB, uid, gid uint) bool

func (Groups) TableName

func (_ Groups) TableName() string

type MasterSecrets

type MasterSecrets struct {
	Id     uint
	Name   string `sql:"not null;unique"`
	Secret []byte `sql:"type:blob"` // Unlimited size
}

func (MasterSecrets) Lookup

func (m MasterSecrets) Lookup(db gorm.DB, uid, gid uint) bool

Lookup just checks if a user has any form of access to a key. It does not distinguish between user-access and group-access.

func (MasterSecrets) TableName

func (_ MasterSecrets) TableName() string

type UserACLs

type UserACLs struct {
	Id       uint
	UID      uint `gorm:"column:uid"`
	GID      uint `gorm:"column:gid"`
	TargetID uint `gorm:"column:targetid"`
}

ACL controls for individual users

func (UserACLs) TableName

func (_ UserACLs) TableName() string

type UserSecrets

type UserSecrets struct {
	Id     uint
	SID    uint   `gorm:"column:sid"`
	UID    uint   `gorm:"column:uid"`
	Path   string `sql:"type:varchar(2048)"`
	Secret []byte
}

func (UserSecrets) TableName

func (_ UserSecrets) TableName() string

type Users

type Users struct {
	Id       uint
	GID      uint   `gorm:"column:gid"`
	Name     string `sql:"not null;unique"`
	PubKey   []byte
	Password []byte
	GroupKey []byte
	Admin    bool
}

func (*Users) BeforeCreate

func (u *Users) BeforeCreate() (err error)

Set the default group

func (*Users) Get

func (u *Users) Get(db gorm.DB, name string) error

Get finds a user by name

func (*Users) GetGID

func (u *Users) GetGID() uint

func (*Users) GetName

func (u *Users) GetName() string

Functions to statisfy the auth credentials interface.

func (*Users) GetPass

func (u *Users) GetPass() crypto.Binary

func (*Users) GetUID

func (u *Users) GetUID() uint

func (*Users) IsAdmin

func (u *Users) IsAdmin() bool

func (Users) Lookup

func (u Users) Lookup(db gorm.DB, uid, gid uint) bool

ACL lookup function for users

func (Users) TableName

func (_ Users) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL