models

package
v0.0.0-...-d942aef Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const COODRINATORS = 0
View Source
const STUDENTS = 2
View Source
const TUTORS = 1

Variables

This section is empty.

Functions

func AddUser2Course

func AddUser2Course(s *mgo.Session, courseId bson.ObjectId, u UserInCourse_db) int

func AdminAddUser2Course

func AdminAddUser2Course(s *mgo.Session,
	user User_t,
	admin string,
	courseIdHex string,
	c []UserInCourse_t) (int, []int)

func AdminNewCourse

func AdminNewCourse(s *mgo.Session, user User_t, admin string, course Course_t) (int, string)

func AdminRemoveUserFromCourse

func AdminRemoveUserFromCourse(s *mgo.Session,
	user User_t,
	admin string,
	courseIdHex string,
	UsersIdHex []string) (int, []int)

func AdminUpdateCourse

func AdminUpdateCourse(s *mgo.Session, user User_t, admin, IdHex string, details Details_t) (int, []int)

func AdminUpdateUser

func AdminUpdateUser(s *mgo.Session, user User_t, admin, IdHex string, details Details_t) (int, []int)

func CheckAdmin

func CheckAdmin(s *mgo.Session, user User_t) int

func CoordinatorAddStages

func CoordinatorAddStages(s *mgo.Session, user User_t, courseIdHex string, stages []string) int

func CoordinatorAddTasks

func CoordinatorAddTasks(s *mgo.Session, user User_t, courseIdHex string, stage int, tasks []string) int

func CoursesForUser

func CoursesForUser(s *mgo.Session, UserIdHex string) (int, []Course_db, []Course_db, []Course_db)

func GuardAdmins

func GuardAdmins()

func GuardUsers

func GuardUsers()

func IsAdmin

func IsAdmin(user User_t, admin string) int

func LoginHandler

func LoginHandler(s *mgo.Session, email, passwd string) (int, [2]string, string, string)

func LoginStatus

func LoginStatus(user User_t) int

func LogoutHandler

func LogoutHandler(user User_t) int

func ParseBody

func ParseBody(body io.Reader, r interface{})

func RegisterHandler

func RegisterHandler(s *mgo.Session, email, username, passwd, name string) int

func RemoveUserFromCourse

func RemoveUserFromCourse(s *mgo.Session, courseId bson.ObjectId, u []string) int

func UpdateCourseDescription

func UpdateCourseDescription(s *mgo.Session, courseId bson.ObjectId, data string) int

func UpdateCourseName

func UpdateCourseName(s *mgo.Session, courseId bson.ObjectId, data string) int

func UpdateCourseSuspended

func UpdateCourseSuspended(s *mgo.Session, courseId bson.ObjectId, data bool) int

func UpdateUserName

func UpdateUserName(s *mgo.Session, userId bson.ObjectId, data string) int

func UpdateUserSuspended

func UpdateUserSuspended(s *mgo.Session, userId bson.ObjectId, data bool) int

Types

type Admin_t

type Admin_t struct {
	UserId bson.ObjectId `bson:"uid"`
	Id     bson.ObjectId `bson:"_id,omitempty"`
}

type AggregateUser_t

type AggregateUser_t struct {
	Detail User_db
	Role   int
}

type AutoGenerated

type AutoGenerated struct {
	D []struct {
		T string `json:"t"`
		V bool   `json:"v"`
	} `json:"d"`
}

type CourseWithUsers_t

type CourseWithUsers_t struct {
	Name        string
	Description string
	Suspended   bool
	Users       []AggregateUser_t
	TimeCreated time.Time
	Id          bson.ObjectId
}

func AdminCourse

func AdminCourse(s *mgo.Session, user User_t, admin, courseIdHex string) (int, CourseWithUsers_t)

type Course_db

type Course_db struct {
	Name        string          `bson:"name"`
	Description string          `bson:"description"`
	Suspended   bool            `bson:"suspended,omitempty"`
	Users       UserInCourse_db `bson:"users,omitempty"`
	TimeCreated time.Time       `bson:"timeCreated,omitempty"`
	Id          bson.ObjectId   `bson:"_id,omitempty"`
	Accessments []Stage_db      `bson:"accessments,omitempty"`
}

func AdminCourses

func AdminCourses(s *mgo.Session, user User_t, admin string, page int) (int, []Course_db)

func UserCourse

func UserCourse(s *mgo.Session, UserIdHex, CourseIdHex string) (int, Course_db)

type Course_t

type Course_t struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Details_t

type Details_t struct {
	Details []struct {
		UpdateType  string      `json:"t"`
		UpdateValue interface{} `json:"v"`
	} `json:"d"`
}

type OutputHandler_db

type OutputHandler_db struct {
	HandlerType string `bson:"handlerType"`
	DirectComp  string `bson:"directComp,omitempty"`
}

type Stage_db

type Stage_db struct {
	Description string    `bson:"description"`
	Tasks       []Task_db `bson:"tasks,omitempty"`
}

type Task_db

type Task_db struct {
	Description string        `bson:"description"`
	AllowLang   []string      `bson:"allowLang,omitempty"`
	TestCases   []TestCase_db `bson:"testCases,omitempty"`
}

type TestCase_db

type TestCase_db struct {
	Stdin  string           `bson:"stdin"`
	Stdout OutputHandler_db `bson:"stdout"`
	Stderr OutputHandler_db `bson:"stderr"`
}

type UserInCourse_db

type UserInCourse_db map[string]int

type UserInCourse_t

type UserInCourse_t struct {
	IdHex string `json:"uid"`
	Role  int    `json:"role"`
}

type User_db

type User_db struct {
	Identifier [2]string     `bson:"identifier"`
	Passwd     string        `bson:"passwd"`
	Salt       string        `bson:"salt"`
	PrevPasswd []string      `bson:"prevpasswd,omitempty"`
	Suspended  bool          `bson:"suspended"`
	Name       string        `bson:"name"`
	Id         bson.ObjectId `bson:"_id,omitempty"`
}

func AdminGetUserByIdentifier

func AdminGetUserByIdentifier(s *mgo.Session,
	user User_t,
	admin string,
	identifier string,
	allowSuspend bool) (int, []User_db)

func AdminUser

func AdminUser(s *mgo.Session, user User_t, admin, userIdHex string) (int, User_db)

func AdminUsers

func AdminUsers(s *mgo.Session, user User_t, admin string, page int) (int, []User_db)

func CoordinatorGetUsers

func CoordinatorGetUsers(s *mgo.Session, user User_t, CourseIdHex string, UserType string) (int, []User_db)

func GetUserByIdentifier

func GetUserByIdentifier(s *mgo.Session, identifier string, allowSuspend bool) (int, []User_db)

type User_t

type User_t struct {
	Email     string
	Username  string
	Name      string
	UserIdHex string
}

Jump to

Keyboard shortcuts

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