Documentation ¶
Index ¶
- Constants
- func JWTTeacher(c echo.Context) tc.IdTeacher
- type AskInscriptionIn
- type AskInscriptionOut
- type AttachStudentToClassroom1Out
- type AttachStudentToClassroom2In
- type AttachStudentToClassroom2Out
- type CheckStudentClassroomOut
- type ClassroomExt
- type Controller
- func (ct *Controller) AskInscription(c echo.Context) error
- func (ct *Controller) AttachStudentToClassroomStep1(c echo.Context) error
- func (ct *Controller) AttachStudentToClassroomStep2(c echo.Context) error
- func (ct *Controller) CheckStudentClassroom(c echo.Context) error
- func (ct *Controller) CleanupClassroomCodes() error
- func (ct *Controller) GetDevTokens() (string, string, error)
- func (ct *Controller) JWTMiddleware() echo.MiddlewareFunc
- func (ct *Controller) JWTMiddlewareForQuery() echo.MiddlewareFunc
- func (ct *Controller) LoadAdminTeacher() (tc.Teacher, error)
- func (ct *Controller) LoadDemoClassroom() (tc.Classroom, error)
- func (ct *Controller) Loggin(c echo.Context) error
- func (ct *Controller) StudentUpdatePlaylist(c echo.Context) error
- func (ct *Controller) TeacherAddStudent(c echo.Context) error
- func (ct *Controller) TeacherCreateClassroom(c echo.Context) error
- func (ct *Controller) TeacherDeleteClassroom(c echo.Context) error
- func (ct *Controller) TeacherDeleteStudent(c echo.Context) error
- func (ct *Controller) TeacherGenerateClassroomCode(c echo.Context) error
- func (ct *Controller) TeacherGetClassroomStudents(c echo.Context) error
- func (ct *Controller) TeacherGetClassrooms(c echo.Context) error
- func (ct *Controller) TeacherGetSettings(c echo.Context) error
- func (ct *Controller) TeacherImportStudents(c echo.Context) error
- func (ct *Controller) TeacherResetPassword(c echo.Context) error
- func (ct *Controller) TeacherUpdateClassroom(c echo.Context) error
- func (ct *Controller) TeacherUpdateSettings(c echo.Context) error
- func (ct *Controller) TeacherUpdateStudent(c echo.Context) error
- func (ct *Controller) ValidateInscription(c echo.Context) error
- type GenerateClassroomCodeOut
- type LogginIn
- type LogginOut
- type OptionalIdReview
- type Origin
- type PublicStatus
- type StudentClassroomHeader
- type StudentClient
- type StudentExt
- type StudentHeader
- type TeacherSettings
- type UserMeta
- type Visibility
Constants ¶
const (
DeltaTokenJours = 3
)
const ValidateInscriptionEndPoint = "inscription"
Variables ¶
This section is empty.
Functions ¶
func JWTTeacher ¶
JWTTeacher expects a JWT authentified request, and must only be used in routes protected by `JWTMiddleware`
Types ¶
type AskInscriptionIn ¶
type AskInscriptionIn struct { Mail string Password string FavoriteMatiere tc.MatiereTag }
type AskInscriptionOut ¶
type AttachStudentToClassroom1Out ¶
type AttachStudentToClassroom1Out []StudentHeader
type CheckStudentClassroomOut ¶
type CheckStudentClassroomOut struct { IsOK bool // if false, ignore the other fields Meta StudentClassroomHeader // Advance exposes the global advance of the student, // as defined by its events. Advance events.StudentAdvance }
type ClassroomExt ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller provides the route handling teacher inscription, connection and settings.
func NewController ¶
func NewController(db *sql.DB, smtp pass.SMTP, teacherKey, studentKey pass.Encrypter, host, demoCode string) *Controller
NewController return a new controller. `LoadAdminTeacher` should be called once.
func (*Controller) AskInscription ¶
func (ct *Controller) AskInscription(c echo.Context) error
AskInscription send a link to register a new user account.
func (*Controller) AttachStudentToClassroomStep1 ¶
func (ct *Controller) AttachStudentToClassroomStep1(c echo.Context) error
AttachStudentToClassroomStep1 uses a temporary classroom code to attach a student to the classroom. More precisely, it checks the given code and returns a list of student propositions. As a special case, it also accepts a special demo code <DEMO_CODE>.[0-9] which creates a profile linked to the demo classroom.
func (*Controller) AttachStudentToClassroomStep2 ¶
func (ct *Controller) AttachStudentToClassroomStep2(c echo.Context) error
AttachStudentToClassroomStep2 validates the birthday and actually attaches the client to a student account and a classroom.
func (*Controller) CheckStudentClassroom ¶
func (ct *Controller) CheckStudentClassroom(c echo.Context) error
CheckStudentClassroom is called on app startup, to check that the student credentials are still up to date.
func (*Controller) CleanupClassroomCodes ¶
func (ct *Controller) CleanupClassroomCodes() error
func (*Controller) GetDevTokens ¶
func (ct *Controller) GetDevTokens() (string, string, error)
GetDevTokens creates a new user and returns a valid token, so that client frontend doesn't have to use password when developping.
func (*Controller) JWTMiddleware ¶
func (ct *Controller) JWTMiddleware() echo.MiddlewareFunc
func (*Controller) JWTMiddlewareForQuery ¶
func (ct *Controller) JWTMiddlewareForQuery() echo.MiddlewareFunc
expects the token to be in the `token` query parameters
func (*Controller) LoadAdminTeacher ¶
func (ct *Controller) LoadAdminTeacher() (tc.Teacher, error)
LoadAdminTeacher loads and stores the admin account. By convention, only one account has admin rights. It is manually created at DB setup, and never added (neiter removed) at run time.
func (*Controller) LoadDemoClassroom ¶
func (ct *Controller) LoadDemoClassroom() (tc.Classroom, error)
LoadDemoClassroom loads and stores the demo classroom, which is a [Classroom] manually created at DB setup, and attributed to the admin account, with a special ID = 1 .
func (*Controller) Loggin ¶
func (ct *Controller) Loggin(c echo.Context) error
func (*Controller) StudentUpdatePlaylist ¶
func (ct *Controller) StudentUpdatePlaylist(c echo.Context) error
StudentUpdatePlaylist is called to register an event when a student updates its playlist
func (*Controller) TeacherAddStudent ¶
func (ct *Controller) TeacherAddStudent(c echo.Context) error
TeacherAddStudent adds a new student to the given classroom.
func (*Controller) TeacherCreateClassroom ¶
func (ct *Controller) TeacherCreateClassroom(c echo.Context) error
func (*Controller) TeacherDeleteClassroom ¶
func (ct *Controller) TeacherDeleteClassroom(c echo.Context) error
TeacherDeleteClassroom remove the classrooms and all related students
func (*Controller) TeacherDeleteStudent ¶
func (ct *Controller) TeacherDeleteStudent(c echo.Context) error
TeacherDeleteStudent removes the student from the classroom and completely deletes it.
func (*Controller) TeacherGenerateClassroomCode ¶
func (ct *Controller) TeacherGenerateClassroomCode(c echo.Context) error
TeacherGenerateClassroomCode generates a temporary code to link students app to the classroom.
func (*Controller) TeacherGetClassroomStudents ¶
func (ct *Controller) TeacherGetClassroomStudents(c echo.Context) error
func (*Controller) TeacherGetClassrooms ¶
func (ct *Controller) TeacherGetClassrooms(c echo.Context) error
func (*Controller) TeacherGetSettings ¶
func (ct *Controller) TeacherGetSettings(c echo.Context) error
TeacherGetSettings returns the teacher global settings.
func (*Controller) TeacherImportStudents ¶
func (ct *Controller) TeacherImportStudents(c echo.Context) error
TeacherImportStudents import a CSV file generated by Pronote. Other formats could be added in the future.
func (*Controller) TeacherResetPassword ¶
func (ct *Controller) TeacherResetPassword(c echo.Context) error
TeacherResetPassword generates a new password for the given account and sends it by email.
func (*Controller) TeacherUpdateClassroom ¶
func (ct *Controller) TeacherUpdateClassroom(c echo.Context) error
func (*Controller) TeacherUpdateSettings ¶
func (ct *Controller) TeacherUpdateSettings(c echo.Context) error
func (*Controller) TeacherUpdateStudent ¶
func (ct *Controller) TeacherUpdateStudent(c echo.Context) error
TeacherUpdateStudent updates the student profile.
func (*Controller) ValidateInscription ¶
func (ct *Controller) ValidateInscription(c echo.Context) error
type GenerateClassroomCodeOut ¶
type GenerateClassroomCodeOut struct {
Code string
}
type OptionalIdReview ¶
type Origin ¶
type Origin struct { Visibility Visibility PublicStatus PublicStatus IsInReview OptionalIdReview // true if the owner has already started a review for the resource }
type PublicStatus ¶
type PublicStatus uint8
PublicStatus exposes the status of an admin resource
const ( NotAdmin PublicStatus = iota AdminPublic AdminNotPublic )
func NewPublicStatus ¶
func NewPublicStatus(ownerID, userID, adminID teacher.IdTeacher, public bool) PublicStatus
type StudentClassroomHeader ¶
type StudentClassroomHeader struct { Student StudentClient ClassroomName string TeacherMail string // or contact, to be displayed TeacherContactURL string // optional, display a link if provided }
type StudentClient ¶
type StudentExt ¶
type StudentExt struct { Student tc.Student Success evs.StudentAdvance }
type StudentHeader ¶
func NewStudentHeader ¶
func NewStudentHeader(st tc.Student) StudentHeader
type TeacherSettings ¶
type UserMeta ¶
type UserMeta struct { IdTeacher tc.IdTeacher jwt.StandardClaims }
UserMeta are custom claims extending default ones.
type Visibility ¶
type Visibility uint8
Visibility is the status of a ressource, among :
- personnal : read/write acces for the current teacher
- verified by admins : read access only
const ( Hidden Visibility = iota // not accessible by the user, except in reviews Personnal // Personnel Admin // Officiel )
func NewVisibility ¶
func NewVisibility(ownerID, userID, adminID teacher.IdTeacher, public bool) Visibility
NewVisibility returns the visilbity of the ressource owned by `ownerID` and requested by `userID`, or `false` if `userID` does not have access to it.
func (Visibility) Restricted ¶
func (vis Visibility) Restricted() bool
Restricted returns true if the item access if forbidden.