models

package
v0.0.0-...-5dff866 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExerciseByIdentifierTable = sitrep.ExerciseByIdentifierTableDef()

ExerciseByIdentifierTable is a reference to the users cassandra table

View Source
var ExercisePermissionsLevelTable = sitrep.ExercisePermissionsLevelTableDef()

ExercisePermissionsLevelTable is a reference to the users cassandra table

View Source
var SettingsByExerciseIdentifierTable = sitrep.SettingsByExerciseIdentifierTableDef()

SettingsByExerciseIdentifierTable is a reference to the SettingsByExerciseIdentifier cassandra table

View Source
var UsersInExerciseTable = sitrep.CreateUsersInExerciseTableDef()

UsersInExerciseTable is a reference to the users cassandra table

View Source
var UsersJwtTable = sitrep.UsersByJwtTableDef()

UsersJwtTable is a reference to the JWT Tokens table

View Source
var UsersTable = sitrep.UsersByEmailTableDef()

UsersTable is a reference to the users cassandra table

Functions

func FetchAllUsers

func FetchAllUsers(cassandra *gocql.ClusterConfig) ([]sitrep.UsersSafeReturn, error)

FetchAllUsers retreives all SAFE fields for users

func FindExerciseByID

func FindExerciseByID(cassandra *gocql.ClusterConfig, id gocql.UUID) (*sitrep.ExerciseByIdentifier, error)

FindExerciseByID receives an exercise from the database

func FindExercisePermissionsForUser

func FindExercisePermissionsForUser(cassandra *gocql.ClusterConfig, user *sitrep.UsersByEmail, exercise *sitrep.ExerciseByIdentifier) (*sitrep.ExercisePermissionsLevel, error)

FindExercisePermissionsForUser receives a new permission model from Cassandra Exercise Permissions are a link between users and exercises They also add permissions for users

func FindExercisesForUser

func FindExercisesForUser(cassandra *gocql.ClusterConfig, user *sitrep.UsersByEmail) (*sitrep.CreateUsersInExercise, error)

FindExercisesForUser receives exercises for a user

func FindOrInitSettingsForExercise

func FindOrInitSettingsForExercise(cassandra *gocql.ClusterConfig, exerciseID gocql.UUID) (map[string]string, error)

FindOrInitSettingsForExercise searches for settings inside cassandra, or otherwise inits them

func FindUserByEmail

func FindUserByEmail(cassandra *gocql.ClusterConfig, email string) (*sitrep.UsersByEmail, error)

FindUserByEmail receives a user object from the database

func UpdateExerciseSetting

func UpdateExerciseSetting(cassandra *gocql.ClusterConfig, exerciseID gocql.UUID, settings map[string]string) (map[string]string, error)

UpdateExerciseSetting updates a single setting key and value

func UserChangePassword

func UserChangePassword(cassandra *gocql.ClusterConfig, user *sitrep.UsersByEmail, oldPasswd string, newPasswd string) (*map[string]string, error)

UserChangePassword changes a users password, if they match the previous one

func UserSignIn

func UserSignIn(cassandra *gocql.ClusterConfig, email string, password string, scope string) (*sitrep.JWTResponse, error)

UserSignIn verifies and authenticates a user from database

func VerifyUserRequest

func VerifyUserRequest(cassandra *gocql.ClusterConfig, accessToken string) (*sitrep.UsersByEmail, error)

VerifyUserRequest verfies a request - as efficient as possible.

func WithSession

func WithSession(cassandra *gocql.ClusterConfig) (*gocql.Session, *cqlc.Context, error)

WithSession adds a cassandra Session to the mix ;)

Types

type UserInvalidError

type UserInvalidError struct {
	Message string
}

UserInvalidError holds the error, when a user has no permission to access an exercise

func NewUserInvalidError

func NewUserInvalidError() *UserInvalidError

NewUserInvalidError produces a new UserInvalidError

func (*UserInvalidError) Error

func (u *UserInvalidError) Error() string

Error prints the UserBannedError

Jump to

Keyboard shortcuts

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