From f1d3a663bfbf500a9d4fb0a1a39a068733c193f8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 17 2014 14:27:36 +0000 Subject: Add method to write down the user's public ssh key where gitolite wants them --- diff --git a/progit/__init__.py b/progit/__init__.py index b8b0589..2771159 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -125,6 +125,16 @@ def generate_gitolite_acls(): os.chdir(cur_wd) +def generate_gitolite_key(user, key): + """ Generate the gitolite ssh key file for the specified user + """ + gitolite_keydir = APP.config.get('GITOLITE_KEYDIR', None) + if gitolite_keydir: + keyfile = os.path.join(gitolite_keydir, '%s.pub' % user) + with open(keyfile, 'w') as stream: + stream.write(key + '\n') + + def cla_required(function): """ Flask decorator to retrict access to CLA signed user. To use this decorator you need to have a function named 'auth_login'.