def approveComment(self, comment_id): log = logging.getLogger('csdt') log.info("AccountComment.approveComment()") # Removes the flag for the specified comment sql = "UPDATE project_comments SET flag = 0 WHERE id = %s;" % (str(comment_id)) result = database.executeUpdateQuery(sql) # Removes the flag for all users who flagged the specific comment sql = "UPDATE project_comments_ratings SET flag = 0 WHERE proj_comment_id = %s;" % (str(comment_id)) result = database.executeUpdateQuery(sql) return
def changeUserPassword(self, user_id, username, password): log = logging.getLogger('csdt') log.info("AccountPassword.changeUserPassword()") # Changes the password for the user sql = "UPDATE usernames SET pass = '******' WHERE user_id = %s;" % (str(password), str(user_id)) result = database.executeUpdateQuery(sql) # Resets password flag to 0 for the user sql = "UPDATE users SET reset_pass = 0 WHERE id = %s;" % (str(user_id)) result = database.executeUpdateQuery(sql) return
def updateProject(self, proj_id, filename, proj_type): log = logging.getLogger('csdt') log.debug("Upload.updateProject()") sql = "UPDATE projects SET stored_proj_name = '%s', proj_type = '%s' WHERE id = %s;" % (str(filename), str(proj_type), str(proj_id)) result = database.executeUpdateQuery(sql) return
def changeClassFlagCommentLevel(self, user_id, class_id, level): log = logging.getLogger('csdt') log.info("ClassComment.changeClassFlagCommentLevel()") # Updates the classrooms table by changing the flag comments level for all classrooms owned by a particular owner sql = "UPDATE classrooms SET flag_comment_level = %s WHERE id = %s AND owner = %s;" % (str(level), str(class_id), str(user_id)) result = database.executeUpdateQuery(sql) return
def changeUserAboutMe(self, user_id, about): log = logging.getLogger('csdt') log.info("AccountProfile.changeUserAboutMe()") # Updates the usernames table by changing the username for a given user id sql = "UPDATE user_profile SET about = '%s' WHERE user_id = %s;" % (str(about), str(user_id)) result = database.executeUpdateQuery(sql) return
def changeClassDescription(self, class_id, description): log = logging.getLogger("csdt") log.debug("ClassDescription.changeClassDescription()") # Updates the usernames table by changing the username for a given user id sql = "UPDATE classrooms SET description = '%s' WHERE id = %s;" % (str(description), str(class_id)) result = database.executeUpdateQuery(sql) return
def raisePasswordFlag(self, user_id): log = logging.getLogger('csdt') log.info("Classroom.raisePasswordFlag()") # Sets password flag to 1 for the user sql = "UPDATE users SET reset_pass = 1 WHERE id = %s;" % (str(user_id)) result = database.executeUpdateQuery(sql) return
def changeClassPassword(self, class_id, password): log = logging.getLogger('csdt') log.info("ClassPassword.changeClassPassword()") # Changes the password for the class sql = "UPDATE classnames SET pass = '******' WHERE class_id = %s;" % (str(password), str(class_id)) result = database.executeUpdateQuery(sql) return
def changeProjectDescription(self, proj_id, description): log = logging.getLogger('csdt') log.info("Project.changeProjectDescription()") # Updates the project description for the specified project sql = "UPDATE projects SET description = '%s' WHERE id = %s;" % (str(description), str(proj_id)) result = database.executeUpdateQuery(sql) return
def incrementViewCount(self, proj_id): log = logging.getLogger('csdt') log.info("Project.incrementViewCount()") # Updates the number of views for the specified project by 1 sql = "UPDATE projects SET num_views = num_views + 1 WHERE id = %s;" % (str(proj_id)) result = database.executeUpdateQuery(sql) return
def updateResetPasswordCounter(self, user_id, reset_pass_counter): log = logging.getLogger('csdt') log.info("Recover.updateResetPasswordCounter()") reset_pass_counter += 1 # Increment the reset password counter by 1 sql = "UPDATE users SET reset_pass_counter = %s WHERE id = %s;" % (str(reset_pass_counter), str(user_id)) result = database.executeUpdateQuery(sql) return reset_pass_counter
def banComment(self, comment_id): log = logging.getLogger('csdt') log.info("AccountComment.banComment()") # Removes the flag and the comment sql = "UPDATE project_comments SET flag = 0, active = 0 WHERE id = %s;" % (str(comment_id)) result = database.executeUpdateQuery(sql) # Removes the flag for all users who flagged the specific comment sql = "DELETE FROM project_comments_ratings WHERE proj_comment_id = %s;" % (str(comment_id)) result = database.executeDeleteQuery(sql) return