Documentation ¶
Index ¶
- func GetAffiliation(user Affiliation) string
- func GetNewAttributes(modifyAttrs, newAttrs []api.Attribute) []api.Attribute
- type Affiliation
- type DbTxResult
- type Impl
- func (u *Impl) GetAffiliationPath() []string
- func (u *Impl) GetAttribute(name string) (*api.Attribute, error)
- func (u *Impl) GetAttributes(attrNames []string) ([]api.Attribute, error)
- func (u *Impl) GetFailedLoginAttempts() int
- func (u *Impl) GetLevel() int
- func (u *Impl) GetMaxEnrollments() int
- func (u *Impl) GetName() string
- func (u *Impl) GetPass() []byte
- func (u *Impl) GetType() string
- func (u *Impl) IncrementIncorrectPasswordAttempts() error
- func (u *Impl) IsRevoked() bool
- func (u *Impl) Login(pass string, caMaxEnrollments int) error
- func (u *Impl) LoginComplete() error
- func (u *Impl) Migrate(tx userDB) error
- func (u *Impl) ModifyAttributes(newAttrs []api.Attribute) error
- func (u *Impl) ModifyAttributesTx(tx userDB, newAttrs []api.Attribute) error
- func (u *Impl) Revoke() error
- func (u *Impl) SetLevel(level int) error
- func (u *Impl) SetLevelTx(tx userDB, level int) error
- type Info
- type Record
- type Registry
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAffiliation ¶
func GetAffiliation(user Affiliation) string
GetAffiliation return a joined version version of the affiliation path with '.' as the seperator
Types ¶
type Affiliation ¶
type Affiliation interface {
GetAffiliationPath() []string
}
Affiliation is interface that defines functions needed to get a user's affiliation
type DbTxResult ¶
type DbTxResult struct { Affiliations []spi.Affiliation Identities []User }
DbTxResult returns information on any affiliations and/or identities affected during a database transaction
type Impl ¶
type Impl struct { Info // contains filtered or unexported fields }
Impl is the databases representation of a user
func GetUserLessThanLevel ¶
GetUserLessThanLevel returns all identities that are less than the level specified Otherwise, returns no users if requested level is zero
func (*Impl) GetAffiliationPath ¶
GetAffiliationPath returns the complete path for the user's affiliation.
func (*Impl) GetAttribute ¶
GetAttribute returns the value for an attribute name
func (*Impl) GetAttributes ¶
GetAttributes returns the requested attributes. Return all the user's attributes if nil is passed in
func (*Impl) GetFailedLoginAttempts ¶
GetFailedLoginAttempts returns the number of times the user has entered an incorrect password
func (*Impl) GetMaxEnrollments ¶
GetMaxEnrollments returns the max enrollments of the user
func (*Impl) IncrementIncorrectPasswordAttempts ¶
IncrementIncorrectPasswordAttempts updates the incorrect password count of user
func (*Impl) LoginComplete ¶
LoginComplete completes the login process by incrementing the state of the user
func (*Impl) ModifyAttributes ¶
ModifyAttributes adds a new attribute, modifies existing attribute, or delete attribute
func (*Impl) ModifyAttributesTx ¶
ModifyAttributesTx adds a new attribute, modifies existing attribute, or delete attribute
func (*Impl) SetLevelTx ¶
SetLevelTx sets the level of the user
type Info ¶
type Info struct { Name string Pass string `mask:"password"` Type string Affiliation string Attributes []api.Attribute State int MaxEnrollments int Level int IncorrectPasswordAttempts int }
Info contains information about a user
type Record ¶
type Record struct { Name string `db:"id"` Pass []byte `db:"token"` Type string `db:"type"` Affiliation string `db:"affiliation"` Attributes string `db:"attributes"` State int `db:"state"` MaxEnrollments int `db:"max_enrollments"` Level int `db:"level"` IncorrectPasswordAttempts int `db:"incorrect_password_attempts"` }
Record defines the properties of a user
type Registry ¶
type Registry interface { GetUser(id string, attrs []string) (User, error) InsertUser(user *Info) error UpdateUser(user *Info, updatePass bool) error DeleteUser(id string) (User, error) GetAffiliation(name string) (spi.Affiliation, error) GetAllAffiliations(name string) (*sqlx.Rows, error) InsertAffiliation(name string, prekey string, level int) error GetUserLessThanLevel(version int) ([]User, error) GetFilteredUsers(affiliation, types string) (*sqlx.Rows, error) DeleteAffiliation(name string, force, identityRemoval, isRegistrar bool) (*DbTxResult, error) ModifyAffiliation(oldAffiliation, newAffiliation string, force, isRegistrar bool) (*DbTxResult, error) GetAffiliationTree(name string) (*DbTxResult, error) }
Registry is the API for retreiving users and groups
type User ¶
type User interface { // Returns the enrollment ID of the user GetName() string // Return the type of the user GetType() string // Return the max enrollments of the user GetMaxEnrollments() int // Login the user with a password Login(password string, caMaxEnrollment int) error // Get the complete path for the user's affiliation. GetAffiliationPath() []string // GetAttribute returns the value for an attribute name GetAttribute(name string) (*api.Attribute, error) // GetAttributes returns the requested attributes GetAttributes(attrNames []string) ([]api.Attribute, error) // ModifyAttributes adds, removes, or deletes attribute ModifyAttributes(attrs []api.Attribute) error // LoginComplete completes the login process by incrementing the state of the user LoginComplete() error // Revoke will revoke the user, setting the state of the user to be -1 Revoke() error // IsRevoked returns back true if user is revoked IsRevoked() bool // GetLevel returns the level of the user, level is used to verify if the user needs migration GetLevel() int // SetLevel sets the level of the user SetLevel(level int) error // IncrementIncorrectPasswordAttempts updates the incorrect password count of user IncrementIncorrectPasswordAttempts() error // GetFailedLoginAttempts returns the number of times the user has entered an incorrect password GetFailedLoginAttempts() int }
User is the SPI for a user