def deauthorizeCheckOut(project_id, slide_id): if not 'username' in session: return render_template("login.html", warning = "Please log-in to the system.") if not slide_id: return illegal_action("error") slide = VCS().load_project(str(project_id)).get_slide(slide_id) if not slide.checkout_user: return illegal_action("error") print slide.checkout_user print session['username'] if slide.checkout_user != session['username'] and dbc.getRole(project_id, session['username']) != 'Project Manager' and dbc.getRole(project_id, session['username']) != 'Presentation Creator': return not_allowed("error") slide.cancel_checkout() flash("Slide %s checkout has been removed" % slide.name) return redirect(url_for("viewPresentations", project_id=project_id))
def tagSlideAsConfidential(project_id): if not 'username' in session: return render_template("login.html", warning = "Please log-in to the system.") role = dbc.getRole(project_id, session['username']) if role != "Project Manager": return not_allowed("error") if request.method == 'POST': slide = request.form['slide_id'] print slide currentSlide = VCS().load_project(str(project_id)).get_slide(slide) if currentSlide.confidential: return show_project(project_id, warning = "Slide is already flagged as confidential.", role = 'Slide Creator', alert = 'warning') if currentSlide.checkout_user != session['username'] and role == 'Slide Creator': return show_project(project_id, warning = "You can't mark a slide as confidential if you're a Slide Creator and haven't checked it out.", role = 'Slide Creator', alert = 'danger') currentSlide.cancel_checkout() currentSlide.confidential = True return show_project(project_id, warning = "Slide has been tagged as confidential.", role = 'Slide Creator', alert = 'danger') return illegal_action("error")