def _set_student_objective(self, userobjective): student_id = userobjective.user_id tutor_id = userobjective.assessor_id objective_id = userobjective.objective_id if User._is_authorised(student_id, tutor_id): self.find_or_include(objective_id=objective_id, student_id=student_id, tutor_id=student_id, by_user=User.main_admin_user(), common_assessors=False)
def _set_common_assessors(self, userobjective): # Set all other members from the student's institution to have the same assessment. Assessment is therefore an institution wide thing bt stored at the individual member level student_id = userobjective.user_id tutor_id = userobjective.assessor_id objective_id = userobjective.objective_id print User._common_assessors(student_id, tutor_id) for member in User._common_assessors(student_id, tutor_id): userobj = self.find_or_include(objective_id=objective_id, student_id=student_id, tutor_id=member.id, by_user=User.main_admin_user(), common_assessors=False) userobj.completed = userobjective.completed db.session.add(userobj) db.session.commit()
role = ROLE_ADMIN) db.session.add(me) head = User(email="*****@*****.**", password="******", name="Head of School", blurb="I have been Headmaster at High School for five years. I'm great.", time_registered=datetime.utcnow(), last_seen=datetime.utcnow(), role = ROLE_USER) db.session.add(head) db.session.commit() courseMe = Institution.create( name = "CourseMe", administrator = User.main_admin_user(), blurb = "This is the main CourseMe institution" ) school = Institution.create( name = "High School", administrator = head, blurb = "This is a great High School. We use CourseMe for everything. We have 100 pupils and they're all doing great." ) for i in range(1, 3): teacher = User(email="teacher" + str(i) + "@server.fake", password="******", name="Mrs. Blogs " + str(i), blurb="I have been a teacher at High School for five years. I'm great.", time_registered=datetime.utcnow(),
role=ROLE_USER) db.session.add(user) head = User( email="*****@*****.**", password="******", name="Head of School", blurb="I have been Headmaster at High School for five years. I'm great.", time_registered=datetime.utcnow(), last_seen=datetime.utcnow(), role=ROLE_USER) db.session.add(head) db.session.commit() courseMe = Institution.create(name="CourseMe", administrator=User.main_admin_user(), blurb="This is the main CourseMe institution") school = Institution.create( name="High School", administrator=head, blurb= "This is a great High School. We use CourseMe for everything. We have 100 pupils and they're all doing great." ) for i in range(1, 3): teacher = User( email="teacher" + str(i) + "@server.fake", password="******", name="Mrs. Blogs " + str(i), blurb="I have been a teacher at High School for five years. I'm great.",
def _check_user_id_or_admin(self, user_id, user): if user_id != user.id and user != User.main_admin_user(): raise NotAuthorised
def _check_user_id_or_admin(self, user_id, user): if user_id != user.id and user != User.main_admin_user(): raise NotAuthorised