dao

package
v0.0.0-...-335cc7e Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Keyspace = "login"
)

Variables

View Source
var (
	Cfs []string = []string{cfSessions, cfUsers, cfEndpointAuths, cfUserIndex, cfUserIndexIndex}
)

Functions

func ConvertLDAPUser

func ConvertLDAPUser(response *ldapproto.User) *domain.User

func CreateUser

func CreateUser(user *domain.User, plainPass string) errors.Error

CreateUser will create a new user so long as none of the IDs already exist If another user is already using an index or ID, it will return an appropriate platform error The plainPass is used to give idempotence to the storage of a user

func DeleteEndpointAuths

func DeleteEndpointAuths(epas []*domain.EndpointAuth) error

DeleteEndpointAuths will revoke these rules for allowing things to talk to each other

func DeleteSession

func DeleteSession(rowKey, deviceType string) error

DeleteSession will remove all knowledge of a session. The session device type must be specified because it needs to be expunged from the userSessions column family

func DeleteUser

func DeleteUser(user *domain.User) error

DeleteUser deletes a user and expires all their active sessions

func DeleteUserIndexes

func DeleteUserIndexes(user *domain.User, uid string, ids []domain.Id) error

func IsLDAPUser

func IsLDAPUser(app domain.Application, uid string) (username, domain string, ok bool)

isLDAPUser checks if the user ID is an LDAP user, a user is an LDAP user if:

  • The user is an ADMIN user
  • The uid is an email address

func MultiReadUser

func MultiReadUser(app domain.Application, ids []string) ([]*domain.User, error)

If a user isn't found then returned array length won't match ids length

func ReadActiveSessionFor

func ReadActiveSessionFor(authMechanism, deviceType, userId string) (*domain.Session, error)

ReadSession fetches a single session by secondary auth mechanism + device type + user ID index

func ReadActiveSessionIdsFor

func ReadActiveSessionIdsFor(userId string) (sessionIds map[string]string, err error)

ReadActiveSessionIdsFor retrieves all active session IDs (keyed in a map by their device type) for a given user ID

func ReadEndpointAuth

func ReadEndpointAuth(service string) ([]*domain.EndpointAuth, error)

ReadEndpointAuth grabs a list of all authorised services that can make requests to the supplied service

func ReadSession

func ReadSession(rowKey string) (*domain.Session, error)

ReadSession fetches a single session - usually by base64-encoded sessionId, but also called by ReadActiveSessionFor for secondary indexed sessions

func ReadUser

func ReadUser(app domain.Application, uid string) (*domain.User, error)

ReadUser returns a user, fetched by ID

func ReadUserList

func ReadUserList(app domain.Application, start, end time.Time, count int, lastId string) ([]*domain.User, string, error)

ReadUserList returns a timeseries list of all users, ordered by created timestamp. This function will only return users stored in cassandra (H2 users).

func ReadUserLogins

func ReadUserLogins(app domain.Application, uid string, start, end time.Time, count int, lastId string) ([]*domain.Login, string, error)

ReadUserLogins will return a list of user logins for a single user, within a time range

func ReindexUsers

func ReindexUsers()

ReindexUsers is **temporary** so we can upgrade-in-place our data model and put users into a TS index

func UpdateUser

func UpdateUser(user *domain.User) error

UpdateUser will update details of an existing user

func WriteEndpointAuths

func WriteEndpointAuths(epas []*domain.EndpointAuth) error

WriteEndpointAuths defines a new rule that allows some service to call some endpoint

func WriteLogin

func WriteLogin(login *domain.Login) error

WriteLogin will record details of a user login

func WriteSession

func WriteSession(sess *domain.Session) error

WriteSession is create/update combined (we don't care) for sessions

Types

This section is empty.

Jump to

Keyboard shortcuts

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