Documentation ¶
Overview ¶
Package session provides the material to implement the security layer. A session restrict the operation that are authorized by the session owner, depending on its identity or his role
Index ¶
- Variables
- type Session
- func (s *Session) AddJuryToDefenseSession(room, id, jury string) error
- func (s *Session) Convention(stu string) (schema.Convention, error)
- func (s *Session) Conventions() ([]schema.Convention, *feeder.ImportError)
- func (s *Session) Defense(stu string) (schema.Defense, error)
- func (s *Session) DefenseProgram() ([]schema.DefenseSession, error)
- func (s *Session) DefenseSession(room, id string) (schema.DefenseSession, error)
- func (s *Session) DefenseSessions() ([]schema.DefenseSession, error)
- func (s *Session) DelJuryToDefenseSession(room, id, jury string) error
- func (s *Session) InMyMajor(student string) bool
- func (s *Session) Internship(stu string) (schema.Internship, error)
- func (s *Session) Internships() (schema.Internships, error)
- func (s *Session) JuryOf(student string) bool
- func (s *Session) Me() schema.User
- func (s *Session) Myself(email string) bool
- func (s *Session) NewDefenseSession(room string, id string) (schema.DefenseSession, error)
- func (s *Session) NewInternship(c schema.Convention) (schema.Internship, []byte, error)
- func (s *Session) NewStudent(p schema.Person, major, promotion string, male bool) error
- func (s *Session) NewUser(p schema.Person, role schema.Role) ([]byte, error)
- func (s *Session) ReplaceUserWith(src, dst string) error
- func (s *Session) Report(kind, email string) (schema.ReportHeader, error)
- func (s *Session) ReportContent(kind, email string) ([]byte, error)
- func (s *Session) ResetSurvey(student, kind string) error
- func (s *Session) RmDefense(student string) error
- func (s *Session) RmDefenseSession(room string, id string) error
- func (s *Session) RmSession(em string) error
- func (s *Session) RmUser(email string) error
- func (s *Session) Role() schema.Role
- func (s *Session) SetAlumni(student string, a schema.Alumni) error
- func (s *Session) SetCompany(stu string, c schema.Company) error
- func (s *Session) SetDefenseGrade(stu string, grade int) error
- func (s *Session) SetEmail(old, cur string) error
- func (s *Session) SetMajor(student string, m string) error
- func (s *Session) SetMale(student string, male bool) error
- func (s *Session) SetPromotion(student string, p string) error
- func (s *Session) SetReportContent(kind, email string, cnt []byte) (time.Time, error)
- func (s *Session) SetReportDeadline(kind, email string, t time.Time) error
- func (s *Session) SetReportGrade(kind, email string, g int, comment string) (time.Time, error)
- func (s *Session) SetReportPrivacy(kind, email string, p bool) error
- func (s *Session) SetStudentDefense(session, room, student string, t time.Time, public, local bool) error
- func (s *Session) SetStudentSkippable(em string, st bool) error
- func (s *Session) SetSupervisor(stu string, sup schema.Person) error
- func (s *Session) SetSurveyInvitation(student, kind string) (time.Time, error)
- func (s *Session) SetTutor(stu string, t string) error
- func (s *Session) SetUserPerson(p schema.Person) error
- func (s *Session) SetUserRole(email string, priv schema.Role) error
- func (s *Session) Student(stu string) (schema.Student, error)
- func (s *Session) Students() (schema.Students, error)
- func (s *Session) Survey(student, kind string) (schema.SurveyHeader, error)
- func (s *Session) Tutoring(student string) bool
- func (s *Session) UpdateStudentDefense(student string, t time.Time, public, local bool) error
- func (s *Session) User(em string) (schema.User, error)
- func (s *Session) Users() ([]schema.User, error)
- func (s *Session) Watching(student string) bool
Constants ¶
This section is empty.
Variables ¶
var ( //ErrPermission indicates an operation that is not permitted ErrPermission = errors.New("Permission denied") )
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session restricts the operation that can be executed by the current user with regards to its role and or relationships
func AnonSession ¶
AnonSession creates a session that is not attached to a particular user
func NewSession ¶
NewSession creates a new session
func (*Session) AddJuryToDefenseSession ¶
func (*Session) Convention ¶
func (s *Session) Convention(stu string) (schema.Convention, error)
Convention returns the convention of a given student if the emitter is the student or at least an admin
func (*Session) Conventions ¶
func (s *Session) Conventions() ([]schema.Convention, *feeder.ImportError)
Conventions lists the conventions if the emitter is an admin at minimum
func (*Session) DefenseProgram ¶
func (s *Session) DefenseProgram() ([]schema.DefenseSession, error)
func (*Session) DefenseSession ¶
func (s *Session) DefenseSession(room, id string) (schema.DefenseSession, error)
func (*Session) DefenseSessions ¶
func (s *Session) DefenseSessions() ([]schema.DefenseSession, error)
DefenseSessions returns all the sessions Unfiltered for an admin and more. Otherwise, filter out the sessions I am not a jury member of
func (*Session) DelJuryToDefenseSession ¶
func (*Session) Internship ¶
func (s *Session) Internship(stu string) (schema.Internship, error)
Internship returns the internship of the emitter or if the emitter is at least a major leader
func (*Session) Internships ¶
func (s *Session) Internships() (schema.Internships, error)
Internships list the internships if the emitter is at least a major leader. Otherwise, all the internships now tutored by the emitter are removed
func (*Session) JuryOf ¶
JuryOf checks if I am in a jury for a defense. That if indeed I am in the jury, or an admin
func (*Session) NewDefenseSession ¶
func (*Session) NewInternship ¶
func (s *Session) NewInternship(c schema.Convention) (schema.Internship, []byte, error)
NewInternship validates the convention if the emitter is an admin at minimum
func (*Session) NewStudent ¶
NewStudent creates a new student account if the emitter is an admin at least
func (*Session) ReplaceUserWith ¶
ReplaceUserWith allowed if the emitter is an admin at least
func (*Session) Report ¶
func (s *Session) Report(kind, email string) (schema.ReportHeader, error)
Report returns a report header if the emitter if the student or if he is watching the student
func (*Session) ReportContent ¶
ReportContent returns the report content if the emitter is the report owner, the tutor or a root. if the report is private, no one else can access the report. Otherwise, the major leader and the admins can access the reports
func (*Session) ResetSurvey ¶
ResetSurvey if the emitter is at least an administrator
func (*Session) RmSession ¶
RmSession delete the session if the emitter is the session owner or at least an admin
func (*Session) RmUser ¶
RmUser removes an account if the emitter is at least an admin and not himself
func (*Session) SetAlumni ¶
SetAlumni changes the student next position if the emitter is the targetted student, the tutor, a member of his jury or a major leader at minimum
func (*Session) SetCompany ¶
SetCompany changes the company if the emitter is the student or an admin at minimum
func (*Session) SetMajor ¶
SetMajor changes the student major if the emitter is the student or at least a major leader
func (*Session) SetMale ¶
SetMale changes the student gender if the emitter is the student itself, the tutor or an admin at minimum
func (*Session) SetPromotion ¶
SetPromotion changes the student promotion if the emitter is the student himself or a major leader at least
func (*Session) SetReportContent ¶
SetReportContent store a report. If the emitter is the current student, it is allowed if the deadline is not passed or if no report has already been uploaded
func (*Session) SetReportDeadline ¶
SetReportDeadline changes the report deadline if the emitter tutors the student or is an admin at minimum
func (*Session) SetReportGrade ¶
SetReportGrade set the report grade if the emitter is the student tutor or an admin at minimum
func (*Session) SetReportPrivacy ¶
SetReportPrivacy changes the report privacy status if the emitter tutors the student or is an admin at minimum
func (*Session) SetStudentDefense ¶
func (*Session) SetStudentSkippable ¶
SetStudentSkippable change the skippable status if the emitter is a major leader at minimum
func (*Session) SetSupervisor ¶
SetSupervisor changes the supervisor if the emitter is the student or an admin at minimum
func (*Session) SetSurveyInvitation ¶
SetSurveyInvitation is ok if the emitter is at least an administrator
func (*Session) SetUserPerson ¶
SetUserPerson set the user profile if the emitter is the targeted user
func (*Session) SetUserRole ¶
SetUserRole changes the user privileges if the emitter is an admin at minimum and not himself
func (*Session) Survey ¶
func (s *Session) Survey(student, kind string) (schema.SurveyHeader, error)
Survey get the given survey for a student if the emitter is the student tutor or a major admin at least