From 5c8cc516a6bda7b57343c13ee010115ea98ec5c4 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 26 2014 15:40:39 +0000 Subject: Add an admin controller for the admin section of the application --- diff --git a/progit/admin.py b/progit/admin.py new file mode 100644 index 0000000..1ff6a2c --- /dev/null +++ b/progit/admin.py @@ -0,0 +1,44 @@ +#-*- coding: utf-8 -*- + +""" + (c) 2014 - Copyright Red Hat Inc + + Authors: + Pierre-Yves Chibon + +""" + +import flask + +from progit import (APP, SESSION, LOG, cla_required, + generate_gitolite_acls, generate_authorized_key_file) + + + +### Application + + +@APP.route('/admin') +def admin_index(): + """ Front page of the admin section of the application. + """ + + return flask.render_template( + 'admin_index.html', + ) + + +@APP.route('/admin/gitolite') +def admin_generate_acl(): + """ Regenerate the gitolite ACL file. """ + generate_gitolite_acls() + flask.flash('Gitolite ACLs updated') + return flask.redirect(flask.url_for('admin_index')) + + +@APP.route('/admin/ssh') +def admin_refresh_ssh(): + """ Regenerate the gitolite ACL file. """ + generate_authorized_key_file() + flask.flash('Authorized file updated') + return flask.redirect(flask.url_for('admin_index'))