From 98cbb8514b0b3394ecb9fa9894fc93c2ceeda3af Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Wed, 23 Nov 2011 16:44:25 -0800
Subject: [PATCH 001/107] Added hooks, policy and rakefile to install selinux
policy for this plugin
---
.gitignore | 2 +
README.mkd | 38 +++
app/models/git_hosting_settings_observer.rb | 23 +-
.../settings/_redmine_git_hosting.html.erb | 7 +-
config/locales/bg.yml | 1 +
config/locales/bs.yml | 1 +
config/locales/ca.yml | 1 +
config/locales/cs.yml | 1 +
config/locales/da.yml | 1 +
config/locales/de.yml | 1 +
config/locales/el.yml | 1 +
config/locales/en.yml | 1 +
config/locales/es.yml | 1 +
config/locales/fi.yml | 1 +
config/locales/fr.yml | 1 +
config/locales/gl.yml | 1 +
config/locales/he.yml | 1 +
config/locales/hu.yml | 1 +
config/locales/id.yml | 1 +
config/locales/it.yml | 1 +
config/locales/ja.yml | 1 +
config/locales/ko.yml | 1 +
config/locales/lt.yml | 1 +
config/locales/nl.yml | 1 +
config/locales/no.yml | 1 +
config/locales/pl.yml | 1 +
config/locales/pt-BR.yml | 1 +
config/locales/pt.yml | 1 +
config/locales/ro.yml | 1 +
config/locales/ru.yml | 1 +
config/locales/sk.yml | 1 +
config/locales/sl.yml | 1 +
config/locales/sr.yml | 1 +
config/locales/sv.yml | 1 +
config/locales/th.yml | 1 +
config/locales/tr.yml | 1 +
config/locales/uk.yml | 1 +
config/locales/vi.yml | 1 +
config/locales/zh-TW.yml | 1 +
config/locales/zh.yml | 1 +
lib/git_hosting.rb | 62 +++-
selinux/README | 67 +++++
selinux/redmine_git.fc | 9 +
selinux/redmine_git.if | 131 +++++++++
selinux/redmine_git.pp | Bin 0 -> 127822 bytes
selinux/redmine_git.sh | 44 +++
selinux/redmine_git.te | 69 +++++
tasks/selinux.rake | 273 ++++++++++++++++++
48 files changed, 739 insertions(+), 22 deletions(-)
create mode 100644 selinux/README
create mode 100644 selinux/redmine_git.fc
create mode 100644 selinux/redmine_git.if
create mode 100644 selinux/redmine_git.pp
create mode 100755 selinux/redmine_git.sh
create mode 100644 selinux/redmine_git.te
create mode 100644 tasks/selinux.rake
diff --git a/.gitignore b/.gitignore
index a01ee289f..5412c5a54 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
.*.swp
+bin/
+selinux/tmp/
diff --git a/README.mkd b/README.mkd
index 945b9cf82..dfae03514 100755
--- a/README.mkd
+++ b/README.mkd
@@ -246,6 +246,44 @@ This library allows you to quickly deploy ChiliProject, with this plugin to an u
chili\_test.sh script, modifying the variables in those scripts as desired. This library is still under development,
so these instructions may need to be updated in the near future.
+## Selinux Configuration for redmine
+
+This plugin can be configured to run with selinux. We have included a rakefile in tasks/selinux.rake to assist
+with installing with selinux. You should start by editing init.rb and migrating as described above. Then, you
+can execute one of the selinux rake tasks (from the redmine root). For instance, the simplest option installs
+a selinux configuration for both redmine and the redmine_git_hosting plugin:
+
+ rake selinux:install RAILS_ENV=production
+
+This will generate the redmine_git_hosting binaries in ./bin, install a selinux policy for these binaries (called
+redmine_git.pp), then install a complete context for redmine as follows:
+
+**(1)** Most of redmine will be marked with "public_content_rw_t".
+
+**(2)** The dispatch files in Rails.root/public/dispatch.* will be marked with "httpd_sys_script_exec_t"
+
+**(3)** The redmine_git_hosting binaries in Rails.root/vendor/plugins/redmine_git_hosting/bin will be labeled
+with "httpd_redmine_git_script_exec_t", which has been crafted to allow the sudo behavior required by these
+binaries.
+
+Note that this rake file has additional options. For instance, you can specify redmine roots with regular
+expressions (not globbed expessions!) as follows (notice the use of double quotes):
+
+ rake selinux:install RAILS_ENV=production ROOT_PATTERN="/source/.*/redmine"
+
+These additional options are documented in the selinux.rake file.
+
+Once this plugin is placed under selinux control, three of the redmine_git_hosting settings can
+no longer be modified from the settings page. They are: 'gitUser', 'gitoliteIdentityFile', and
+'gitoliteIdentityPublicKeyFile'. The plugin settings page will make this clear. The simplest way to
+modify these options is to temporarily place your system into permissive mode, refresh the setting page,
+change options, then place your system back into enforcing mode. Alternatively, you can alter the init.rb
+file and reinstall the plugin. Under normal operation, you will get one selinux complaint about /bin/touch
+in your log each time that you visit the plugin settings page.
+
+This rakefile and selinux configuration has been primarily tested on Redhat Enterprise Linux version 6.x
+with apache and fcgi. Other configurations may require slight tweaking.
+
## Tested Configurations
This plugin has been primarily tested on Ubuntu Server 10.10 and 11.04 (32 and 64 bit) with ChiliProject v1.x,
diff --git a/app/models/git_hosting_settings_observer.rb b/app/models/git_hosting_settings_observer.rb
index fee8d8a3f..fcd16e9ae 100644
--- a/app/models/git_hosting_settings_observer.rb
+++ b/app/models/git_hosting_settings_observer.rb
@@ -5,6 +5,8 @@ class GitHostingSettingsObserver < ActiveRecord::Observer
@@old_hook_asynch = Setting.plugin_redmine_git_hosting['gitHooksAreAsynchronous']
@@old_http_server = Setting.plugin_redmine_git_hosting['httpServer']
@@old_git_user = Setting.plugin_redmine_git_hosting['gitUser']
+ @@old_gitolite_identity = Setting.plugin_redmine_git_hosting['gitoliteIdentityFile']
+ @@old_gitolite_publickey = Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']
@@old_repo_base = Setting.plugin_redmine_git_hosting['gitRepositoryBasePath']
@@ -14,12 +16,25 @@ def reload_this_observer
end
end
-
-
+ def before_save(object)
+ if object.name == "plugin_redmine_git_hosting" && !GitHosting.bin_dir_writeable?
+ # If bin directory not alterable, don't alow changes to
+ # Git Username, or Gitolite public or private keys
+ valuehash = object.value
+ valuehash['gitUser'] = @@old_git_user
+ valuehash['gitoliteIdentityFile'] = @@old_gitolite_identity
+ valuehash['gitoliteIdentityPublicKeyFile'] = @@old_gitolite_publickey
+ object.value = valuehash
+ end
+ end
+
def after_save(object)
if object.name == "plugin_redmine_git_hosting"
- %x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]
+ if GitHosting.bin_dir_writeable?
+ %x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]
+ %x[ rm -rf '#{ GitHosting.get_bin_dir }' ]
+ end
if @@old_repo_base != object.value['gitRepositoryBasePath']
GitHostingObserver.set_update_active(false)
@@ -49,6 +64,8 @@ def after_save(object)
@@old_hook_asynch = object.value['gitHooksAreAsynchronous']
@@old_http_server = object.value['httpServer']
@@old_git_user = object.value['gitUser']
+ @@old_gitolite_identity = object.value['gitoliteIdentityFile']
+ @@old_gitolite_publickey = object.value['gitoliteIdentityPublicKeyFile']
@@old_repo_base = object.value['gitRepositoryBasePath']
end
diff --git a/app/views/settings/_redmine_git_hosting.html.erb b/app/views/settings/_redmine_git_hosting.html.erb
index c6b1e7760..9e6527c84 100644
--- a/app/views/settings/_redmine_git_hosting.html.erb
+++ b/app/views/settings/_redmine_git_hosting.html.erb
@@ -26,19 +26,19 @@
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/el.yml b/config/locales/el.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/id.yml b/config/locales/id.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index e9989cd0e..96dc0a6df 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -7,6 +7,9 @@ pt-BR:
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
+ label_git_recycle_base_path: 'Directório Recycle Bin base (Relativo à "home" do utilizador git)'
+ label_git_recycle_expire_time: 'expirar o tempo para Recycle Bin (em horas)'
+ label_git_lock_wait_time: 'Sincronização de bloqueio o tempo de espera (em segundos)'
label_cannot_change_selinux: 'não pode ser mudada (selinux)'
field_git_daemon: Git Daemon
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index f6db9e33d..cf033316f 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -7,6 +7,9 @@ pt:
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
+ label_git_recycle_base_path: 'Directório Recycle Bin base (Relativo à "home" do utilizador git)'
+ label_git_recycle_expire_time: 'expirar o tempo para Recycle Bin (em horas)'
+ label_git_lock_wait_time: 'Sincronização de bloqueio o tempo de espera (em segundos)'
label_cannot_change_selinux: 'não pode ser mudada (selinux)'
field_git_daemon: Git Daemon
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 723401ce1..b8c50fb92 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -6,7 +6,10 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
- label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
+ label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
+ label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
+ label_git_lock_wait_time: Synchronization Lock Wait Time (in seconds)
label_cannot_change_selinux: Cannot be changed under selinux
field_git_daemon: Git Daemon
diff --git a/db/migrate/20111123214911_add_settings_to_plugin.rb b/db/migrate/20111123214911_add_settings_to_plugin.rb
new file mode 100644
index 000000000..dc801779c
--- /dev/null
+++ b/db/migrate/20111123214911_add_settings_to_plugin.rb
@@ -0,0 +1,34 @@
+class AddSettingsToPlugin < ActiveRecord::Migration
+ def self.up
+ begin
+ # Add some new settings to settings page, if they don't exist
+ valuehash = (Setting.plugin_redmine_git_hosting).clone
+ valuehash['gitRecycleBasePath'] ||= 'recycle_bin/'
+ valuehash['gitRecycleExpireTime'] ||= '24.0'
+ valuehash['gitLockWaitTime'] ||= '10'
+ if (Setting.plugin_redmine_git_hosting != valuehash)
+ Setting.plugin_redmine_git_hosting = valuehash
+ say "Added redmine_git_hosting settings: 'gitRecycleBasePath', 'getRecycleExpireTime', 'getLockWaitTime'"
+ end
+ rescue
+ # ignore problems if plugin settings don't exist yet
+ end
+ end
+
+ def self.down
+ begin
+ # Remove above settings from plugin page
+ valuehash = (Setting.plugin_redmine_git_hosting).clone
+ valuehash.delete('gitRecycleBasePath')
+ valuehash.delete('gitRecycleExpireTime')
+ valuehash.delete('gitLockWaitTime')
+ if (Setting.plugin_redmine_git_hosting != valuehash)
+ Setting.plugin_redmine_git_hosting = valuehash
+ say "Removed redmine_git_hosting settings: 'gitRecycleBasePath', 'getRecycleExpireTime', 'getLockWaitTime'"
+ end
+ Setting.plugin_redmine_git_hosting = valuehash
+ rescue
+ # ignore problems if table doesn't exist yet....
+ end
+ end
+end
diff --git a/init.rb b/init.rb
index 721cdbaca..485b3dc77 100755
--- a/init.rb
+++ b/init.rb
@@ -12,11 +12,15 @@
description 'Enables Redmine / ChiliProject to control hosting of git repositories'
version '0.4.2'
url 'https://github.com/ericpaulbishop/redmine_git_hosting'
+
settings :default => {
- 'httpServer' => 'localhost',
- 'gitServer' => 'localhost',
- 'gitUser' => 'git',
+ 'httpServer' => "tessellation.cs.berkeley.edu/redmine",
+ 'gitServer' => 'tessellation.cs.berkeley.edu',
+ 'gitUser' => 'git-tess',
'gitRepositoryBasePath' => 'repositories/',
+ 'gitRecycleBasePath' => 'recycle_bin/',
+ 'gitRecycleExpireTime' => '24.0',
+ 'gitLockWaitTime' => '10',
'gitoliteIdentityFile' => RAILS_ROOT + '/.ssh/gitolite_admin_id_rsa',
'gitoliteIdentityPublicKeyFile' => RAILS_ROOT + '/.ssh/gitolite_admin_id_rsa.pub',
'allProjectsUseGit' => 'false',
diff --git a/lib/git_hosting.rb b/lib/git_hosting.rb
index 07aa7e0e3..829faa448 100755
--- a/lib/git_hosting.rb
+++ b/lib/git_hosting.rb
@@ -2,17 +2,34 @@
require 'net/ssh'
require 'tempfile'
require 'tmpdir'
+require 'stringio'
require 'gitolite_conf.rb'
+require 'gitolite_recycle.rb'
require 'git_adapter_hooks.rb'
module GitHosting
+ LOCK_WAIT_IF_UNDEF = 10 # In case settings not migrated (normally from settings)
+ REPOSITORY_IF_UNDEF = "repositories/" # In case settings not migrated (normally from settings)
+ # Used to register errors when pulling and pushing the conf file
+ class GitHostingException < StandardError
+ end
+
+ # Time in seconds to wait before giving up on acquiring the lock
+ def self.lock_wait_time
+ Setting.plugin_redmine_git_hosting['gitLockWaitTime'].to_i || LOCK_WAIT_IF_UNDEF
+ end
+
+ # Repository base path (relative to git user home directory)
+ def self.repository_base
+ Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'] || REPOSITORY_IF_UNDEF
+ end
+
+ @@logger = nil
def self.logger
- # it may be useful to redefine this for some debugging purposes
- # but by default, we're just going to use the default Rails logger
- return Rails.logger
+ @@logger ||= MyLogger.new
end
@@web_user = nil
@@ -31,7 +48,6 @@ def self.git_user
Setting.plugin_redmine_git_hosting['gitUser']
end
-
@@mirror_pubkey = nil
def self.mirror_push_public_key
if @@mirror_pubkey.nil?
@@ -124,7 +140,7 @@ def self.repository_name project
end
def self.repository_path project
- return File.join(Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'], repository_name(project)) + ".git"
+ return File.join(repository_base, repository_name(project)) + ".git"
end
def self.add_route_for_project(p)
@@ -162,7 +178,7 @@ def self.get_bin_dir
@@git_hosting_bin_dir ||=
Rails.root.join("vendor/plugins/redmine_git_hosting/bin")
if !File.directory?(@@git_hosting_bin_dir)
- logger.error "Creating bin directory: #{@@git_hosting_bin_dir}, Owner #{web_user}"
+ logger.info "Creating bin directory: #{@@git_hosting_bin_dir}, Owner #{web_user}"
%x[mkdir -p "#{@@git_hosting_bin_dir}"]
%x[chmod 750 "#{@@git_hosting_bin_dir}"]
%x[chown #{web_user} "#{@@git_hosting_bin_dir}"]
@@ -195,14 +211,14 @@ def self.bin_dir_writeable?(*option)
end
def self.git_exec_path
- return File.join(get_bin_dir(), "run_git_as_git_user")
+ return File.join(get_bin_dir, "run_git_as_git_user")
end
def self.gitolite_ssh_path
- return File.join(get_bin_dir(), "gitolite_admin_ssh")
+ return File.join(get_bin_dir, "gitolite_admin_ssh")
end
def self.git_user_runner_path
- return File.join(get_bin_dir(), "run_as_git_user")
+ return File.join(get_bin_dir, "run_as_git_user")
end
@@ -227,7 +243,7 @@ def self.git_user_runner
def self.update_git_exec
- logger.info "Setting up #{get_bin_dir()}"
+ logger.info "Setting up #{get_bin_dir}"
gitolite_key=Setting.plugin_redmine_git_hosting['gitoliteIdentityFile']
File.open(gitolite_ssh_path(), "w") do |f|
@@ -290,16 +306,14 @@ def self.update_git_exec
File.chmod(0550, git_exec_path())
File.chmod(0550, gitolite_ssh_path())
File.chmod(0550, git_user_runner_path())
- %x[chown #{web_user} -R "#{@@git_hosting_bin_dir}"]
+ %x[chown #{web_user} -R "#{get_bin_dir}"]
end
-
@@lock_file = nil
def self.lock(retries)
is_locked = false
- local_dir = get_tmp_dir()
if @@lock_file.nil?
- @@lock_file=File.new(File.join(local_dir,'redmine_git_hosting_lock'),File::CREAT|File::RDONLY)
+ @@lock_file=File.new(File.join(get_tmp_dir,'redmine_git_hosting_lock'),File::CREAT|File::RDONLY)
end
while retries > 0
@@ -318,195 +332,451 @@ def self.unlock
end
end
+ def self.shell(command)
+ begin
+ my_command = "#{command} 2>&1"
+ result = %x[#{my_command}].chomp
+ code = $?.exitstatus
+ rescue Exception => e
+ result=e.message
+ code = -1
+ end
+ if code != 0
+ logger.error "Command failed (return #{code}): #{command}"
+ logger.error "#{result}"
+ raise GitHostingException, "Shell Error"
+ end
+ end
+ # Try to get a cloned version of gitolite-admin repository.
+ #
+ # This code tries to recover from a variety of errors which have been observed
+ # in the field, including a loss of the admin key and an empty top-level directory
+ #
+ # Return: false => have uncommitted changes
+ # true => directory on master
+ #
+ # This routine must only be called after acquisition of the lock
+ #
+ # John Kubiatowicz, 11/15/11
def self.clone_or_pull_gitolite_admin
# clone/pull from admin repo
- local_dir = get_tmp_dir()
- if File.exists? "#{local_dir}/gitolite-admin"
- logger.info "Fetching changes for #{local_dir}/gitolite-admin"
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' fetch]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' merge FETCH_HEAD]
- else
- logger.info "Cloning gitolite-admin repository"
- %x[env GIT_SSH=#{gitolite_ssh()} git clone #{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}:gitolite-admin.git #{local_dir}/gitolite-admin]
- end
- %x[chmod 700 "#{local_dir}/gitolite-admin" ]
- # Make sure we have our hooks setup
- GitAdapterHooks.check_hooks_installed
+ repo_dir = File.join(get_tmp_dir,"gitolite-admin")
+ begin
+ if (File.exists? "#{repo_dir}") && (File.exists? "#{repo_dir}/.git") && (File.exists? "#{repo_dir}/keydir") && (File.exists? "#{repo_dir}/conf")
+ logger.info "Fetching changes from gitolite-admin repository to #{repo_dir}"
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' fetch]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' merge FETCH_HEAD]
+
+ # unmerged changes=> non-empty return
+ return_val = %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' status --short].empty?
+ else
+ logger.info "Cloning gitolite-admin repository to #{repo_dir}"
+ shell %[rm -rf "#{repo_dir}"]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git clone #{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}:gitolite-admin.git #{repo_dir}]
+ return_val = true # on master, since fresh clone
+ end
+ shell %[chmod 700 "#{repo_dir}" ]
+ # Make sure we have our hooks setup
+ GitAdapterHooks.check_hooks_installed
+
+ return return_val
+ rescue
+ # Hm.... perhaps we have some other sort of failure...
+ logger.error "Failure to access gitolite-admin repository. Attempting to fix..."
+ begin
+ logger.info " Reestablishing gitolite key"
+ shell %[cat #{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']} | #{GitHosting.git_user_runner} 'cat > ~/id_rsa.pub']
+ shell %[#{GitHosting.git_user_runner} 'gl-setup ~/id_rsa.pub']
+ shell %[#{GitHosting.git_user_runner} 'rm ~/id_rsa.pub']
+
+ logger.info " Deleting and recloning gitolite-admin to #{repo_dir}"
+ shell %[rm -r #{repo_dir}] unless !File.exists?(repo_dir)
+ shell %[env GIT_SSH=#{gitolite_ssh()} git clone #{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}:gitolite-admin.git #{repo_dir}]
+ shell %[chmod 700 "#{repo_dir}" ]
+ # Make sure we have our hooks setup
+ GitAdapterHooks.check_hooks_installed
+ logger.info "Successfully restablished access to gitolite-admin repository!"
+ rescue
+ logger.error "Failure again. Probably requires human intervention"
+ raise GitHostingException, "Gitolite-admine Clone Failure"
+ end
+ end
end
- def self.move_repository(old_name, new_name)
- old_path = File.join(Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'], "#{old_name}.git")
- new_path = File.join(Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'], "#{new_name}.git")
+ # Commit Changes to the gitolite-admin repository. This assumes that repository exists
+ # (i.e. that a clone_or_fetch_gitolite_admin has already be called).
+ #
+ # This routine must only be called after acquisition of the lock
+ #
+ # John Kubiatowicz, 11/15/11
+ def self.commit_gitolite_admin(*args)
+ resyncing = args && args.first
# create tmp dir, return cleanly if, for some reason, we don't have proper permissions
- local_dir = get_tmp_dir()
+ repo_dir = File.join(get_tmp_dir,"gitolite-admin")
+
+ # commit / push changes to gitolite admin repo
+ begin
+ if (!resyncing)
+ logger.info "Committing changes to gitolite-admin repository"
+ message = "Updated by Redmine"
+ else
+ logger.info "Committing corrections to gitolite-admin repository"
+ message = "Updated by Redmine: Corrections discovered during RESYNC_ALL"
+ end
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add keydir/*]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add conf/gitolite.conf]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.email '#{Setting.mail_from}']
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.name 'Redmine']
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' commit -a -m '#{message}']
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' push ]
+ rescue
+ logger.error "Problems committing changes to gitolite-admin repository!! Probably requires human intervention"
+ raise GitHostingException, "Gitlite-admin Commit Failure"
+ end
+ end
+ def self.move_repository(old_name, new_name)
#lock
- if !lock(5)
+ if !lock(lock_wait_time)
+ logger.error "git_hosting: move_repository() exited without acquiring lock!"
return
end
-
- # Make sure we have gitoite-admin cloned
- clone_or_pull_gitolite_admin
-
- # rename in conf file
- conf = GitoliteConfig.new(File.join(local_dir, 'gitolite-admin', 'conf', 'gitolite.conf'))
- conf.rename_repo( old_name, new_name )
- conf.save
+ begin
+ # Make sure we have gitoite-admin cloned
+ clone_or_pull_gitolite_admin
- # physicaly move the repo BEFORE committing/pushing conf changes to gitolite admin repo
- %x[#{git_user_runner} 'mkdir -p "#{new_path}"']
- %x[#{git_user_runner} 'rmdir "#{new_path}"']
- %x[#{git_user_runner} 'mv "#{old_path}" "#{new_path}"']
+ old_path = File.join(repository_base, "#{old_name}.git")
+ new_path = File.join(repository_base, "#{new_name}.git")
+
+ logger.warn "Adjusting position of repository from '#{old_name}' to '#{new_name}' in gitolite.conf"
+
+ # rename in conf file
+ conf = GitoliteConfig.new(File.join(get_tmp_dir, 'gitolite-admin', 'conf', 'gitolite.conf'))
+ conf.rename_repo( old_name, new_name )
+ conf.save
+
+ logger.warn " Moving repository from '#{old_path}' to '#{new_path}' in gitolite repository"
+
+ # physicaly move the repo BEFORE committing/pushing conf changes to gitolite admin repo
+ prefix = new_name[/.*(?=\/)/] # Complete directory path (if exists) without trailing '/'
+ if prefix
+ # Has subdirectory. Must construct destination directory
+ repo_prefix = File.join(repository_base, prefix)
+ GitHosting.shell %[#{git_user_runner} mkdir -p '#{repo_prefix}']
+ end
+ shell %[#{git_user_runner} 'mv "#{old_path}" "#{new_path}"']
+
+ # If any empty directories left behind, try to delete them. Ignore failure.
+ old_prefix = old_name[/.*?(?=\/)/] # Top-level old directory without trailing '/'
+ if old_prefix
+ repo_subpath = File.join(repository_base, old_prefix)
+ result = %x[#{GitHosting.git_user_runner} find '#{repo_subpath}' -type d ! -regex '.*\.git/.*' -empty -depth -delete -print].chomp.split("\n")
+ result.each { |dir| logger.warn " Removing empty repository subdirectory: #{dir}"}
+ end
+
+ # Commit / push changes to gitolite admin repo
+ commit_gitolite_admin
+
+ rescue GitHostingException
+ logger.error "git_hosting: move_repository() failed"
+ rescue => e
+ logger.error e.message
+ logger.error e.backtrace[0..4].join("\n")
+ logger.error "git_hosting: move_repository() failed"
+ end
+ # unlock
+ unlock()
+ end
+
+ # Delete repository from specified project.
+ #
+ # We remove all redmine keys from the repository access rights.
+ # There are then three options:
+ #
+ # 1) The repo has non-redmine keys => we leave it alone
+ # 2) The repo has no keys left, but repository delete is not enabled
+ # => will leave repository alone with redmine_dummy_key
+ # 3) The repo has no keys left and repository delete is enabled
+ # => will delete repository
+ def self.delete_repository(project)
+ # Grab lock
+ if !lock(lock_wait_time)
+ logger.error "git_hosting: delete_repository() exited without acquiring lock!"
+ return
+ end
- # commit / push changes to gitolite admin repo
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' add keydir/*]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' add conf/gitolite.conf]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' config user.email '#{Setting.mail_from}']
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' config user.name 'Redmine']
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' commit -a -m 'updated by Redmine' ]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' push ]
+ begin
+ # Make sure we have gitolite-admin cloned
+ clone_or_pull_gitolite_admin
- # unlock
+ repo_name = repository_name(project)
+
+ conf = GitoliteConfig.new(File.join(get_tmp_dir, 'gitolite-admin', 'conf', 'gitolite.conf'))
+
+ # Kill off redmine keys
+ conf.delete_redmine_keys repo_name
+
+ if Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true"
+ if conf.repo_has_no_keys? repo_name
+ logger.warn "Deleting repository '#{repo_name}' from gitolite.conf"
+ conf.delete_repo repo_name
+ GitoliteRecycle.move_repository_to_recycle repo_name
+ else
+ logger.warn "Repository '#{repo_name}' not deleted from gitolite.conf (non-redmine keys present and preserved)"
+ end
+ else
+ logger.warn "Deleting all redmine keys for repository '#{repo_name}' from gitolite.conf"
+ end
+
+ conf.save
+
+ # Commit / push changes to gitolite admin repo
+ commit_gitolite_admin
+
+ rescue GitHostingException
+ logger.error "git_hosting: delete_repository() failed"
+ rescue => e
+ logger.error e.message
+ logger.error e.backtrace[0..4].join("\n")
+ logger.error "git_hosting: delete_repository() failed"
+ end
unlock()
-
end
+ # Update keys for all members of projects of interest
+ #
+ # This code is entirely self-correcting for keys owned by users of the specified
+ # projects. It should work regardless of the history of steps that got us here.
+ #
+ # Note that this code has changed from the original. Now, we look at all keys owned
+ # by users in the specified projects to make sure that they are still live. We
+ # do this with a single pass through the keydir and do not rely on the "inactive"
+ # status to tell us that a key should be deleted. The reason is that weird
+ # synchronization issues (not entirely understood) can cause phantom keys to get left
+ # in the keydir which can really mess up gitolite.
+ #
+ # Also, when performing :resync_all, if the 'deleteGitRepositories' setting is 'true',
+ # then we will remove repositories in the gitolite.conf file that are identifiable as
+ # "redmine managed" (because they have one or more keys of the right form) but which
+ # are nolonger live for some reason (probably because the project was deleted).
+ #
+ # John Kubiatowicz, 11/15/11
+ #
+ # Usage:
+ #
+ # 1) update_repositories(project) => update for specified project
+ # 2) update_repositories([list of projects]) => update all projects
+ # 3) update_repositories(:flag1=>true, :flag2 => false)
+ #
+ # Current flags:
+ # :resync_all => go through all redmine-maintained gitolite repos,
+ # clean up keydir, delete unused keys, clean up gitolite.conf
@@recursionCheck = false
- def self.update_repositories(projects, is_repo_delete)
-
+ def self.update_repositories(*args)
+ flags = {}
+ args.each {|arg| flags.merge!(arg) if arg.is_a?(Hash)}
+ if flags[:resync_all]
+ logger.info "Executing RESYNC_ALL operation on gitolite configuration"
+ projects = Project.active.has_module(:repository).find(:all, :include => :repository)
+ else
+ projects = args.flatten.select{|p| p.is_a?(Project)}
+ end
+ git_projects = projects.uniq.select{|p| p.repository.is_a?(Repository::Git) }
+ return if git_projects.empty?
if(defined?(@@recursionCheck))
if(@@recursionCheck)
+ # This shouldn't happen any more -- log as error
+ logger.error "git_hosting: update_repositories() exited with positive recursionCheck flag!"
return
end
- end
+ end
@@recursionCheck = true
- logger.debug "Updating repositories..."
- projects = (projects.is_a?(Array) ? projects : [projects])
-
-
- # Don't bother doing anything if none of the projects we've been handed have a Git repository
- unless projects.detect{|p| p.repository.is_a?(Repository::Git) }.nil?
-
-
+ # Grab actual lock
+ if !lock(lock_wait_time)
+ logger.error "git_hosting: update_repositories() exited without acquiring lock!"
+ @@recursionCheck = false
+ return
+ end
- #lock
- if !lock(5)
- @@recursionCheck = false
- return
+ begin
+ # Make sure we have gitoite-admin cloned.
+ on_master = clone_or_pull_gitolite_admin
+
+ # Get directory for the gitolite-admin
+ repo_dir = File.join(get_tmp_dir,"gitolite-admin")
+
+ # Flag to indicate whether repo has changed. If we have uncommited changes, we will commit later.
+ changed = !on_master
+
+ # logger.info "Updating keydirectory for projects: #{git_projects.join ', '}"
+
+ keydir = File.join(repo_dir,"keydir")
+ old_keyhash = {}
+ Dir.foreach(keydir) do |keyfile|
+ user_token = GitolitePublicKey.ident_to_user_token(keyfile)
+ if !user_token.nil?
+ old_keyhash[user_token] ||= []
+ old_keyhash[user_token] << keyfile
+ end
+ end
+
+ git_projects.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq.each do |cur_user|
+ active_keys = cur_user.gitolite_public_keys.active || []
+
+ # Remove old keys that happen to be left around
+ cur_token = GitolitePublicKey.user_to_user_token(cur_user)
+ old_keynames = old_keyhash[cur_token] || []
+ cur_keynames = active_keys.map{|key| "#{key.identifier}.pub"}
+ (old_keynames - cur_keynames).each do |keyname|
+ filename = File.join(keydir,"#{keyname}")
+ logger.warn "Removing gitolite key: #{keyname}"
+ %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
+ changed = true
+ end
+
+ # Remove inactive keys (will already be deleted by above code)
+ cur_user.gitolite_public_keys.inactive.each {|key| GitolitePublicKey.destroy(key.id)}
+
+ # Add missing keys to the keydir
+ active_keys.each do |key|
+ keyname = "#{key.identifier}.pub"
+ unless old_keynames.index(keyname)
+ filename = File.join(keydir,"#{keyname}")
+ logger.info "Adding gitolite key: #{keyname}"
+ File.open(filename, 'w') {|f| f.write(key.key.gsub(/\n/,'')) }
+ changed = true
+ end
+ end
+
+ # In preparation for resync_all, below
+ old_keyhash.delete(cur_token)
+ end
+
+ # Remove keys for deleted users
+ if flags[:resync_all]
+ # All keys left in old_keyhash should be for users nolonger authorized for gitolite repos
+ old_keyhash.each_value do |keyname|
+ filename = File.join(keydir,"#{keyname}")
+ logger.warn "Removing orphan gitolite key: #{keyname}"
+ %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
+ changed = true
+ end
end
-
-
- # Make sure we have gitoite-admin cloned
- clone_or_pull_gitolite_admin
-
-
- local_dir = get_tmp_dir()
- conf = GitoliteConfig.new(File.join(local_dir, 'gitolite-admin', 'conf', 'gitolite.conf'))
+ conf = GitoliteConfig.new(File.join(repo_dir, 'conf', 'gitolite.conf'))
orig_repos = conf.all_repos
new_repos = []
new_projects = []
- changed = false
-
- projects.select{|p| p.repository.is_a?(Repository::Git)}.each do |project|
-
- repo_name = repository_name(project)
-
- #check for delete -- if delete we can just
- #delete repo, and ignore updating users/public keys
- if is_repo_delete
- if Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true"
- conf.delete_repo(repo_name)
- end
- else
- #check whether we're adding a new repo
- if orig_repos[ repo_name ] == nil
- changed = true
- add_route_for_project(project)
- new_repos.push repo_name
- new_projects.push project
-
- end
-
-
- # fetch users
- users = project.member_principals.map(&:user).compact.uniq
- write_users = users.select{ |user| user.allowed_to?( :commit_access, project ) }
- read_users = users.select{ |user| user.allowed_to?( :view_changesets, project ) && !user.allowed_to?( :commit_access, project ) }
-
- # write key files
- users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
- filename = File.join(local_dir, 'gitolite-admin/keydir',"#{key.identifier}.pub")
- unless File.exists? filename
- File.open(filename, 'w') {|f| f.write(key.key.gsub(/\n/,'')) }
- changed = true
- end
- end
-
- # delete inactives
- users.map{|u| u.gitolite_public_keys.inactive}.flatten.compact.uniq.each do |key|
- filename = File.join(local_dir, 'gitolite-admin/keydir',"#{key.identifier}.pub")
- if File.exists? filename
- %x[git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' rm keydir/#{key.identifier}.pub]
- changed = true
- GitolitePublicKey.destroy(key.id)
- end
- end
-
- # update users
- read_user_keys = []
- write_user_keys = []
- read_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
- read_user_keys.push key.identifier
- end
- write_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
- write_user_keys.push key.identifier
- end
-
- #git daemon
- if (project.repository.extra.git_daemon == 1 || project.repository.extra.git_daemon == nil ) && project.is_public
- read_user_keys.push "daemon"
- end
-
- conf.set_read_user repo_name, read_user_keys
- conf.set_write_user repo_name, write_user_keys
+
+ # Regenerate configuration file for projects of interest
+ # logger.info "Updating gitolite.conf for projects: #{git_projects.join ', '}"
+ git_projects.each do |proj|
+ repo_name = repository_name(proj)
+
+ #check whether we're adding a new repo
+ if orig_repos[ repo_name ] == nil
+ changed = true
+ add_route_for_project(proj)
+ new_repos.push repo_name
+ new_projects.push proj
+
+ # Attempt to recover repository from recycle_bin, if present
+ GitoliteRecycle.recover_repository_if_present repo_name
+ end
+
+ # fetch users
+ users = proj.member_principals.map(&:user).compact.uniq
+ write_users = users.select{ |user| user.allowed_to?( :commit_access, proj ) }
+ read_users = users.select{ |user| user.allowed_to?( :view_changesets, proj ) && !user.allowed_to?( :commit_access, proj ) }
+
+ # update users
+ read_user_keys = []
+ write_user_keys = []
+ read_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
+ read_user_keys.push key.identifier
+ end
+ write_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
+ write_user_keys.push key.identifier
+ end
+
+ #git daemon
+ if (proj.repository.extra.git_daemon == 1 || proj.repository.extra.git_daemon == nil ) && proj.is_public
+ read_user_keys.push "daemon"
end
+
+ # Remove previous redmine keys, then add new keys
+ # By doing things this way, we leave non-redmine keys alone
+ conf.delete_redmine_keys repo_name
+ conf.add_read_user repo_name, read_user_keys
+ conf.add_write_user repo_name, write_user_keys
+
+ # This is in preparation for full resync (below)
+ orig_repos.delete repo_name
end
+
+ # If resyncing, check for orphan repositories which still have redmine keys...
+ # At this point, orig_repos contains all repositories in original gitolite.conf
+ # which are not part of an active redmine project. There are four possibilities:
+ #
+ # 1) These repos do not have redmine keys => we leave them alone
+ # 2) They have both redmine keys and other (non-redmine) keys => remove redmine keys
+ # 3) They have only redmine keys, but repository delete is not enabled
+ # => remove redmine keys (will leave redmine_dummy_key when we save)
+ # 4) They have only redmine keys and repository delete is enabled => delete repository
+ #
+ # Finally, delete expired files from recycle bin.
+ if flags[:resync_all]
+ orig_repos.each_key do |repo_name|
+ if conf.is_redmine_repo? repo_name
+ # First, delete redmine keys for this repository
+ conf.delete_redmine_keys repo_name
+ if (Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true") && (conf.repo_has_no_keys? repo_name)
+ logger.warn "Deleting orphan repository '#{repo_name}' from gitolite.conf"
+ conf.delete_repo repo_name
+ GitoliteRecycle.move_repository_to_recycle repo_name
+ else
+ logger.info "Deleting redmine keys for orphan repository '#{repo_name}' from gitolite.conf"
+ end
+ end
+ end
+ GitoliteRecycle.delete_expired_files
+ end
if conf.changed?
conf.save
changed = true
end
-
+
if changed
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' add keydir/*]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' add conf/gitolite.conf]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' config user.email '#{Setting.mail_from}']
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' config user.name 'Redmine']
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' commit -a -m 'updated by Redmine' ]
- %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{local_dir}/gitolite-admin/.git' --work-tree='#{local_dir}/gitolite-admin' push ]
+ # Have changes. Commit / push changes to gitolite admin repo
+ commit_gitolite_admin flags[:resync_all]
end
-
+
# Set post recieve hooks for new projects
# We need to do this AFTER push, otherwise necessary repos may not be created yet
if new_projects.length > 0
GitAdapterHooks.setup_hooks(new_projects)
end
- unlock()
- end
- @@recursionCheck = false
+ rescue GitHostingException
+ logger.error "git_hosting: update_repositories() failed"
+ rescue => e
+ logger.error e.message
+ logger.error e.backtrace[0..4].join("\n")
+ logger.error "git_hosting: update_repositories() failed"
+ end
+ unlock()
+ @@recursionCheck = false
end
-
- def self.clear_cache_for_project(project)
+ def self.clear_cache_for_project(project)
if project.is_a?(Project)
project = project.identifier
end
@@ -539,5 +809,24 @@ def self.update_global_hook_params
unlock()
end
end
+
+ class MyLogger
+ # Prefix to error messages
+ ERROR_PREFIX = "***> "
+
+ # For errors, add our prefix to all messages
+ def error(*progname, &block)
+ if block_given?
+ Rails.logger.error(*progname) { "#{ERROR_PREFIX}#{yield}".gsub(/\n/,"\n#{ERROR_PREFIX}") }
+ else
+ Rails.logger.error "#{ERROR_PREFIX}#{progname}".gsub(/\n/,"\n#{ERROR_PREFIX}")
+ end
+ end
+
+ # Handle everything else with base object
+ def method_missing(m, *args, &block)
+ Rails.logger.send m, *args, &block
+ end
+ end
end
diff --git a/lib/git_hosting/patches/repositories_controller_patch.rb b/lib/git_hosting/patches/repositories_controller_patch.rb
index 72e71c999..e4935d9bd 100644
--- a/lib/git_hosting/patches/repositories_controller_patch.rb
+++ b/lib/git_hosting/patches/repositories_controller_patch.rb
@@ -42,7 +42,7 @@ def edit_with_scm_settings
end
end
- GitHosting.update_repositories(@project, false) if !@project.repository.nil?
+ GitHosting.update_repositories(@project) if !@project.repository.nil?
GitHosting.setup_hooks(@project) if !@project.repository.nil?
else
diff --git a/lib/git_hosting/patches/repository_patch.rb b/lib/git_hosting/patches/repository_patch.rb
index 6c3695250..0fc6cc62e 100644
--- a/lib/git_hosting/patches/repository_patch.rb
+++ b/lib/git_hosting/patches/repository_patch.rb
@@ -32,8 +32,8 @@ def fetch_changesets_with_disable_update
# Do actual update
fetch_changesets_without_disable_update
- # Reenable updates to perform a single update
- GitHostingObserver.set_update_active(true);
+ # Reenable updates to perform a sync of all projects
+ GitHostingObserver.set_update_active(:resync_all);
end
end
diff --git a/lib/git_hosting/patches/sys_controller_patch.rb b/lib/git_hosting/patches/sys_controller_patch.rb
index 6b35c86e5..cf473c949 100644
--- a/lib/git_hosting/patches/sys_controller_patch.rb
+++ b/lib/git_hosting/patches/sys_controller_patch.rb
@@ -8,8 +8,8 @@ def fetch_changesets_with_disable_update
# Do actual update
fetch_changesets_without_disable_update
- # Reenable updates to perform a single update
- GitHostingObserver.set_update_active(true);
+ # Perform the updating process on all projects
+ GitHostingObserver.set_update_active(:resync_all);
end
def self.included(base)
diff --git a/lib/gitolite_conf.rb b/lib/gitolite_conf.rb
index 1a57a3e88..3279ff7e8 100755
--- a/lib/gitolite_conf.rb
+++ b/lib/gitolite_conf.rb
@@ -1,10 +1,16 @@
module GitHosting
class GitoliteConfig
+ DUMMY_REDMINE_KEY="redmine_dummy_key"
+
def initialize file_path
@path = file_path
load
end
+ def logger
+ return GitHosting.logger
+ end
+
def save
File.open(@path, "w") do |f|
f.puts content
@@ -39,6 +45,29 @@ def rename_repo old_name, new_name
end
end
+ # A repository is a "redmine" repository if it has redmine keys or no keys
+ # (latter case is checked, since we end up adding the DUMMY_REDMINE_KEY to
+ # a repository with no keys anyway....
+ def is_redmine_repo? repo_name
+ repository(repo_name).rights.detect {|perm, users| users.detect {|key| is_redmine_key? key}} || (repo_has_no_keys? repo_name)
+ end
+
+ def delete_redmine_keys repo_name
+ return if !@repositories[repo_name]
+
+ repository(repo_name).rights.each do |perm, users|
+ users.delete_if {|key| is_redmine_key? key}
+ end
+ end
+
+ def repo_has_no_keys? repo_name
+ !repository(repo_name).rights.detect {|perm, users| users.length > 0}
+ end
+
+ def is_redmine_key? keyname
+ (GitolitePublicKey::ident_to_user_token(keyname) || keyname == DUMMY_REDMINE_KEY) ? true : false
+ end
+
def changed?
@original_content != content
end
@@ -51,7 +80,6 @@ def all_repos
return repos
end
-
private
def load
@original_content = []
@@ -81,14 +109,15 @@ def repository repo_name
def content
content = []
- # To facilitate creation of repos, even when no users are defined
- # always define at least one user -- specifically the admin
- # user which has rights to modify gitolite-admin and control
- # all repos. Since the gitolite-admin user can grant anyone
- # any permission anyway, this isn't really a security risk.
- # If no users are defined, this ensures the repo actually
- # gets created, hence it's necessary.
- admin_user = @repositories["gitolite-admin"].rights["RW+".to_sym][0]
+ # If no gitolite-admin user, something seriously wrong. Add it in with id_rsa.
+ #
+ # If this doesn't work for some reason, will be corrected at later time by
+ # gl-setup run.
+ if @repositories["gitolite-admin"].nil?
+ content << "repo\tgitolite-admin"
+ content << "tRW+\t=\tid_rsa"
+ content << ""
+ end
@repositories.each do |repo, rights|
content << "repo\t#{repo}"
has_users=false
@@ -99,7 +128,8 @@ def content
end
end
if !has_users
- content << "\tR\t=\t#{admin_user}"
+ # If no users, use dummy key to make sure repo created
+ content << "\tR\t=\t#{DUMMY_REDMINE_KEY}"
end
content << ""
end
diff --git a/lib/gitolite_recycle.rb b/lib/gitolite_recycle.rb
new file mode 100755
index 000000000..e140054d2
--- /dev/null
+++ b/lib/gitolite_recycle.rb
@@ -0,0 +1,112 @@
+module GitHosting
+ # This class implements a basic recycle bit for repositories deleted from the gitolite repository
+ #
+ # Whenever repositories are deleted, we rename them and place them in the recycle_bin.
+ # Assuming that GitoliteRecycle.delete_expired_files is called regularly, files in the recycle_bin
+ # older than 'preserve_time' will be deleted. Both the path for the recycle_bin and the preserve_time
+ # are settable as settings.
+ #
+ # John Kubiatowicz, 11/21/11
+ class GitoliteRecycle
+ TRASH_DIR_SEP = "__" # Separator character(s) used to replace '/' in name
+
+ RECYCLE_BIN_IF_UNDEF = "recycle_bin/" # In case settings not migrated (normally from settings)
+ PRESERVE_TIME_IF_UNDEF = 1440 # In case settings not migrated (normally from settings)
+
+ def self.logger
+ return GitHosting.logger
+ end
+
+ # Repository base path (relative to git user home directory)
+ def self.repository_base
+ Setting.plugin_redmine_git_hosting['gitRepositoryBasePath']
+ end
+
+ # Recycle bin base path (relative to git user home directory)
+ def self.recycle_bin
+ Setting.plugin_redmine_git_hosting['gitRecycleBasePath'] || RECYCLE_BIN_IF_UNDEF
+ end
+
+ # Recycle preservation time (in minutes)
+ def self.preserve_time
+ (Setting.plugin_redmine_git_hosting['gitRecycleExpireTime'].to_f * 60).to_i || PRESERVE_TIME_IF_UNDEF
+ end
+
+ # Scan through the recyclebin and delete files older than 'preserve_time' minutes
+ # This can fail silently if, for instance, the recycle_bin doesn't exist. That is the intended behavior.
+ def self.delete_expired_files
+ result = %x[#{GitHosting.git_user_runner} 'find #{recycle_bin} -type d -regex '.*\.git' -cmin +#{preserve_time} -prune -print'].chomp.split("\n")
+ if result.length > 0
+ logger.warn "Garbage-collecting expired file#{(result.length != 1) ? "s" : ""} from recycle bin:"
+ result.each do |filename|
+ begin
+ GitHosting.shell %[#{GitHosting.git_user_runner} rm -r #{filename}]
+ logger.warn " Deleting #{filename}"
+ rescue
+ logger.error "GitoliteRecycle.delete_expired_files() failed trying to delete repository #{filename}!"
+ end
+ end
+
+ # Optionally remove recycle_bin (but only if empty). Ignore error if non-empty
+ %x[#{GitHosting.git_user_runner} rmdir #{recycle_bin}]
+ end
+ end
+
+ def self.move_repository_to_recycle repo_name
+ repo_path = File.join(repository_base, repo_name)
+ new_path = File.join(recycle_bin,"#{Time.now.to_i.to_s}#{TRASH_DIR_SEP}#{name_to_recycle_name(repo_name)}")
+ begin
+ GitHosting.shell %[#{GitHosting.git_user_runner} mkdir -p '#{recycle_bin}']
+ GitHosting.shell %[#{GitHosting.git_user_runner} mv '#{repo_path}.git' '#{new_path}.git']
+ logger.warn " Moving '#{repo_name}.git' from gitolite repository => '#{new_path}.git'. Will remain for at least #{preserve_time/60.0} hours"
+ # If any empty directories left behind, try to delete them. Ignore failure.
+ old_prefix = repo_name[/.*?(?=\/)/] # Top-level old directory without trailing '/'
+ if old_prefix
+ repo_subpath = File.join(repository_base, old_prefix)
+ result = %x[#{GitHosting.git_user_runner} find '#{repo_subpath}' -type d ! -regex '.*\.git/.*' -empty -depth -delete -print].chomp.split("\n")
+ result.each { |dir| logger.warn " Removing empty repository subdirectory: #{dir}"}
+ end
+ rescue
+ logger.error "Attempt to move repository '#{repo_name}.git' to recycle bin failed"
+ end
+ end
+
+ def self.recover_repository_if_present repo_name
+ # Pull up any matching repositories. Sort them (beginning is representation of time)
+ myregex = File.join(recycle_bin,"[0-9]+#{TRASH_DIR_SEP}#{name_to_recycle_name(repo_name)}.git")
+ files = %x[#{GitHosting.git_user_runner} find '#{recycle_bin}' -type d -regex '#{myregex}' -prune].chomp.split("\n").sort {|x,y| y <=> x }
+ if files.length > 0
+ # Found something!
+ logger.warn "Restoring '#{repo_name}.git' to gitolite repository from recycle bin (#{files.first})"
+ begin
+ prefix = repo_name[/.*(?=\/)/] # Complete directory path (if exists) without trailing '/'
+ if prefix
+ repo_prefix = File.join(repository_base, prefix)
+ # Has subdirectory. Must reconstruct directory
+ GitHosting.shell %[#{GitHosting.git_user_runner} mkdir -p '#{repo_prefix}']
+ end
+ repo_path = File.join(repository_base, repo_name)
+ GitHosting.shell %[#{GitHosting.git_user_runner} mv '#{files.first}' '#{repo_path}.git']
+
+ # Optionally remove recycle_bin (but only if empty). Ignore error if non-empty
+ %x[#{GitHosting.git_user_runner} rmdir #{recycle_bin}]
+ return true
+ rescue
+ logger.error "Attempt to recover '#{repo_name}.git' failed"
+ return false
+ end
+ else
+ false
+ end
+ end
+
+ # This routine takes a name and turns it into a name for the recycle bit,
+ # where we have a 1-level directory full of deleted repositories which
+ # we keep for 'preserve_time'.
+ def self.name_to_recycle_name repo_name
+ new_trash_name = "#{repo_name}".gsub(/\//,"#{TRASH_DIR_SEP}")
+ end
+
+
+ end
+end
diff --git a/tasks/gitolite.rake b/tasks/gitolite.rake
index e15d136d3..8b3b1715f 100644
--- a/tasks/gitolite.rake
+++ b/tasks/gitolite.rake
@@ -1,11 +1,26 @@
+# There are two tasks here of interest: gitolite:update_repositories and gitolite:fetch_changesets.
+# The second includes the first (since fetching of changesets causes updating of gitolite config).
+#
+# As of the most recent release, either of these will complete resynchronize the gitolite configuration
+# and can thus be used to recover from errors that might have been introduced by sychronization errors.
+#
+# Specifically:
+#
+# 1) Resynchronize gitolite configuration (fix keys directory and configuration). Also, expire
+# repositories in the recycle_bin if time.
+#
+# rake gitolite:update_repositories RAILS_ENV=xxx
+#
+# 2) Fetch all changesets for repositories and then rescynronize gitolite configuration (as in #1)
+#
+# rake gitolite:fetch_changes RAILS_ENV=xxx
+#
namespace :gitolite do
- desc "update gitolite repositories"
+ desc "Update all gitolite repositories"
task :update_repositories => [:environment] do
- projects = Project.active
- puts "Updating repositories for projects #{projects.join(' ')}"
- GitHosting.update_repositories(projects, false)
+ GitHosting.update_repositories(:resync_all => true)
end
- desc "fetch commits from gitolite repositories"
+ desc "Fetch commits from gitolite repositories/update gitolite configuration"
task :fetch_changes => [:environment] do
Repository.fetch_changesets
end
From 01e8b32412eaceefe87bfdbbf51448f1b6bdff82 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Sun, 27 Nov 2011 09:49:47 -0800
Subject: [PATCH 005/107] Missed a performance case/source of recursion
complaints in the log.
This is not a major issue (or even correctness issue), but will cause
complaints of recursion in the log.
---
app/controllers/gitolite_public_keys_controller.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/controllers/gitolite_public_keys_controller.rb b/app/controllers/gitolite_public_keys_controller.rb
index 1276f8471..131d2af40 100644
--- a/app/controllers/gitolite_public_keys_controller.rb
+++ b/app/controllers/gitolite_public_keys_controller.rb
@@ -18,12 +18,14 @@ def delete
end
def update
+ GitHostingObserver.set_update_active(false)
if @gitolite_public_key.update_attributes(params[:public_key])
flash[:notice] = l(:notice_public_key_updated)
redirect_to url_for(:controller => 'my', :action => 'account')
else
render :action => 'edit'
end
+ GitHostingObserver.set_update_active(true)
end
def create
From fffa1fd579161ffb4071f975b4476120f1fcdd4b Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Tue, 3 Jan 2012 21:05:53 -0800
Subject: [PATCH 006/107] Update of selinux policy for latest version of
selinux package. Also change rakefile to install binary policy
(redmine_git.pp) instead of compiling source policy (redmine_git.te) before
every installation. New rake task added to recompile policy if necessary:
rake selinux:redmine_git_hosting:build_policy
---
selinux/README | 14 +++++++++++---
selinux/redmine_git.pp | Bin 127822 -> 128153 bytes
selinux/redmine_git.te | 10 ++++++++--
tasks/selinux.rake | 10 ++++++++--
4 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/selinux/README b/selinux/README
index a877fb20b..b57a919ec 100644
--- a/selinux/README
+++ b/selinux/README
@@ -52,15 +52,23 @@ Somewhat less far-reaching options include:
# install new selinux policy, and install selinux context for
# the redmine_git_hosting plugin
- rake selinux:redmine_git_hosting:install
+ rake selinux:redmine_git_hosting:install RAILS_ENV=production
-Finally, for those who are hand-crafting their own file context:
+For those who are hand-crafting their own file context:
# Build bin directory with customized scripts for redmine_git_hosting
# and install new selinux policy. No file contexts will be
# installed (so that you must do customization afterwards).
- rake selinux:redmine_git_hosting:install_scripts_and_policy
+ rake selinux:redmine_git_hosting:install_scripts_and_policy RAILS_ENV=production
+
+Finally, to rebuild the policy file (redmine_git.pp) from source (redmine_git.te),
+you can type:
+
+ # Rebuild redmine_git_hosting selinux policy from source
+
+ rake selinux:redmine_git_hosting:build_policy RAILS_ENV=production
+
diff --git a/selinux/redmine_git.pp b/selinux/redmine_git.pp
index bfe21e6945a9e61a536b6baf50f119f2006732a9..80895f79f0f1bb1e8a076256f6c605b863778ce1 100644
GIT binary patch
delta 4706
zcmb7He^k^}7M}|;4loSE4~GF}U`*UF1KlDmrD28{hWW*SyPH4QWccZ(61Xt6*0xBe
z&34<G)`np=Lk895pE?b?Gu+J0?R^q1N_of8M!e^{HoMBc&k-(Ok
z;}J?`Dt%See6A!iRf_diI%4pUISytC?xa0_U7-R>Xri0&)^ArGr8H^R@jnY_+Ni=2!NCDZYkB?@j4zD6txmRJDEXfP|3^|jvSMkxw+
z2S`O`iuQv4zBU`ds#)f62Paf0pf+Gh%
zDpup};<<|7d3|aEZ=fyd&}mPCslv$vb~B!ktI=Rl;z@flsx3N{JCYzC2c{;)Q^xT
z#}xw^9FA^&pt;6Z@AWCL)s%_9cPU|-P~YNOh@Bo??DB@?J}EmhDBU{DcPrp_p;76M
zg)&aXigPZ`_k1Ct!#G*8naMXD-P|N`dM=IO1>u`Q>o4W&XR{s!c~rXCAxVRgR#Nm7
zQhIWP%O^?_z(#wU#@0Uy2~oTjVugU`x}GOWN02%MQF@d(+oJ-zK*~Lt;N-KZ#bJ{U
zQVbbP5#nQ{m`Gwhe(!08Xnv%y<242Q$6C-}SLs4|C?pYZK1il7>&N(}EEj(Mq08-F?XXIjqhu*
z_lOH$Kaz^75f5rNk{)@~Y}AH$zUH7Hq|jc1DH~HdJuhk_D3&zM>u&UKGvN8nR>5a%
z%EFG+RklT)RI9*m!fmv6(s~U6u9EwI*jR>Xc5z;#cf+Y!^ih#
zVc%90jXJ#PuXZsuyD~vVX7WOkiLr1)VQ~2eh}B=t8WzJ
z(%q>j?{v}l2YmIAWV3X)9!K94GUkt_uFaiZ1@)MAP#40Y7s(bc*)gL5i7HK+F`?ZLtm#0RLEeClzc;ux~;!}Bg^3nJ%
z?Og~`DTm_?QnBH^iTs?yE_P=Gq~hpd1#UiU!P6V{7;&Unlxf9!H{O4=8h0E?L*w6T
zMfv{WO+5}Cx8o-tXenZDG4e8&co#l#NROT&8ca7e_AZ-O?+Z;NTzGE&IzkF@Z$!JGRvH;G1c
z9OK0a6&hrv3f(HIf_G0|lg5j@CheWZi|+wkf5X-I_*pFu{HFx}ayA9~&bjcR0TN5>)gsm$5Mw%*2i>h3vyPN_%b`)QSS}oT}yrj{`0i9S;wx8ZUe|
zHWnZJy|^5BCLYd3O`83*OwRWEAdijCq*qh!SMp~yWUz8Ny*!p_pi0&F)wNa!qR>!~
z%sO;%nC*(8w{iDH1;2$^M-1rLH+pXL^-mZXv&d*9kBlyzcM5{7oz4xu`w0V@Wi_+i
zOb;*~j@*q3mXSk`?;kK!U$|$;gt=R?*ia5E`H|gTUH59{&m)h)x)gTCz*P2W4%~fx
zJL=*|Hm^`pnZjCZAZITWf`dibU@DVa;CWCm
z^9o3oMEfl8QV1YVa<6_VRX)h$WH
z7BVVAk~t(Pl_X*#=PSrMt(?5gBT0!Q;Q@fTEVBY?S6F
==U|9jpk6&d{r=We05!3bD2>Ono1AG$^|L(6A;JJQ{Z6Wt!hY?gC#(}O_PCj
z-%GK(u$)dhQ7QaMIZXcos{Um5{tAej2)6$S=;{3dn9CkpNwF86KVM1F6_leMLT^Or
zmN|1i4F@kf*|+tSg>QJ$ha!W@IJ#ZIiWKQ$#FDi6P7_)^Qz+8(lPQ)IAv#2d)p=w)
zJ9e`d_dpIs#ZS~w7PRVI2h0zw5S#-y<$!qnhFKBOqim<$eedPhrqr|fNBZvfz3<-p
z?t8y({X8xHNm|bDhVS?uR4SF4ev|08^`Cok?p=&Wt1Y;9aW>RqcC|S-yso7+bZgVv
z(ArzVp@@dWuEt)M87JB@K!;0g)_m2JiWDNNR^Hg&7K+@qrY)TilVqtXI7ijCzO6;D
zG6|W7`yEC4_NL~x_O{kggi9|FCOdtp7`LV4Zr2q2w=Ekc2kkw4SM)MSn==Ql5<3n%^C63el**Hc
zPdbZXwotb@H5rlBYeEqnS-tqHLq?jZM6{|SQZGnO$EDP7WCxV?*GQ(|=P)kR6CF$T7-Z}Wb+d#5kd1n!n
zuKh(QVjxqcv?~kxJh^C~M!C&n$D0EdO8g`!7G^cxT)0#~^SpLE>z%J{3Pp-YF_SFK
z(^Bp@!p$xMAFmTG_32=d(CGB#z!b5WsILI75ws6|c^C^?kWxay>)6D5APr~vGoXmG
zv)0|Vt|ihQifGB`T%mBgUk8^6Xs7>L$mUSyjo}+3vOLpx5phwC7OoI7jWwAF0ZXRn
zbJ5=m1)Z8PO=^_!4Nq9NmN0zZHCYqMBUeEY`OH8DWD4;_bd)HqtjSD4zAumsPTJ69
zJP^o(bVW3yofpPJcJvB~?+q)0dTg95W1}ujKK`An{zmJQCESno{z8@NUWl
zwGXS*ftC$zf_!{&$+h4Y!7Z%44C;jZuWPeFBht#l?5j0ErJ#5Ew0NdA7p4kcVVxeo
zq0&0)a`7H#3HEH!#_p{9#>TW(D8#OA6E*GZZU=t(Co}eJYsLQK0X(zKNN_Kn-ewZC
z;*SHk?Sv8IScB?gCX$gW#~(l5N^Xhp>i_rdK2PuzfmJG=>4
z@{QY#N%n(i+MX|La=(gyZl`015zDvNV9ucy^uAey(XC$m@-w6G!Phtj1kQbp;%4EG
z@L2F6lbR>kg2nL?tbAk|_UtOb(~mgVU^z^QJ-_n?$&M|2+yGp#1mou{7=6Oj?Mr3x
zOqhnzogR*3*^?j9YQeInIBvoI^I~PesWhohK4u!DwD9qg1djcW%*6g(icK7Ru>v#5
zT(XOSb0utO7EQ`eo_-at+h@jTuUD+`7+$+Gx$*+f{?bFPVtw!Hq9j6s85g{n|r_iFFz2(mSNr(q)s1
zl~3)(jF$xiSH1jEiYnEBbB+{HLkY7A9*h5ZKS;;u#pBPn($9?F{?(7A`8h
zp4eW1WrzF;+(U=3ncb64yR7_M4Q|+O!mdMfn(5?oIF3HajP`1AFkU4Q-;q&CK2I*z
z`XNi)YX5Pc>;&sE_lOcV(D0TC8;(ATuA@`1^6xe=sCWp;gCluxsgGGuf6DU%az*&%
z4)-`c{U0niwAmBu|Hm_c@pl`=l;V?4nQ%0n)SZC6&&;PGJ5vn7@TpeJI5j#vFA^U&
zJTI2rxaA;j+|o(|Fo44}Kxc1ljaff95A-~#eYZJ<-eGvx=4Q26^0<@)n~DEcype60
zN+pS-mPO0KMl;TY;m35bji25O82ZkLn$LHOGpUq(e9O4lT{Co@1gg)NS$QTsXB=k=DY=Wr
zQ&}`svPb3kIWOJ+v+<_rQm$uUmW)dfYs|jLR80#N$lP%dS25};Ty5B
zGCgGQ?#aUEVhdP*I+QW(L}~<{4GyhLRMsb2Op@ms;CB7;fBk28I89~a<6Je=2PSxR
z0*ZZ}*WpcdSt(NtDeU1}VLfYDPH&qsBR%~uf6*+iO7@@;mg$d=v#?XcVja}TbiJ}Y
z9bjRXSfNS3{EIQ3?zaNTtvAveab%Ep&*y|f_Q$DQesGL@>7`trzk%4vS&6)iLdv13
zk|~Vt)Uuq}6x{gj)oIwkJh*zyQLB>J|JJI%3f8dx#q|D2be2wFJeM9xFOG|Tk#v$$
z&R&q6wNcn%JNVgsHYi{jb~wcJc5t(gt00f9vcnPyRoW=W?{LQVZpz#CDl)yoLm~~;
z#OSFahPN7uB=j36m|1Hzc)4&MJ5Wtl2r{#o4tSWYaFN_;2khXGFrZ8I{HnM{e
z)J)@o>$r6@J4i-G>6LCtPbk&6DTq7#kk59xAt)ieNBYWRYe%4W5|EkMyoyGTSJ6=W
z6lf)fPWd5+z2>7j2&l}jKwTW_3=sF6ADTJT$_z`$dAx?y1aw(IfmV&sE{xC`f(n;%
zreOzz^!?YlIUjqzl27HooSocvVF|Q>?2X}J-uj>#V$}MjeO+~MzlNP@qNFTbN}1ig
zjG!J4J-wVD^)iA!T}seO4*5BEK!IQ`+p&~(Zsq*$dZ=Ztu4jxFw(#6J1{vUwL>F1N;RnmCZ^@^Kw3CPOoSAat*rE{gZ^b4>Z^-#@v
zR*=7dVn9TEcLPPFzaA_T=8>GA9a#n;<_jf=FrQf)poQf$5@DbLENKf#sz$LO^6(z<
zlH6TE0$%Bkn@tmVVvD%;DGSpykCDHUl*yu-pp-*KddAZWd>ReINo++sWQ`$qJ^KU1Xzw`UOtz;ToYFFX
z?z4i`R2t#vmeusdrrZSVbeMe8+4izv#~5fr2hq3!ZtU0M+fU3DH;0ru+`$J|(m>od
U%tvY#^m%Uv>xRBfXCNp2zdwhul>h($
diff --git a/selinux/redmine_git.te b/selinux/redmine_git.te
index 54b0a7aa1..36c73d2d8 100644
--- a/selinux/redmine_git.te
+++ b/selinux/redmine_git.te
@@ -8,10 +8,13 @@ require {
type httpd_t, httpd_sys_script_t, httpd_sys_script_exec_t;
type sudo_db_t;
type httpd_redmine_git_script_t;
+ type httpd_redmine_git_script_exec_t;
+ type gitosis_var_lib_t;
class process { setrlimit setfscreate };
class netlink_route_socket { write getattr read bind create nlmsg_read };
class capability { setuid sys_resource setgid };
- class dir { getattr search write};
+ class dir { getattr search write write rename create reparent rmdir };
+ class lnk_file unlink;
}
apache_content_template(redmine_git)
@@ -51,10 +54,13 @@ allow httpd_redmine_git_script_t self:netlink_route_socket { write getattr read
allow httpd_redmine_git_script_t self:process setrlimit;
allow httpd_redmine_git_script_t sudo_db_t:dir { getattr search };
+# Capabilities required to manage gitolite repositories
+allow httpd_redmine_git_script_t gitosis_var_lib_t:dir { rename create reparent rmdir };
+allow httpd_redmine_git_script_t gitosis_var_lib_t:lnk_file unlink;
gitosis_read_lib_files(httpd_redmine_git_script_t)
gitosis_manage_lib_files(httpd_redmine_git_script_t)
-httpd_rw_stream_sockets(httpd_redmine_git_script_t)
+apache_rw_stream_sockets(httpd_redmine_git_script_t)
kernel_read_kernel_sysctls(httpd_redmine_git_script_t)
logging_send_syslog_msg(httpd_redmine_git_script_t)
diff --git a/tasks/selinux.rake b/tasks/selinux.rake
index 92e1e4c7c..3eae4cfd5 100644
--- a/tasks/selinux.rake
+++ b/tasks/selinux.rake
@@ -153,8 +153,14 @@ namespace :selinux do
desc "Install selinux tags and policy for redmine_git_hosting."
task :install_policy => [:environment] do
puts "[Installing selinux tags and policy for redmine_git_hosting:"
- plugin_roots = redmine_roots("vendor/plugins/redmine_git_hosting")
- sh "#{plugin_roots[0]}/selinux/redmine_git.sh"
+ sh "semodule -i #{Rails.root}/vendor/plugins/redmine_git_hosting/selinux/redmine_git.pp"
+ puts "DONE.]"
+ end
+
+ desc "Build and install selinux tags and policy for redmine_git_hosting."
+ task :build_policy => [:environment] do
+ puts "[Building and installing selinux policy for redmine_git_hosting:"
+ sh "#{Rails.root}/vendor/plugins/redmine_git_hosting/selinux/redmine_git.sh"
puts "DONE.]"
end
From 2f1c213c0ce41d024ad2b86585e4dea99c25b2c7 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Tue, 10 Jan 2012 23:15:43 -0800
Subject: [PATCH 007/107] Continuing rewrite of redmine_git_hosting to
rationalize path handling.
It is important to remember to migrate_plugin settings, since there
are new settings and one setting has changed a bit (i.e. httpServer
should nolonger include a rails_root path). Thus, make sure to:
rake db:migrate_plugins
This commit includes a number of changes. First and foremost, the
update_repositories() function now handles deletes and repository
moves as well as all other changes. Consequently, :RESYNC_ALL will be
able to recover from a variety of problems involving movement of
repositories resulting from project parent changes. Note that changes
in the parent for a subtree of projects works much better than before.
Second, this commit adds new settings which allow (1) redmine-managed
repositories to be focused in a specific subdirectory of the gitolite
repository, (2) allow repositories to be named either hierarchically
(default) or concentrated in a single directory (flat) independent of
project parents, and (3) an extra path parameter which can be added to
the http URL for smart http access of repositories.
Third, added the "access" box at the top of the settings page which
shows explicitly how settings affect access parameters.
Random improvements include (1) rewrite of routes for smart HTTP to
better handle changes in parentage (and avoid need to change routes as
project parents change); (2) changes in settings now immediately
trigger resulting changes in state (before, the settings cache got in
the way); (3) all of the path functions (repository positions, ssh
access, http access) have been concentrated into a small number of
functions at the top of git_hosting.rb, rather than spread throughout
the code; (4) continuing the changes started with the original
performance fixes, cleaned up observer behavior triggered by changes
in project membership and settings.
---
README.mkd | 64 ++-
app/controllers/git_http_controller.rb | 114 +++--
app/models/git_hosting_observer.rb | 73 ++-
app/models/git_hosting_settings_observer.rb | 76 ++-
app/views/projects/_git_urls.erb | 21 +-
app/views/repositories/_git_urls.erb | 57 ++-
app/views/settings/_display_access.html.erb | 19 +
.../settings/_redmine_git_hosting.html.erb | 74 +--
assets/javascripts/git_url_display.js | 6 +-
assets/stylesheets/application.css | 21 +-
config/locales/bg.yml | 21 +-
config/locales/bs.yml | 21 +-
config/locales/ca.yml | 21 +-
config/locales/cs.yml | 21 +-
config/locales/da.yml | 21 +-
config/locales/de.yml | 21 +-
config/locales/el.yml | 21 +-
config/locales/en.yml | 21 +-
config/locales/es.yml | 21 +-
config/locales/fi.yml | 21 +-
config/locales/fr.yml | 21 +-
config/locales/gl.yml | 21 +-
config/locales/he.yml | 21 +-
config/locales/hu.yml | 21 +-
config/locales/id.yml | 21 +-
config/locales/it.yml | 21 +-
config/locales/ja.yml | 21 +-
config/locales/ko.yml | 21 +-
config/locales/lt.yml | 21 +-
config/locales/nl.yml | 21 +-
config/locales/no.yml | 21 +-
config/locales/pl.yml | 21 +-
config/locales/pt-BR.yml | 23 +-
config/locales/pt.yml | 22 +-
config/locales/ro.yml | 21 +-
config/locales/ru.yml | 21 +-
config/locales/sk.yml | 21 +-
config/locales/sl.yml | 21 +-
config/locales/sr.yml | 21 +-
config/locales/sv.yml | 21 +-
config/locales/th.yml | 21 +-
config/locales/tr.yml | 21 +-
config/locales/uk.yml | 21 +-
config/locales/vi.yml | 21 +-
config/locales/zh-TW.yml | 21 +-
config/locales/zh.yml | 21 +-
config/routes.rb | 33 +-
...20111220055819_add_settings_to_plugin_2.rb | 51 ++
init.rb | 13 +-
lib/git_adapter_hooks.rb | 13 +-
lib/git_hosting.rb | 466 ++++++++++--------
.../patches/projects_controller_patch.rb | 75 +--
.../patches/repositories_controller_patch.rb | 11 +-
lib/gitolite_conf.rb | 25 +
lib/gitolite_recycle.rb | 34 +-
55 files changed, 1461 insertions(+), 544 deletions(-)
create mode 100644 app/views/settings/_display_access.html.erb
create mode 100644 db/migrate/20111220055819_add_settings_to_plugin_2.rb
diff --git a/README.mkd b/README.mkd
index d9fe779be..69528e6c1 100755
--- a/README.mkd
+++ b/README.mkd
@@ -1,4 +1,4 @@
-# Redmine Git Hosting Plugin (v0.4.2x)
+# Redmine Git Hosting Plugin (v0.4.3x)
A ChiliProject / Redmine plugin which makes configuring your own git hosting easy. This plugin allows straightforward management
of gitolite and associated public keys, the git daemon, and integrates code from Scott Schacon's "grack" utility
@@ -99,40 +99,53 @@ root directory:
**(6)** It is best to set several plugin variables BEFORE you run the db:migrate\_plugins task in step 7. In particular it is important
-that the *httpServer*, *gitServer*, *gitUser*, *gitRepositoryBasePath*, *gitoliteIdentityFile* and *gitoliteIdentityPublicKeyFile*
-variables are set correctly. To adjust these variables, open an editor and edit [redmine_rails_root]/vendor/plugins/redmine_git_hosting/init.rb file.
-Starting on line 22 you will see the settings definitions you should edit.
+that the *httpServer*, *gitServer*, *gitUser*, *gitoliteIdentityFile* and *gitoliteIdentityPublicKeyFile*
+variables are set correctly. Others that should be set include *gitRepositoryBasePath*, *gitRedmineSubdir*, and *gitRepositoryHierarchy*; however,
+the default values for these variables should be sufficient for most installations.
+To adjust these variables, open an editor and edit [redmine_rails_root]/vendor/plugins/redmine_git_hosting/init.rb file.
+Starting on line 22, you will see the settings definitions you should edit.
-The *httpServer* variable should be set to the url used to access your Redmine site, e.g. www.my-own-personal-git-host-server.com. Note that if Redmine is not
-installed in the site root this should include the path to your Redmine root, e.g. www.my-own-personal-git-host-server.com/path/to/redmine
+The *httpServer* variable should be set to the hostname which will be used to access your Redmine site, e.g. www.my-own-personal-git-host-server.com. This variable
+may optionally include a port using the ':portnum' syntax, i.e. www.my-own-person-git-host-server.com:8000. Unlike earlier versions of this plugin, this variable should
+*not* include the path to your Redmine root.
+The *gitServer* variable should be set to the hostname which will be used to access the gitolite repositories via ssh. In most configurations, this
+variable will be identical to the *httpServer*, except for the fact that *gitServer* will never include an optional port number.
-The *gitServer* will usually be the same as the the httpServer variable -- this is the server name to use to access the gitolite repositories via ssh. This should be
-the hostname only, so this will be different from *httpServer* if Redmine is not installed in the site root. In other words, even if Redmine is installed in
-www.my-own-personal-git-host-server.com/path/to/redmine, *gitServer* should be set to www.my-own-personal-git-host-server.com
-
-
-The *gitUser* is the user under which gitolite is installed
+The *gitUser* is the user under which gitolite is installed.
+If you followed the above directions you will not need to modify the *gitoliteIdentityFile* or *gitoliteIdentityPublicKeyFile* variables -- these specify
+the path to the private/public key files for accessing the gitolite admin repository.
-The *gitRepositoryBasePath* is the path *relative to the git user root* where the repositories are located. This should always end in a file separator, e.g. '/'.
-Since gitolite always uses repositories/ as the default place for repositories you probably shouldn't have to change this.
+Although you can change the following three variables, their default values provide for a very reasonable installation:
+The *gitRepositoryBasePath* is the path *relative to the git user root* where the repositories are located. This should always be non-empty and should end
+in a file separator, e.g. '/'. Since gitolite always uses repositories/ as the default place for repositories you probably shouldn't have to change this.
-If you followed the above directions you will not need to modify the *gitoliteIdentityFile* or *gitoliteIdentityPublicKeyFile* variables -- these specify
-the path to the private/public key files for accessing the gitolite admin repository.
+The *gitRedmineSubdir* is an optional subdirectory under the *gitRepositoryBasePath* which can be used for all plugin-managed repositories. Its default value
+is the empty string (no special subdirectory). If you choose to set it, make sure that the resulting path ends in a file separator, e.g. '/'.
+The *gitRepositoryHierarchy* variable is a boolean value which denotes whether or not the plugin-managed repositories are placed into a hierarchy that
+mirrors the project hierarchy. Its value is either 'true' (default) or 'false'.
These variables can be modified at a later time in the Administration => Plugins => Redmine Git Hosting Plugin configuration page. However to ensure
that the database migration from your existing repositories goes smoothly it is best to modify these variables now.
+As an example of the significance of the previous three variables, suppose that project-3 is a child of project-2 which is a child of project-1.
+Assume *gitRepositoryBasePath* == "repository/" and *gitRedmineSubdir* == "projects". When *gitRepositoryHierachy* is 'true', project-3.git will be stored in
+repository/projects/project-1/project-2/project-3.git, which will further be reflected in the ssh access URL of repository/projects/project-1/project-2/project-3.git.
+In contrast, when *gitRepositoryHierarchy* is 'false', project-3.git will be stored directly under repository/projects -- regardless of the number and identity of
+any parents that it might have. Note that the top of the settings page (Administration => Plugins => Redmine Git Hosting Plugin configuration page) provides
+information about how your chosen configuration affects the storage locations and URLs for accessing projects.
**(7)** Run the rake db:migrate\_plugins task to update the database. You will need to do this once for every
rails environment you have configured (e.g. production, development, testing). For the production environment run:
RAILS_ENV=production rake db:migrate_plugins
+At this point, if you wish to utilize selinux to protect your installation, you should follow the instructions given in the "Selinux" section, below.
+
**(8)** Unless you want to access your repositories exclusively via Smart HTTP users will need to set a
public key to connect via SSH. To do this, open a browser, login to ChiliProject/Redmine and follow the "My Account" Link
in the upper right-hand corner of the page. The right-hand column contains controls for adding your public key(s).
@@ -143,6 +156,9 @@ do not re-use the key you set as the gitolite admin key.
**(9)** The plugin is now configured, but you may now want to set some additional settings on the
Administration => Plugins => Redmine Git Hosting Plugin page.
+The *gitLockWaitTime* represents the amount of time that the plugin will wait in attempting to acquire its internal synchronization lock before giving up.
+You probably will not need to change this value.
+
*Automatically Initialize Git Repositories For New Projects* can be enabled to automatically create a new git repository every time
you create a new project. You won't have to create the project, and then create the repository -- this will be done all it one step. However, if
you have both git and svn (or hg, or cvs etc.) repositories, this may cause problems so it is disabled by default.
@@ -153,11 +169,8 @@ the accidental loss of data. If this feature is enabled, the safety is turned of
deleted in ChiliProject/Redmine. Note, however, that even when this feature is enabled, deleted repositories are placed into a "recycle_bin" for a configurable
amount of time (defaulting to 24 hours) and can be recovered by recreating the project in Redmine with the same Identifier. Details are placed in the log.
-The *gitRecycleBasePath* is the path *relative to the git user root* where deleted repositories are placed. This path should end in a path separator, e.g. '/'.
-Deleted repositories are kept here for up to *gitRecycleExpireTime* hours (configurable, defaults to 24.0 hours).
-
-The *gitLockWaitTime* represents the amount of time that the plugin will wait in attempting to acquire its internal synchronization lock before giving up.
-You probably will not need to change this value.
+The *Git Recycle Bin Base Path* is the path *relative to the git user root* where deleted repositories are placed. This path should end in a path separator,
+e.g. '/'. Deleted repositories are kept here for up to *gitRecycleExpireTime* hours (configurable, defaults to 24.0 hours).
*Show Checkout URLs* can be disabled to hide the git URL bar in the repository tab. It is enabled by default.
@@ -323,7 +336,14 @@ change options, then place your system back into enforcing mode. Alternatively,
file and reinstall the plugin. Under normal operation, you will get one selinux complaint about /bin/touch
in your log each time that you visit the plugin settings page.
-This rakefile and selinux configuration has been primarily tested on Redhat Enterprise Linux version 6.x
+One final comment: The selinux policy exists in binary form as selinux/redmine_git.pp. Should this policy
+need to be rebuilt, an additional rake task exists which will build the policy from selinux/redmine_git.te:
+
+ rake selinux:redmine_git_hosting:build_policy
+
+This task can be followed by the selinux:install task.
+
+The rakefile and selinux configuration has been primarily tested on Redhat Enterprise Linux version 6.x
with apache and fcgi. Other configurations may require slight tweaking.
## Tested Configurations
diff --git a/app/controllers/git_http_controller.rb b/app/controllers/git_http_controller.rb
index b5faaba1a..cd42f97a6 100644
--- a/app/controllers/git_http_controller.rb
+++ b/app/controllers/git_http_controller.rb
@@ -10,71 +10,83 @@ class GitHttpController < ApplicationController
before_filter :authenticate
-
def index
- p1 = params[:p1]
- p2 = params[:p2]
- p3 = params[:p3]
- proj_id = params[:id]
-
-
- @git_http_repo_path = (params[:path]).gsub(/\.git$/, "")
-
- reqfile = p2 == "" ? p1 : ( p3 == "" ? p1 + "/" + p2 : p1 + "/" + p2 + "/" + p3);
-
- if p1 == "git-upload-pack"
- service_rpc("upload-pack")
- elsif p1 == "git-receive-pack"
- service_rpc("receive-pack")
- elsif p1 == "info" && p2 == "refs"
- get_info_refs(reqfile)
- elsif p1 == "HEAD"
- get_text_file(reqfile)
- elsif p1 == "objects" && p2 == "info"
- if p3 != packs
- get_text_file(reqfile)
- else
- get_info_packs(reqfile)
- end
- elsif p1 == "objects" && p2 != "pack"
- get_loose_object(reqfile)
- elsif p1 == "objects" && p2 == "pack" && p3.match(/\.pack$/)
- get_pack_file(reqfile)
- elsif p1 == "objects" && p2 == "pack" && p3.match(/\.idx$/)
- get_idx_file(reqfile)
- else
- render_not_found
- end
-
+ if proj_path_split = (params[:project_path].match(/^(.*?([^\/]+))\.git$/))
+ proj_id = proj_path_split[2]
+ project = Project.find_by_identifier(proj_id)
+ @git_http_repo_path = project_path = proj_path_split[1]
+
+ if GitHosting.http_access_url(project) == project_path
+ p1 = params[:path][0] || ""
+ p2 = params[:path][1] || ""
+ p3 = params[:path][2] || ""
+
+ # Full requested path from .git repo
+ reqfile = params[:path].join('/')
+
+ # git http protocol
+ if p1 == "git-upload-pack"
+ service_rpc("upload-pack")
+ elsif p1 == "git-receive-pack"
+ service_rpc("receive-pack")
+ elsif p1 == "info" && p2 == "refs"
+ get_info_refs(reqfile)
+ elsif p1 == "HEAD"
+ get_text_file(reqfile)
+ elsif p1 == "objects" && p2 == "info"
+ if p3 != "packs"
+ get_text_file(reqfile)
+ else
+ get_info_packs(reqfile)
+ end
+ elsif p1 == "objects" && p2 != "pack"
+ get_loose_object(reqfile)
+ elsif p1 == "objects" && p2 == "pack" && p3.match(/\.pack$/)
+ get_pack_file(reqfile)
+ elsif p1 == "objects" && p2 == "pack" && p3.match(/\.idx$/)
+ get_idx_file(reqfile)
+ else
+ render_not_found
+ end
+ else
+ # repository URL doesn't match
+ render_not_found
+ end
+ return
+ end
+ # Wrong prefix or :base doesn't end in .git or doesn't at least have one char in base name
+ render_not_found
end
private
def authenticate
- is_push = params[:p1] == "git-receive-pack"
+ is_push = (params[:path][0] == "git-receive-pack")
query_valid = false
authentication_valid = true
- project = Project.find(params[:id])
- repository = project != nil ? project.repository : nil
- if(project != nil && repository !=nil)
- if repository.extra[:git_http] == 2 || (repository.extra[:git_http] == 1 && is_ssl?)
- query_valid = true
- allow_anonymous_read = project.is_public
- if is_push || (!allow_anonymous_read)
- authentication_valid = false
- authenticate_or_request_with_http_basic do |login, password|
- user = User.find_by_login(login);
- if user.is_a?(User)
- if user.allowed_to?( :commit_access, project ) || ((!is_push) && user.allowed_to?( :view_changesets, project ))
- authentication_valid = user.check_password?(password)
+ if proj_path_split = (params[:project_path].match(/^(.*?([^\/]+))\.git$/))
+ project = Project.find_by_identifier(proj_path_split[2])
+ repository = project != nil ? project.repository : nil
+ if(project != nil && repository !=nil)
+ if repository.extra[:git_http] == 2 || (repository.extra[:git_http] == 1 && is_ssl?)
+ query_valid = true
+ allow_anonymous_read = project.is_public
+ if is_push || (!allow_anonymous_read)
+ authentication_valid = false
+ authenticate_or_request_with_http_basic do |login, password|
+ user = User.find_by_login(login);
+ if user.is_a?(User)
+ if user.allowed_to?( :commit_access, project ) || ((!is_push) && user.allowed_to?( :view_changesets, project ))
+ authentication_valid = user.check_password?(password)
+ end
end
+ authentication_valid
end
- authentication_valid
end
end
end
- end
+ end
#if authentication failed, error already rendered
#so, just render case where user queried a project
diff --git a/app/models/git_hosting_observer.rb b/app/models/git_hosting_observer.rb
index 9599a0b7c..d254e8e1f 100644
--- a/app/models/git_hosting_observer.rb
+++ b/app/models/git_hosting_observer.rb
@@ -13,45 +13,40 @@ def reload_this_observer
end
- def self.set_update_active(is_active)
- case is_active
- when Symbol then @@updating_active_flags[is_active] = true
- when Hash then @updating_active_flags.merge(is_active)
- when Project then @@cached_project_updates << is_active
- end
-
- if !is_active
+ def self.set_update_active(*is_active)
+ if !is_active || !is_active.first
@@updating_active_stack += 1
else
- @@updating_active_stack -= 1
- if @@updating_active_stack < 0
- @@updating_active_stack = 0
- end
- end
-
- if is_active && @@updating_active_stack == 0
- if @@cached_project_updates.length > 0 || !@@updating_active_flags.empty?
+ is_active.each do |item|
+ case item
+ when Symbol then @@updating_active_flags[item] = true
+ when Hash then @@updating_active_flags.merge!(item)
+ when Project then @@cached_project_updates |= [item]
+ end
+ end
+
+ # If about to transition to zero and have something to run, do it
+ if @@updating_active_stack == 1 && (@@cached_project_updates.length > 0 || !@@updating_active_flags.empty?)
@@cached_project_updates = @@cached_project_updates.flatten.uniq.compact
GitHosting::update_repositories(@@cached_project_updates, @@updating_active_flags)
- @@cached_project_updates = []
- @@updating_active_flags = {}
- end
- @@updating_active = true
- else
- @@updating_active = false
- end
- end
+ @@cached_project_updates = []
+ @@updating_active_flags = {}
+ end
- def before_destroy(object)
- if object.is_a?(Repository::Git)
- if Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true"
- GitHosting::delete_repository(object.project)
- %x[#{GitHosting::git_user_runner} 'rm -rf #{object.url}' ]
- end
- GitHosting::clear_cache_for_project(object.project)
+ # Wait until after running update_repositories before releasing
+ @@updating_active_stack -= 1
+ if @@updating_active_stack < 0
+ @@updating_active_stack = 0
+ end
end
+ @@updating_active = (@@updating_active_stack == 0)
end
-
+
+ # Register args for updating and then do it without allowing recursive calls
+ def self.bracketed_update_repositories(*args)
+ set_update_active(false)
+ set_update_active(*args)
+ end
def after_create(object)
if not object.is_a?(Project)
@@ -73,15 +68,18 @@ def after_save(object)
def after_destroy(object)
- if !object.is_a?(Repository::Git)
- update_repositories(object)
+ if object.is_a?(Repository::Git)
+ update_repositories(object,:delete=>true)
+ GitHosting::clear_cache_for_project(object.project)
+ else
+ update_repositories(object)
end
end
protected
- def update_repositories(object)
+ def update_repositories(object,*flags)
projects = []
case object
when Repository::Git then projects.push(object.project)
@@ -90,11 +88,12 @@ def update_repositories(object)
when Member then projects.push(object.project)
when Role then projects = object.members.map(&:project).flatten.uniq.compact
end
- if(projects.length > 0)
+ if (projects.length > 0)
if (@@updating_active)
- GitHosting::update_repositories(projects)
+ GitHosting::update_repositories(projects,*flags)
else
@@cached_project_updates.concat(projects)
+ @@updating_active_flags.merge!(*flags) unless flags.empty?
end
end
end
diff --git a/app/models/git_hosting_settings_observer.rb b/app/models/git_hosting_settings_observer.rb
index 884779cb6..e80e36156 100644
--- a/app/models/git_hosting_settings_observer.rb
+++ b/app/models/git_hosting_settings_observer.rb
@@ -25,7 +25,37 @@ def before_save(object)
valuehash['gitoliteIdentityFile'] = @@old_valuehash['gitoliteIdentityFile']
valuehash['gitoliteIdentityPublicKeyFile'] = @@old_valuehash['gitoliteIdentityPublicKeyFile']
end
+
+ # Server should not include any path components
+ if valuehash['gitServer']
+ normalizedServer = valuehash['gitServer'].lstrip.rstrip.split('/').first
+ if (normalizedServer == '')
+ valuehash['gitServer'] = @@old_valuehash['gitServer']
+ else
+ valuehash['gitServer'] = normalizedServer
+ end
+ end
+
+ # Server should not include any path components
+ if valuehash['httpServer']
+ normalizedServer = valuehash['httpServer'].lstrip.rstrip.split('/').first
+ if (normalizedServer == '')
+ valuehash['httpServer'] = @@old_valuehash['httpServer']
+ else
+ valuehash['httpServer'] = normalizedServer
+ end
+ end
+ # Normalize http repository subdirectory path, should be either empty or relative and end in '/'
+ if valuehash['httpServerSubdir']
+ normalizedFile = File.expand_path(valuehash['httpServerSubdir'].lstrip.rstrip,"/")
+ if (normalizedFile != "/")
+ valuehash['httpServerSubdir'] = normalizedFile[1..-1] + "/" # Clobber leading '/' add trailing '/'
+ else
+ valuehash['httpServerSubdir'] = ''
+ end
+ end
+
# Normalize Repository path, should be relative and end in '/'
if valuehash['gitRepositoryBasePath']
normalizedFile = File.expand_path(valuehash['gitRepositoryBasePath'].lstrip.rstrip,"/")
@@ -36,6 +66,16 @@ def before_save(object)
end
end
+ # Normalize Redmine Subdirectory path, should be either empty or relative and end in '/'
+ if valuehash['gitRedmineSubdir']
+ normalizedFile = File.expand_path(valuehash['gitRedmineSubdir'].lstrip.rstrip,"/")
+ if (normalizedFile != "/")
+ valuehash['gitRedmineSubdir'] = normalizedFile[1..-1] + "/" # Clobber leading '/' add trailing '/'
+ else
+ valuehash['gitRedmineSubdir'] = ''
+ end
+ end
+
# Normalize Recycle bin path, should be relative and end in '/'
if valuehash['gitRecycleBasePath']
normalizedFile = File.expand_path(valuehash['gitRecycleBasePath'].lstrip.rstrip,"/")
@@ -72,41 +112,43 @@ def after_save(object)
# Only perform after-actions on settings for our plugin
if object.name == "plugin_redmine_git_hosting"
valuehash = object.value
+
+ # Settings cache doesn't seem to invalidate symbolic versions of Settings immediately,
+ # so, any use of Setting.plugin_redmine_git_hosting[] by things called during this
+ # callback will be outdated.... True for at least some versions of redmine plugin...
+ #
+ # John Kubiatowicz 12/21/2011
+ if Setting.respond_to?(:check_cache)
+ # Clear out all cached settings.
+ Setting.check_cache
+ end
if GitHosting.bin_dir_writeable?
%x[ rm -rf '#{ GitHosting.get_tmp_dir }' ]
%x[ rm -rf '#{ GitHosting.get_bin_dir }' ]
end
- if @@old_valuehash['gitRepositoryBasePath'] != valuehash['gitRepositoryBasePath']
- GitHostingObserver.set_update_active(false)
- all_projects = Project.find(:all)
- all_projects.each do |p|
- if p.repository.is_a?(Repository::Git)
- r = p.repository
- repo_name= p.parent ? File.join(GitHosting::get_full_parent_path(p, true),p.identifier) : p.identifier
- r.url = File.join(valuehash['gitRepositoryBasePath'], "#{repo_name}.git")
- r.root_url = r.url
- r.save
- end
- end
- GitHostingObserver.set_update_active(true)
+ if @@old_valuehash['gitRepositoryBasePath'] != valuehash['gitRepositoryBasePath'] ||
+ @@old_valuehash['gitRedmineSubdir'] != valuehash['gitRedmineSubdir'] ||
+ @@old_valuehash['gitRepositoryHierarchy'] != valuehash['gitRepositoryHierarchy'] ||
+ @@old_valuehash['gitUser'] != valuehash['gitUser']
+ # Need to update everyone!
+ GitHostingObserver.bracketed_update_repositories(:resync_all)
end
if @@old_valuehash['gitUser'] != valuehash['gitUser']
GitHosting.setup_hooks
- GitHosting.update_repositories(:resync_all=>true)
elsif @@old_valuehash['httpServer'] != valuehash['httpServer'] ||
@@old_valuehash['gitHooksDebug'] != valuehash['gitHooksDebug'] ||
- @@old_valuehash['gitRepositoryBasePath'] != valuehash['gitRepositoryBasePath'] ||
+ @@old_valuehash['gitRedmineSubdir'] != valuehash['gitRedmineSubdir'] ||
+ @@old_valuehash['gitRepositoryHierarchy'] != valuehash['gitRepositoryHierarchy'] ||
@@old_valuehash['gitHooksAreAsynchronous'] != valuehash['gitHooksAreAsynchronous']
GitHosting.update_global_hook_params
end
-
- @@old_valuehash = (Setting.plugin_redmine_git_hosting).clone
+ @@old_valuehash = valuehash.clone
end
end
end
diff --git a/app/views/projects/_git_urls.erb b/app/views/projects/_git_urls.erb
index be2121e58..fa9c4388c 100644
--- a/app/views/projects/_git_urls.erb
+++ b/app/views/projects/_git_urls.erb
@@ -10,17 +10,22 @@
<% end %>
From b50d99374ed2bf2f8d2f53c3e94e2dad059319d1 Mon Sep 17 00:00:00 2001
From: Greg Thornton
Date: Mon, 21 May 2012 15:03:25 -0500
Subject: [PATCH 043/107] Refactor extracting repo info for hooks
---
app/controllers/gitolite_hooks_controller.rb | 114 ++++++++++++++-----
1 file changed, 85 insertions(+), 29 deletions(-)
diff --git a/app/controllers/gitolite_hooks_controller.rb b/app/controllers/gitolite_hooks_controller.rb
index 8a02590a3..91aad0c7b 100644
--- a/app/controllers/gitolite_hooks_controller.rb
+++ b/app/controllers/gitolite_hooks_controller.rb
@@ -12,6 +12,80 @@ def stub
render(:code => 404)
end
+ def post_receive_payloads(refs, project=nil)
+ project ||= @project
+ payloads = []
+ refs.each do |ref|
+ oldhead, newhead, refname = ref.split(',')
+
+ # Only pay attention to branch updates
+ next if not refname.match(/refs\/heads\//)
+ branch = refname.gsub('refs/heads/', '')
+
+ if newhead.match(/^0{40}$/)
+ # Deleting a branch
+ GitHosting.logger.debug "Deleting branch \"#{branch}\""
+ next
+ elsif oldhead.match(/^0{40}$/)
+ # Creating a branch
+ GitHosting.logger.debug "Creating branch \"#{branch}\""
+ range = newhead
+ else
+ range = "#{oldhead}..#{newhead}"
+ end
+
+ revisions_in_range = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(project)}' rev-list --reverse #{range}]
+ #GitHosting.logger.debug "Revisions in Range: #{revisions.split().join(' ')}"
+
+ commits = []
+ revisions_in_range.split().each do |rev|
+ revision = project.repository.find_changeset_by_name(rev.strip)
+ commit = {
+ :id => revision.revision,
+ :url => "",
+ :author => revision.author,
+ :message => "",
+ :timestamp => "",
+ :added => [],
+ :modified => [],
+ :removed => []
+ }
+ revision.changes.each do |change|
+ if change.action == "M"
+ commit[:modified] << change.path
+ elsif change.action == "A"
+ commit[:added] << change.path
+ elsif change.action == "D"
+ commit[:removed] << change.path
+ end
+ end
+ commits << commit
+ end
+
+ payloads << {
+ :before => oldhead,
+ :after => newhead,
+ :ref => refname,
+ :commits => commits,
+ :repository => {
+ :description => "",
+ :fork => "",
+ :homepage => "",
+ :name => "",
+ :open_issues => "",
+ :owner => {
+ :email => "",
+ :name => ""
+ },
+ :private => true,
+ :url => "",
+ :watchers => 0
+ }
+ }
+ end
+ payloads
+ end
+
def post_receive
if not @project.repository.extra.validate_encoded_time(params[:clear_time], params[:encoded_time])
@@ -47,46 +121,28 @@ def post_receive
output.flush
} if @project.repository_mirrors.any?
+ payloads = post_receive_payloads(params[:refs])
+ GitHosting.logger.info "Payloads - #{payloads.to_json}"
+
# Notify CIA
#Thread.abort_on_exception = true
- Thread.new(@project, params[:refs]) {|project, refs|
+ Thread.new(@project, payloads) {|project, payloads|
GitHosting.logger.debug "Notifying CIA"
output.write("Notifying CIA\n")
output.flush
#GitHosting.logger.debug "REFS #{refs}"
- refs.each {|ref|
- oldhead, newhead, refname = ref.split(',')
-
- # Only pay attention to branch updates
- next if not refname.match(/refs\/heads\//)
-
- branch = refname.gsub('refs/heads/', '')
-
- if newhead.match(/^0{40}$/)
- # Deleting a branch
- GitHosting.logger.debug "Deleting branch \"#{branch}\""
- next
- elsif oldhead.match(/^0{40}$/)
- # Creating a branch
- GitHosting.logger.debug "Creating branch \"#{branch}\""
- range = newhead
- else
- range = "#{oldhead}..#{newhead}"
- end
-
- revisions = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(@project)}' rev-list --reverse #{range}]
- #GitHosting.logger.debug "Revisions in Range: #{revisions.split().join(' ')}"
-
- revisions.split().each{|rev|
- revision = project.repository.find_changeset_by_name(rev.strip)
- #GitHosting.logger.debug "Revision Found: #{revision.revision}"
+ payloads.each do |payload|
+ branch = payload[:ref].gsub('refs/heads/', '')
+ payload[:commits].each do |commit|
+ revision = project.repository.find_changeset_by_name(commit[:id])
next if project.repository.cia_notifications.notified?(revision) # Already notified about this commit
GitHosting.logger.info "Notifying CIA: Branch => #{branch} REVISION => #{revision.revision}"
CiaNotificationMailer.deliver_notification(revision, branch)
project.repository.cia_notifications.notified(revision)
- }
- }
+ end
+ end
+
} if !params[:refs].nil? && @project.repository.extra.notify_cia==1
}, :layout => false
end
From fdf2669cd3eee9237d9558ffe676fc03d6f7166c Mon Sep 17 00:00:00 2001
From: Greg Thornton
Date: Mon, 21 May 2012 16:50:55 -0500
Subject: [PATCH 044/107] Fill out post-receive url payload
---
app/controllers/gitolite_hooks_controller.rb | 27 ++++++++++++--------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/app/controllers/gitolite_hooks_controller.rb b/app/controllers/gitolite_hooks_controller.rb
index 91aad0c7b..e5dfedeec 100644
--- a/app/controllers/gitolite_hooks_controller.rb
+++ b/app/controllers/gitolite_hooks_controller.rb
@@ -42,10 +42,13 @@ def post_receive_payloads(refs, project=nil)
revision = project.repository.find_changeset_by_name(rev.strip)
commit = {
:id => revision.revision,
- :url => "",
- :author => revision.author,
- :message => "",
- :timestamp => "",
+ :url => url_for_revision(revision),
+ :author => {
+ :name => revision.committer.gsub(/^([^<]+)\s+.*$/, '\1'),
+ :email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\1')
+ },
+ :message => revision.comments,
+ :timestamp => revision.committed_on,
:added => [],
:modified => [],
:removed => []
@@ -68,16 +71,17 @@ def post_receive_payloads(refs, project=nil)
:ref => refname,
:commits => commits,
:repository => {
- :description => "",
- :fork => "",
- :homepage => "",
- :name => "",
- :open_issues => "",
+ :description => project.description,
+ :fork => false,
+ :forks => 0,
+ :homepage => project.homepage,
+ :name => project.identifier,
+ :open_issues => project.issues.open.length,
:owner => {
:email => "",
:name => ""
},
- :private => true,
+ :private => !project.is_public,
:url => "",
:watchers => 0
}
@@ -122,7 +126,8 @@ def post_receive
} if @project.repository_mirrors.any?
payloads = post_receive_payloads(params[:refs])
- GitHosting.logger.info "Payloads - #{payloads.to_json}"
+
+ # Post to each post-receive URL here
# Notify CIA
#Thread.abort_on_exception = true
From 4f79cf980ec8ac9fd20e7c3c618dba0894700a5e Mon Sep 17 00:00:00 2001
From: Greg Thornton
Date: Mon, 21 May 2012 16:51:13 -0500
Subject: [PATCH 045/107] Only count response code 200 as success in
post-receive hook
---
contrib/hooks/post-receive.redmine_gitolite.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/hooks/post-receive.redmine_gitolite.rb b/contrib/hooks/post-receive.redmine_gitolite.rb
index 27dcd7d6c..b41336515 100755
--- a/contrib/hooks/post-receive.redmine_gitolite.rb
+++ b/contrib/hooks/post-receive.redmine_gitolite.rb
@@ -44,7 +44,7 @@ def run_query(url_str, params, with_https)
req.set_form_data(params)
response = http.request(req) do |response|
response.read_body do |body_frag|
- success = true
+ success = response.code.to_i == 200 ? true : false
log(body_frag, false, false)
end
end
From c30210beb4eb32dc6f9a8aeaced6777606f8e28d Mon Sep 17 00:00:00 2001
From: Greg Thornton
Date: Mon, 21 May 2012 21:55:34 -0500
Subject: [PATCH 046/107] POST to post-receive URLs and add en translations
---
app/controllers/gitolite_hooks_controller.rb | 96 ++++++++++++--------
config/locales/en.yml | 7 ++
2 files changed, 67 insertions(+), 36 deletions(-)
diff --git a/app/controllers/gitolite_hooks_controller.rb b/app/controllers/gitolite_hooks_controller.rb
index e5dfedeec..f32787ca7 100644
--- a/app/controllers/gitolite_hooks_controller.rb
+++ b/app/controllers/gitolite_hooks_controller.rb
@@ -12,6 +12,8 @@ def stub
render(:code => 404)
end
+ # Returns an array of GitHub post-receive hook style hashes
+ # http://help.github.com/post-receive-hooks/
def post_receive_payloads(refs, project=nil)
project ||= @project
payloads = []
@@ -41,49 +43,55 @@ def post_receive_payloads(refs, project=nil)
revisions_in_range.split().each do |rev|
revision = project.repository.find_changeset_by_name(rev.strip)
commit = {
- :id => revision.revision,
- :url => url_for_revision(revision),
- :author => {
- :name => revision.committer.gsub(/^([^<]+)\s+.*$/, '\1'),
- :email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\1')
+ "id" => revision.revision,
+ "url" => url_for(:controller => "repositories", :action => "revision",
+ :id => project, :rev => rev, :only_path => false,
+ :host => Setting['host_name'], :protocol => Setting['protocol']
+ ),
+ "author" => {
+ "name" => revision.committer.gsub(/^([^<]+)\s+.*$/, '\1'),
+ "email" => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\1')
},
- :message => revision.comments,
- :timestamp => revision.committed_on,
- :added => [],
- :modified => [],
- :removed => []
+ "message" => revision.comments,
+ "timestamp" => revision.committed_on,
+ "added" => [],
+ "modified" => [],
+ "removed" => []
}
revision.changes.each do |change|
if change.action == "M"
- commit[:modified] << change.path
+ commit["modified"] << change.path
elsif change.action == "A"
- commit[:added] << change.path
+ commit["added"] << change.path
elsif change.action == "D"
- commit[:removed] << change.path
+ commit["removed"] << change.path
end
end
commits << commit
end
payloads << {
- :before => oldhead,
- :after => newhead,
- :ref => refname,
- :commits => commits,
- :repository => {
- :description => project.description,
- :fork => false,
- :forks => 0,
- :homepage => project.homepage,
- :name => project.identifier,
- :open_issues => project.issues.open.length,
- :owner => {
- :email => "",
- :name => ""
+ "before" => oldhead,
+ "after" => newhead,
+ "ref" => refname,
+ "commits" => commits,
+ "repository" => {
+ "description" => project.description,
+ "fork" => false,
+ "forks" => 0,
+ "homepage" => project.homepage,
+ "name" => project.identifier,
+ "open_issues" => project.issues.open.length,
+ "owner" => {
+ "name" => Setting["app_title"],
+ "email" => Setting["mail_from"]
},
- :private => !project.is_public,
- :url => "",
- :watchers => 0
+ "private" => !project.is_public,
+ "url" => url_for(:controller => "repositories", :action => "show",
+ :id => project, :only_path => false,
+ :host => Setting["host_name"], :protocol => Setting["protocol"]
+ ),
+ "watchers" => 0
}
}
end
@@ -125,9 +133,26 @@ def post_receive
output.flush
} if @project.repository_mirrors.any?
- payloads = post_receive_payloads(params[:refs])
+ payloads = []
+ if @project.repository.extra.notify_cia == 1 or @project.repository_post_receive_urls.any?
+ payloads = post_receive_payloads(params[:refs])
+ end
- # Post to each post-receive URL here
+ # Post to each post-receive URL
+ @project.repository_post_receive_urls.all(:order => "active DESC, created_at ASC", :conditions => "active=1").each do |prurl|
+ msg = "Posting #{payloads.length} post-receive payloads to #{prurl.url} ... "
+ GitHosting.logger.debug msg
+ output.write msg
+ output.flush
+ uri = URI(prurl.url)
+ payloads.each do |payload|
+ res = Net::HTTP.post_form(uri, {"payload" => payload})
+ output.write res.is_a?(Net::HTTPSuccess) ? "[success] " : "[failure] "
+ output.flush
+ end
+ output.write "done\n"
+ output.flush
+ end if @project.repository_post_receive_urls.any?
# Notify CIA
#Thread.abort_on_exception = true
@@ -135,12 +160,11 @@ def post_receive
GitHosting.logger.debug "Notifying CIA"
output.write("Notifying CIA\n")
output.flush
- #GitHosting.logger.debug "REFS #{refs}"
payloads.each do |payload|
- branch = payload[:ref].gsub('refs/heads/', '')
- payload[:commits].each do |commit|
- revision = project.repository.find_changeset_by_name(commit[:id])
+ branch = payload["ref"].gsub("refs/heads/", "")
+ payload["commits"].each do |commit|
+ revision = project.repository.find_changeset_by_name(commit["id"])
next if project.repository.cia_notifications.notified?(revision) # Already notified about this commit
GitHosting.logger.info "Notifying CIA: Branch => #{branch} REVISION => #{revision.revision}"
CiaNotificationMailer.deliver_notification(revision, branch)
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9f40e84d0..cb518cad1 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -97,6 +97,13 @@ en:
mirror_notice_created: Mirror was successfully created
mirror_notice_updated: Mirror was successfully updated
mirror_notice_create_failed: Failed to create mirror
+ label_post_receive_url_create: Create Repository Post-receive URL
+ label_post_receive_url_delete: Delete Repository Post-receive URL
+ label_post_receive_url_edit: Edit Repository Post-receive URL
+ post_receive_url_notice_deleted: Post-receive URL was successfully deleted
+ post_receive_url_notice_created: Post-receive URL was successfully created
+ post_receive_url_notice_updated: Post-receive URL was successfully updated
+ post_receive_url_notice_create_failed: Failed to create Post-receive URL
button_push: Push
button_push_title: "Push To Mirror"
From 419c5b4a9bd214678d792e2f95d24b6b44a98179 Mon Sep 17 00:00:00 2001
From: Greg Thornton
Date: Tue, 22 May 2012 01:57:30 -0500
Subject: [PATCH 047/107] Adding post-receive URL modes
---
app/models/repository_post_receive_url.rb | 8 ++++++++
app/views/repository_post_receive_urls/_form.html.erb | 1 +
db/migrate/2012052200000_add_post_receive_url_modes.rb | 9 +++++++++
3 files changed, 18 insertions(+)
create mode 100644 db/migrate/2012052200000_add_post_receive_url_modes.rb
diff --git a/app/models/repository_post_receive_url.rb b/app/models/repository_post_receive_url.rb
index 032b65c67..bdbddea6a 100644
--- a/app/models/repository_post_receive_url.rb
+++ b/app/models/repository_post_receive_url.rb
@@ -12,6 +12,14 @@ class RepositoryPostReceiveUrl < ActiveRecord::Base
named_scope :active, {:conditions => {:active => RepositoryPostReceiveUrl::STATUS_ACTIVE}}
named_scope :inactive, {:conditions => {:active => RepositoryPostReceiveUrl::STATUS_INACTIVE}}
+ validates_inclusion_of :mode, :in => [:github, :get]
+ def mode
+ read_attribute(:mode).to_sym rescue nil
+ end
+ def mode= (value)
+ write_attribute(:mode, (value.to_sym && value.to_sym.to_s rescue nil))
+ end
+
def to_s
return File.join("#{project.identifier}-#{url}")
end
diff --git a/app/views/repository_post_receive_urls/_form.html.erb b/app/views/repository_post_receive_urls/_form.html.erb
index a2b1bd099..eaef09275 100644
--- a/app/views/repository_post_receive_urls/_form.html.erb
+++ b/app/views/repository_post_receive_urls/_form.html.erb
@@ -4,5 +4,6 @@
<%= text_field_tag("settings[gitRepositoryBasePath]", "./#{@settings['gitRepositoryBasePath']}", :size => 60) %>
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 7701441a6..bac4065ef 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -6,6 +6,8 @@ bg:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ bg:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index 279e0e616..7158f7e3d 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -6,6 +6,8 @@ bs:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ bs:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index e2d0adfd3..ed842f7a9 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -6,6 +6,8 @@ ca:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ ca:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 4f3c5adc6..e1fa96dde 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -6,6 +6,8 @@ cs:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ cs:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 6b797f629..973630c8d 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -6,6 +6,8 @@ da:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ da:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 64e088275..5e5a4b949 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -6,6 +6,8 @@ de:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ de:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/el.yml b/config/locales/el.yml
index a0fa718f5..be4529f04 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -6,6 +6,8 @@ el:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ el:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c8a36cb86..cb36bc86c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -6,6 +6,8 @@ en:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ en:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 4844d058b..573b7f209 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -6,6 +6,8 @@ es:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ es:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index b3a323170..d63be5e6d 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -6,6 +6,8 @@ fi:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ fi:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 6fe36dede..4d2ac0a49 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -6,6 +6,8 @@ fr:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ fr:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 3af46f5d3..d03af4042 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -6,6 +6,8 @@ gl:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ gl:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 5692bde83..02252b0e6 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -6,6 +6,8 @@ he:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ he:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 2cbc404a5..e6c37c6cc 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -6,6 +6,8 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/id.yml b/config/locales/id.yml
index 34382c724..8e63e11b1 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -6,6 +6,8 @@ id:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ id:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 2bf6ed9a9..6be58efd4 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -6,6 +6,8 @@ it:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ it:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 634b4fd0b..0e6ae9c4f 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -6,6 +6,8 @@ ja:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ ja:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 5151be9f4..6cb43503e 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -6,6 +6,8 @@ ko:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ ko:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 79f4c0678..1f621b474 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -6,6 +6,8 @@ lt:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ lt:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 24f027996..a1a64f9cc 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -6,6 +6,8 @@ nl:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ nl:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 4f1fbb874..5b01171c6 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -6,6 +6,8 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 8f65385a9..8c2fc822a 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -6,6 +6,8 @@ pl:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ pl:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 9e89af42f..d36ceb9bd 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -6,6 +6,8 @@ pt-BR:
label_git_user: Nome de Utilizador Git
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
+ label_gitolite_config_file: 'Arquivo de configuração Gitolite (relativo ao diretório conf)'
+ label_gitolite_config_has_admin_key: 'Arquivo de configuração Gitolite tem admin chave'
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
label_git_recycle_base_path: 'Directório Recycle Bin base (Relativo à "home" do utilizador git)'
label_git_recycle_expire_time: 'expirar o tempo para Recycle Bin (em horas)'
@@ -35,6 +37,8 @@ pt-BR:
label_git_show_urls: "Exibir os URL's de checkout"
label_enabled: Habilitado
label_disabled: Desabilitado
+ label_true: "Verdadeiro"
+ label_false: "Falso"
label_flat: Plano
label_hierarchical: 'Hierárquico'
label_https_only: Apenas HTTPS
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 5da01f38c..c420e5a0d 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -6,6 +6,8 @@ pt:
label_git_user: Nome de Utilizador Git
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
+ label_gitolite_config_file: Arquivo de configuração Gitolite (relativo ao diretório conf)
+ label_gitolite_config_has_admin_key: Arquivo de configuração Gitolite tem admin chave
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
label_git_recycle_base_path: 'Directório Recycle Bin base (Relativo à "home" do utilizador git)'
label_git_recycle_expire_time: 'expirar o tempo para Recycle Bin (em horas)'
@@ -35,6 +37,8 @@ pt:
label_git_show_urls: "Exibir os URL's de checkout"
label_enabled: Habilitado
label_disabled: Desabilitado
+ label_true: "Verdadeiro"
+ label_false: "Falso"
label_flat: Plano
label_hierarchical: 'Hierárquico'
label_https_only: Apenas HTTPS
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 8ed42de28..6c2978bc4 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -6,6 +6,8 @@ ro:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ ro:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index fb09db4c5..cd6852f21 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -6,6 +6,8 @@ ru:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ ru:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 3fa172f50..0c18347e9 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -6,6 +6,8 @@ sk:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ sk:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index c1b59d78c..5ea76e91d 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -6,6 +6,8 @@ sl:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ sl:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 7e93c1536..1b7388206 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -6,6 +6,8 @@ sr:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ sr:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index a41bce90a..bc039bd38 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -6,6 +6,8 @@ sv:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ sv:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 8714e2357..4621d24a1 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -6,6 +6,8 @@ th:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ th:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index 70aa2103a..752100704 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -6,6 +6,8 @@ tr:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ tr:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 4d43e6086..a84293b29 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -6,6 +6,8 @@ uk:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ uk:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index 466a2b6eb..6dd5c2963 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -6,6 +6,8 @@ vi:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ vi:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index ac651375f..61031f104 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -6,6 +6,8 @@
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 70cb33940..d86b3eba9 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -6,6 +6,8 @@ zh:
label_git_user: Git Username
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Gitolite SSH Identity File (Private Key)
+ label_gitolite_config_file: Gitolite Configuration File (Relative to conf directory)
+ label_gitolite_config_has_admin_key: Gitolite Configuration File has Admin Key
label_git_repository_base_path: Git Repository Base Path (Relative to git user home)
label_git_recycle_base_path: Git Recycle Bin Base Path (Relative to git user home)
label_git_recycle_expire_time: Expire Time for Repositories in Recycle Bin (in hours)
@@ -35,6 +37,8 @@ zh:
label_git_show_urls: "Show checkout URL's"
label_enabled: Enabled
label_disabled: Disabled
+ label_true: "True"
+ label_false: "False"
label_flat: Flat
label_hierarchical: Hierarchical
label_https_only: HTTPS Only
diff --git a/db/migrate/20120724211806_add_settings_to_plugin_5.rb b/db/migrate/20120724211806_add_settings_to_plugin_5.rb
new file mode 100644
index 000000000..89efb0861
--- /dev/null
+++ b/db/migrate/20120724211806_add_settings_to_plugin_5.rb
@@ -0,0 +1,33 @@
+class AddSettingsToPlugin5 < ActiveRecord::Migration
+ def self.up
+ begin
+ # Add some new settings to settings page, if they don't exist
+ valuehash = (Setting.plugin_redmine_git_hosting).clone
+ valuehash['gitConfigFile'] ||= 'gitolite.conf'
+ valuehash['gitConfigHasAdminKey'] || 'true'
+
+ if (Setting.plugin_redmine_git_hosting != valuehash)
+ say "Added redmine_git_hosting settings: 'gitConfigFile', 'gitConfigHasAdminKey'"
+ Setting.plugin_redmine_git_hosting = valuehash
+ end
+ rescue => e
+ # ignore problems if plugin settings don't exist yet
+ end
+ end
+
+ def self.down
+ begin
+ # Remove above settings from plugin page
+ valuehash = (Setting.plugin_redmine_git_hosting).clone
+ valuehash.delete('gitConfigFile')
+ valuehash.delete('gitConfigHasAdminKey')
+
+ if (Setting.plugin_redmine_git_hosting != valuehash)
+ say "Removed redmine_git_hosting settings: 'gitConfigFile', 'gitConfigHasAdminKey"
+ Setting.plugin_redmine_git_hosting = valuehash
+ end
+ rescue => e
+ # ignore problems if table doesn't exist yet....
+ end
+ end
+end
diff --git a/init.rb b/init.rb
index b0638f276..4084f9e52 100755
--- a/init.rb
+++ b/init.rb
@@ -13,21 +13,23 @@
settings :default => {
'httpServer' => 'localhost',
- 'httpServerSubdir' => '',
+ 'httpServerSubdir' => '',
'gitServer' => 'localhost',
'gitUser' => 'git',
+ 'gitConfigPath' => 'gitolite.conf', # Redmine gitolite config file
+ 'gitConfigHasAdminKey' => 'true', # Conf file should have admin key
'gitRepositoryBasePath' => 'repositories/',
- 'gitRedmineSubdir' => '',
- 'gitRepositoryHierarchy' => 'true',
- 'gitRecycleBasePath' => 'recycle_bin/',
- 'gitRecycleExpireTime' => '24.0',
- 'gitLockWaitTime' => '10',
+ 'gitRedmineSubdir' => '',
+ 'gitRepositoryHierarchy' => 'true',
+ 'gitRecycleBasePath' => 'recycle_bin/',
+ 'gitRecycleExpireTime' => '24.0',
+ 'gitLockWaitTime' => '10',
'gitoliteIdentityFile' => RAILS_ROOT + '/.ssh/gitolite_admin_id_rsa',
'gitoliteIdentityPublicKeyFile' => RAILS_ROOT + '/.ssh/gitolite_admin_id_rsa.pub',
'allProjectsUseGit' => 'false',
- 'gitDaemonDefault' => '1', # Default is Daemon enabled
+ 'gitDaemonDefault' => '1', # Default is Daemon enabled
'gitHttpDefault' => '1', # Default is HTTP_ONLY
- 'gitNotifyCIADefault' => '0', # Default is CIA Notification disabled
+ 'gitNotifyCIADefault' => '0', # Default is CIA Notification disabled
'deleteGitRepositories' => 'false',
'gitRepositoriesShowUrl' => 'true',
'gitCacheMaxTime' => '-1',
@@ -35,9 +37,9 @@
'gitCacheMaxSize' => '16',
'gitHooksDebug' => 'false',
'gitHooksAreAsynchronous' => 'true',
- 'gitTempDataDir' => '/tmp/redmine_git_hosting/',
+ 'gitTempDataDir' => '/tmp/redmine_git_hosting/',
'gitScriptDir' => '',
- 'gitForceHooksUpdate' => 'true'
+ 'gitForceHooksUpdate' => 'true'
},
:partial => 'redmine_git_hosting'
project_module :repository do
@@ -45,8 +47,8 @@
permission :view_repository_mirrors, :repository_mirrors => :index
permission :edit_repository_mirrors, :repository_mirrors => :edit
permission :create_repository_post_receive_urls, :repository_post_receive_urls => :create
- permission :view_repository_post_receive_urls, :repository_post_receive_urls => :index
- permission :edit_repository_post_receive_urls, :repository_post_receive_urls => :edit
+ permission :view_repository_post_receive_urls, :repository_post_receive_urls => :index
+ permission :edit_repository_post_receive_urls, :repository_post_receive_urls => :edit
end
end
require "dispatcher"
diff --git a/lib/git_hosting.rb b/lib/git_hosting.rb
index 872234aca..5c52e3c55 100755
--- a/lib/git_hosting.rb
+++ b/lib/git_hosting.rb
@@ -10,65 +10,70 @@
module GitHosting
- LOCK_WAIT_IF_UNDEF = 10 # In case settings not migrated (normally from settings)
+ LOCK_WAIT_IF_UNDEF = 10 # In case settings not migrated (normally from settings)
REPOSITORY_IF_UNDEF = "repositories/" # In case settings not migrated (normally from settings)
REDMINE_SUBDIR = "" # In case settings not migrated (normally from settings)
REDMINE_HIERARCHICAL = "true" # In case settings not migrated (normally from settings)
- HTTP_SERVER_SUBDIR = "" # In case settings not migrated (normally from settings)
+ HTTP_SERVER_SUBDIR = "" # In case settings not migrated (normally from settings)
TEMP_DATA_DIR = "/tmp/redmine_git_hosting" # In case settings not migrated (normally from settings)
- SCRIPT_DIR = "" # In case settings not migrated (normally from settings)
+ SCRIPT_DIR = "" # In case settings not migrated (normally from settings)
SCRIPT_PARENT = "bin"
-
+
# Used to register errors when pulling and pushing the conf file
- class GitHostingException < StandardError
- end
-
- # Time in seconds to wait before giving up on acquiring the lock
- def self.lock_wait_time
- Setting.plugin_redmine_git_hosting['gitLockWaitTime'].to_i || LOCK_WAIT_IF_UNDEF
- end
-
- # Repository base path (relative to git user home directory)
- def self.repository_base
- Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'] || REPOSITORY_IF_UNDEF
- end
-
- # Redmine subdirectory path (relative to Repository base path
- def self.repository_redmine_subdir
- Setting.plugin_redmine_git_hosting['gitRedmineSubdir'] || REDMINE_SUBDIR
- end
-
- # Redmine repositories in hierarchy
- def self.repository_hierarchy
- (Setting.plugin_redmine_git_hosting['gitRepositoryHierarchy'] || REDMINE_HIERARCHICAL) != "false"
- end
+ class GitHostingException < StandardError
+ end
+
+ # Time in seconds to wait before giving up on acquiring the lock
+ def self.lock_wait_time
+ Setting.plugin_redmine_git_hosting['gitLockWaitTime'].to_i || LOCK_WAIT_IF_UNDEF
+ end
+
+ # Configuration file (relative to git conf directory)
+ def self.gitolite_conf
+ GitoliteConfig.gitolite_conf
+ end
+
+ # Repository base path (relative to git user home directory)
+ def self.repository_base
+ Setting.plugin_redmine_git_hosting['gitRepositoryBasePath'] || REPOSITORY_IF_UNDEF
+ end
+
+ # Redmine subdirectory path (relative to Repository base path
+ def self.repository_redmine_subdir
+ Setting.plugin_redmine_git_hosting['gitRedmineSubdir'] || REDMINE_SUBDIR
+ end
+
+ # Redmine repositories in hierarchy
+ def self.repository_hierarchy
+ (Setting.plugin_redmine_git_hosting['gitRepositoryHierarchy'] || REDMINE_HIERARCHICAL) != "false"
+ end
def self.http_server_subdir
- Setting.plugin_redmine_git_hosting['httpServerSubdir'] || HTTP_SERVER_SUBDIR
- end
-
- # This is the file portion of the url used when talking through ssh to the repository.
- def self.git_access_url project
- return "#{repository_name(project)}"
- end
-
- # This is the relative portion of the url (below the rails_root) used when talking through httpd to the repository
- # Note that this differs from the git_access_url in not including 'repository_redmine_subdir' as part of the path.
- def self.http_access_url project
- return "#{http_server_subdir}#{redmine_name(project)}"
- end
-
- # Server path (minus protocol)
- def self.my_root_url
- # Remove any path from httpServer in case they are leftover from previous installations.
- # No trailing /.
- my_root_path = Redmine::Utils::relative_url_root
- File.join(Setting.plugin_redmine_git_hosting['httpServer'][/^[^\/]*/],my_root_path,"/")[0..-2]
- end
-
- @@logger = nil
+ Setting.plugin_redmine_git_hosting['httpServerSubdir'] || HTTP_SERVER_SUBDIR
+ end
+
+ # This is the file portion of the url used when talking through ssh to the repository.
+ def self.git_access_url project
+ return "#{repository_name(project)}"
+ end
+
+ # This is the relative portion of the url (below the rails_root) used when talking through httpd to the repository
+ # Note that this differs from the git_access_url in not including 'repository_redmine_subdir' as part of the path.
+ def self.http_access_url project
+ return "#{http_server_subdir}#{redmine_name(project)}"
+ end
+
+ # Server path (minus protocol)
+ def self.my_root_url
+ # Remove any path from httpServer in case they are leftover from previous installations.
+ # No trailing /.
+ my_root_path = Redmine::Utils::relative_url_root
+ File.join(Setting.plugin_redmine_git_hosting['httpServer'][/^[^\/]*/],my_root_path,"/")[0..-2]
+ end
+
+ @@logger = nil
def self.logger
- @@logger ||= MyLogger.new
+ @@logger ||= MyLogger.new
end
@@web_user = nil
@@ -79,9 +84,9 @@ def self.web_user
return @@web_user
end
- def self.web_user=(setuser)
- @@web_user = setuser
- end
+ def self.web_user=(setuser)
+ @@web_user = setuser
+ end
def self.git_user
Setting.plugin_redmine_git_hosting['gitUser']
@@ -96,11 +101,11 @@ def self.mirror_push_public_key
%x[ #{GitHosting.git_user_runner} 'chmod 600 ~/.ssh/gitolite_admin_id_rsa' ]
%x[ #{GitHosting.git_user_runner} 'chmod 644 ~/.ssh/gitolite_admin_id_rsa.pub' ]
- pubk = ( %x[cat '#{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']}' ] ).chomp.strip
+ pubk = ( %x[cat '#{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']}' ] ).chomp.strip
git_user_dir = ( %x[ #{GitHosting.git_user_runner} "cd ~ ; pwd" ] ).chomp.strip
%x[ #{GitHosting.git_user_runner} 'echo "#{pubk}" > ~/.ssh/gitolite_admin_id_rsa.pub ' ]
%x[ echo '#!/bin/sh' | #{GitHosting.git_user_runner} 'cat > ~/.ssh/run_gitolite_admin_ssh']
- %x[ echo 'exec ssh -o BatchMode=yes -o StrictHostKeyChecking=no -i #{git_user_dir}/.ssh/gitolite_admin_id_rsa "$@"' | #{GitHosting.git_user_runner} "cat >> ~/.ssh/run_gitolite_admin_ssh" ]
+ %x[ echo 'exec ssh -o BatchMode=yes -o StrictHostKeyChecking=no -i #{git_user_dir}/.ssh/gitolite_admin_id_rsa "$@"' | #{GitHosting.git_user_runner} "cat >> ~/.ssh/run_gitolite_admin_ssh" ]
%x[ #{GitHosting.git_user_runner} 'chmod 644 ~/.ssh/gitolite_admin_id_rsa.pub' ]
%x[ #{GitHosting.git_user_runner} 'chmod 600 ~/.ssh/gitolite_admin_id_rsa']
%x[ #{GitHosting.git_user_runner} 'chmod 700 ~/.ssh/run_gitolite_admin_ssh']
@@ -151,7 +156,7 @@ def self.sudo_web_to_git_user
@@sudo_web_to_git_user_stamp = Time.new
return @@sudo_web_to_git_user_cached
end
- test = %x[#{GitHosting.git_user_runner} echo "yes"]
+ test = %x[#{GitHosting.git_user_runner} echo "yes"]
if test.match(/yes/)
@@sudo_web_to_git_user_cached = true
@@sudo_web_to_git_user_stamp = Time.new
@@ -164,9 +169,9 @@ def self.sudo_web_to_git_user
end
def self.get_full_parent_path(project, is_file_path)
- return "" if !project.parent || !repository_hierarchy
+ return "" if !project.parent || !repository_hierarchy
parent_parts = [];
- p = project
+ p = project
while p.parent
parent_id = p.parent.identifier.to_s
parent_parts.unshift(parent_id)
@@ -175,24 +180,24 @@ def self.get_full_parent_path(project, is_file_path)
return is_file_path ? File.join(parent_parts) : parent_parts.join("/")
end
- def self.redmine_name(project)
- return File.expand_path(File.join("./",get_full_parent_path(project, false),project.identifier),"/")[1..-1]
- end
+ def self.redmine_name(project)
+ return File.expand_path(File.join("./",get_full_parent_path(project, false),project.identifier),"/")[1..-1]
+ end
def self.repository_name(project)
- return File.expand_path(File.join("./",repository_redmine_subdir,get_full_parent_path(project, false),project.identifier),"/")[1..-1]
+ return File.expand_path(File.join("./",repository_redmine_subdir,get_full_parent_path(project, false),project.identifier),"/")[1..-1]
end
def self.repository_path projectId
- repo_name = projectId.is_a?(String) ? projectId : repository_name(projectId)
+ repo_name = projectId.is_a?(String) ? projectId : repository_name(projectId)
return File.join(repository_base, repo_name) + ".git"
end
- @@git_hosting_tmp_dir = nil
- @@previous_git_tmp_dir = nil
+ @@git_hosting_tmp_dir = nil
+ @@previous_git_tmp_dir = nil
def self.get_tmp_dir
- tmp_dir = (Setting.plugin_redmine_git_hosting['gitTempDataDir'] || TEMP_DATA_DIR)
- if (@@previous_git_tmp_dir != tmp_dir)
+ tmp_dir = (Setting.plugin_redmine_git_hosting['gitTempDataDir'] || TEMP_DATA_DIR)
+ if (@@previous_git_tmp_dir != tmp_dir)
@@previous_git_tmp_dir = tmp_dir
- @@git_hosting_tmp_dir = File.join(tmp_dir,git_user) + "/"
+ @@git_hosting_tmp_dir = File.join(tmp_dir,git_user) + "/"
end
if !File.directory?(@@git_hosting_tmp_dir)
%x[mkdir -p "#{@@git_hosting_tmp_dir}"]
@@ -202,56 +207,56 @@ def self.get_tmp_dir
return @@git_hosting_tmp_dir
end
- @@git_hosting_bin_dir = nil
- @@previous_git_script_dir = nil
+ @@git_hosting_bin_dir = nil
+ @@previous_git_script_dir = nil
def self.get_bin_dir
- script_dir = Setting.plugin_redmine_git_hosting['gitScriptDir'] || SCRIPT_DIR
- if @@previous_git_script_dir != script_dir
- @@previous_git_script_dir = script_dir
- @@git_bin_dir_writeable = nil
-
- # Directory for binaries includes 'SCRIPT_PARENT' at the end.
- # Further, absolute path adds additional 'git_user' component for multi-gitolite installations.
- if script_dir[0,1] == "/"
- @@git_hosting_bin_dir = File.join(script_dir,git_user,SCRIPT_PARENT) + "/"
- else
- @@git_hosting_bin_dir = Rails.root.join("vendor/plugins/redmine_git_hosting",script_dir,SCRIPT_PARENT).to_s+"/"
- end
- end
- if !File.directory?(@@git_hosting_bin_dir)
- logger.info "Creating bin directory: #{@@git_hosting_bin_dir}, Owner #{web_user}"
- %x[mkdir -p "#{@@git_hosting_bin_dir}"]
- %x[chmod 750 "#{@@git_hosting_bin_dir}"]
- %x[chown #{web_user} "#{@@git_hosting_bin_dir}"]
-
- if !File.directory?(@@git_hosting_bin_dir)
- logger.error "Cannot create bin directory: #{@@git_hosting_bin_dir}"
- end
- end
+ script_dir = Setting.plugin_redmine_git_hosting['gitScriptDir'] || SCRIPT_DIR
+ if @@previous_git_script_dir != script_dir
+ @@previous_git_script_dir = script_dir
+ @@git_bin_dir_writeable = nil
+
+ # Directory for binaries includes 'SCRIPT_PARENT' at the end.
+ # Further, absolute path adds additional 'git_user' component for multi-gitolite installations.
+ if script_dir[0,1] == "/"
+ @@git_hosting_bin_dir = File.join(script_dir,git_user,SCRIPT_PARENT) + "/"
+ else
+ @@git_hosting_bin_dir = Rails.root.join("vendor/plugins/redmine_git_hosting",script_dir,SCRIPT_PARENT).to_s+"/"
+ end
+ end
+ if !File.directory?(@@git_hosting_bin_dir)
+ logger.info "Creating bin directory: #{@@git_hosting_bin_dir}, Owner #{web_user}"
+ %x[mkdir -p "#{@@git_hosting_bin_dir}"]
+ %x[chmod 750 "#{@@git_hosting_bin_dir}"]
+ %x[chown #{web_user} "#{@@git_hosting_bin_dir}"]
+
+ if !File.directory?(@@git_hosting_bin_dir)
+ logger.error "Cannot create bin directory: #{@@git_hosting_bin_dir}"
+ end
+ end
return @@git_hosting_bin_dir
end
-
+
@@git_bin_dir_writeable = nil
- def self.bin_dir_writeable?(*option)
- @@git_bin_dir_writeable = nil if option.length > 0 && option[0] == :reset
+ def self.bin_dir_writeable?(*option)
+ @@git_bin_dir_writeable = nil if option.length > 0 && option[0] == :reset
if @@git_bin_dir_writeable == nil
- mybindir = get_bin_dir
- mytestfile = "#{mybindir}/writecheck"
- if (!File.directory?(mybindir))
- @@git_bin_dir_writeable = false
- else
- %x[touch "#{mytestfile}"]
- if (!File.exists?("#{mytestfile}"))
- @@git_bin_dir_writeable = false
- else
- %x[rm "#{mytestfile}"]
- @@git_bin_dir_writeable = true
- end
+ mybindir = get_bin_dir
+ mytestfile = "#{mybindir}/writecheck"
+ if (!File.directory?(mybindir))
+ @@git_bin_dir_writeable = false
+ else
+ %x[touch "#{mytestfile}"]
+ if (!File.exists?("#{mytestfile}"))
+ @@git_bin_dir_writeable = false
+ else
+ %x[rm "#{mytestfile}"]
+ @@git_bin_dir_writeable = true
+ end
end
- end
+ end
@@git_bin_dir_writeable
- end
-
+ end
+
def self.git_exec_path
return File.join(get_bin_dir, "run_git_as_git_user")
end
@@ -341,10 +346,10 @@ def self.update_git_exec
f.puts '{'
f.puts ' $command =~ s/\\\\/\\\\\\\\/g;'
# Previous line turns \; => \\;
- # If old sudo, turn \\; => "\\;" to protect ';' from loss as command separator during eval
- if sudo_version < sudo_version_switch
- f.puts ' $command =~ s/(\\\\\\\\;)/"$1"/g;'
- end
+ # If old sudo, turn \\; => "\\;" to protect ';' from loss as command separator during eval
+ if sudo_version < sudo_version_switch
+ f.puts ' $command =~ s/(\\\\\\\\;)/"$1"/g;'
+ end
f.puts ' $command =~ s/"/\\\\"/g;'
f.puts ' exec("sudo -u ' + git_user + ' -i eval \"$command\"");'
f.puts '}'
@@ -364,7 +369,7 @@ def self.lock(retries)
end
while retries > 0
- is_locked = @@lock_file.flock(File::LOCK_EX|File::LOCK_NB)
+ is_locked = @@lock_file.flock(File::LOCK_EX|File::LOCK_NB)
retries-=1
if (!is_locked) && retries > 0
sleep 1
@@ -379,678 +384,680 @@ def self.unlock
end
end
- def self.shell(command)
- begin
- my_command = "#{command} 2>&1"
- result = %x[#{my_command}].chomp
- code = $?.exitstatus
- rescue Exception => e
+ def self.shell(command)
+ begin
+ my_command = "#{command} 2>&1"
+ result = %x[#{my_command}].chomp
+ code = $?.exitstatus
+ rescue Exception => e
result=e.message
- code = -1
- end
- if code != 0
- logger.error "Command failed (return #{code}): #{command}"
- message = " "+result.split("\n").join("\n ")
- logger.error message
- raise GitHostingException, "Shell Error"
- end
- end
-
- # Try to get a cloned version of gitolite-admin repository.
- #
- # This code tries to recover from a variety of errors which have been observed
- # in the field, including a loss of the admin key and an empty top-level directory
- #
- # Return: false => have uncommitted changes
- # true => directory on master
- #
- # This routine must only be called after acquisition of the lock
- #
- # John Kubiatowicz, 11/15/11
- #
- # This routine will no-longer merge in changes, since this can cause weird behavior
- # when interacting with cron-jobs that clean up /tmp.
- #
- # John Kubiatowicz, 04/23/12
- #
+ code = -1
+ end
+ if code != 0
+ logger.error "Command failed (return #{code}): #{command}"
+ message = " "+result.split("\n").join("\n ")
+ logger.error message
+ raise GitHostingException, "Shell Error"
+ end
+ end
+
+ # Try to get a cloned version of gitolite-admin repository.
+ #
+ # This code tries to recover from a variety of errors which have been observed
+ # in the field, including a loss of the admin key and an empty top-level directory
+ #
+ # Return: false => have uncommitted changes
+ # true => directory on master
+ #
+ # This routine must only be called after acquisition of the lock
+ #
+ # John Kubiatowicz, 11/15/11
+ #
+ # This routine will no-longer merge in changes, since this can cause weird behavior
+ # when interacting with cron-jobs that clean up /tmp.
+ #
+ # John Kubiatowicz, 04/23/12
+ #
def self.clone_or_pull_gitolite_admin(resync_all_flag)
# clone/pull from admin repo
- repo_dir = File.join(get_tmp_dir,GitHosting::GitoliteConfig::ADMIN_REPO)
-
- # If preexisting directory exists, try to clone and merge....
- if (File.exists? "#{repo_dir}") && (File.exists? "#{repo_dir}/.git") && (File.exists? "#{repo_dir}/keydir") && (File.exists? "#{repo_dir}/conf")
- begin
- logger.info "Fetching changes from gitolite-admin repository to #{repo_dir}"
- shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' fetch]
+ repo_dir = File.join(get_tmp_dir,GitHosting::GitoliteConfig::ADMIN_REPO)
+
+ # If preexisting directory exists, try to clone and merge....
+ if (File.exists? "#{repo_dir}") && (File.exists? "#{repo_dir}/.git") && (File.exists? "#{repo_dir}/keydir") && (File.exists? "#{repo_dir}/conf")
+ begin
+ logger.info "Fetching changes from gitolite-admin repository to #{repo_dir}"
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' fetch]
shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' merge FETCH_HEAD]
- # unmerged changes=> non-empty return
- return_val = %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' status --short].empty?
+ # unmerged changes=> non-empty return
+ return_val = %x[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' status --short].empty?
- if (return_val)
- shell %[chmod 700 "#{repo_dir}" ]
- # Make sure we have our hooks setup
+ if (return_val)
+ shell %[chmod 700 "#{repo_dir}" ]
+ # Make sure we have our hooks setup
GitAdapterHooks.check_hooks_installed
- return return_val
- else
- # The attempt to merge can cause a weird failure mode when interacting with cron jobs that clean out old
- # files in /tmp. The issue is that keys in the keydir can go idle and get deleted. Then, when we merge we
- # create an admin repo minus those keys (including the admin key!). Only a RESYNC_ALL operation will
- # actually fix. Thus, we never return "have uncommitted changes", but instead fail the merge and reclone.
- #
- # 04/23/12
- # --KUBI--
- logger.error "Seems to be unmerged changes! Going to delete and reclone for safety."
- logger.error "May need to execute RESYNC_ALL to fix whatever caused pending changes." unless resync_all_flag
- end
- rescue
- logger.error "Repository fetch and merge failed -- trying to delete and reclone repository."
- end
- end
-
- begin
- logger.info "Cloning gitolite-admin repository to #{repo_dir}"
- shell %[rm -rf "#{repo_dir}"]
- shell %[env GIT_SSH=#{gitolite_ssh()} git clone ssh://#{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}/gitolite-admin.git #{repo_dir}]
- shell %[chmod 700 "#{repo_dir}" ]
- # Make sure we have our hooks setup
+ return return_val
+ else
+ # The attempt to merge can cause a weird failure mode when interacting with cron jobs that clean out old
+ # files in /tmp. The issue is that keys in the keydir can go idle and get deleted. Then, when we merge we
+ # create an admin repo minus those keys (including the admin key!). Only a RESYNC_ALL operation will
+ # actually fix. Thus, we never return "have uncommitted changes", but instead fail the merge and reclone.
+ #
+ # 04/23/12
+ # --KUBI--
+ logger.error "Seems to be unmerged changes! Going to delete and reclone for safety."
+ logger.error "May need to execute RESYNC_ALL to fix whatever caused pending changes." unless resync_all_flag
+ end
+ rescue
+ logger.error "Repository fetch and merge failed -- trying to delete and reclone repository."
+ end
+ end
+
+ begin
+ logger.info "Cloning gitolite-admin repository to #{repo_dir}"
+ shell %[rm -rf "#{repo_dir}"]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git clone ssh://#{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}/gitolite-admin.git #{repo_dir}]
+ shell %[chmod 700 "#{repo_dir}" ]
+ # Make sure we have our hooks setup
GitAdapterHooks.check_hooks_installed
- return true # On master (fresh clone)
- rescue
- begin
- # Try to repair admin access.
- fixup_gitolite_admin
-
- logger.info "Recloning gitolite-admin repository to #{repo_dir}"
- shell %[rm -rf "#{repo_dir}"]
- shell %[env GIT_SSH=#{gitolite_ssh()} git clone ssh://#{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}/gitolite-admin.git #{repo_dir}]
- shell %[chmod 700 "#{repo_dir}" ]
- # Make sure we have our hooks setup
+ return true # On master (fresh clone)
+ rescue
+ begin
+ # Try to repair admin access.
+ fixup_gitolite_admin
+
+ logger.info "Recloning gitolite-admin repository to #{repo_dir}"
+ shell %[rm -rf "#{repo_dir}"]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git clone ssh://#{git_user}@#{Setting.plugin_redmine_git_hosting['gitServer']}/gitolite-admin.git #{repo_dir}]
+ shell %[chmod 700 "#{repo_dir}" ]
+ # Make sure we have our hooks setup
GitAdapterHooks.check_hooks_installed
- return true # On master (fresh clone)
- rescue
- logger.error "Cannot clone administrative repository. Requires human intervention!!!"
- end
- end
+ return true # On master (fresh clone)
+ rescue
+ logger.error "Cannot clone administrative repository. Requires human intervention!!!"
+ end
+ end
+ end
+
+ # Recover from failure to clone repository.
+ #
+ # This routine attempts to recover from a failure to clone by reestablishing the gitolite
+ # key. It does so by directly cloning the gitolite-admin repository and editing the configuration
+ # file (gitolite.conf). If we ever try to allow gitolite services on a separate server from Redmine,
+ # we will have to turn this into a stand-alone script.
+ #
+ # Ideally, we have gitolite >= 2.0.3 so that we have 'gl-admin-push'. If not, we try to use gl-setup
+ # which has some quirks and is not as good.
+ #
+ # We try to:
+ # (1) figure out what the proper name is for the access key by first looking in the conf file, then
+ # looking for a matching keyname in the keydir.
+ # (2) delete any keys in the keydir that match our key
+ # (3) reestablish the keyname in the conf file and the key in the keydir
+ # (4) push the result back to the admin repo.
+ #
+ # Most of this activity is all done as the git user, hence the long command lines. Only parsing of the
+ # conf file is done as the redmine user (hence the need for the separate "tmp_conf_dir".
+ #
+ # Return: on success, returns "Success!". On Failure, throws a GitHostingException.
+ #
+ # Consider this the "nuclear" option....
+ def self.fixup_gitolite_admin
+ unless GitoliteConfig.has_admin_key?
+ raise GitHostingException, "Cannot repair Admin Key: Key not managed by Redmine!"
+ end
+ logger.warn "Attempting to restore repository access key:"
+ begin
+ repo_dir = File.join(Dir.tmpdir,"fixrepo",git_user,GitHosting::GitoliteConfig::ADMIN_REPO)
+ conf_file = File.join(repo_dir,"conf",gitolite_conf)
+ keydir = File.join(repo_dir, 'keydir')
+
+ tmp_conf_dir = File.join(Dir.tmpdir,"fixconf",git_user)
+ tmp_conf_file = File.join(tmp_conf_dir,gitolite_conf)
+
+ logger.warn " Cloning administrative repo directly as #{git_user} in #{repo_dir}"
+ shell %[rm -rf "#{repo_dir}"] if File.exists?(repo_dir)
+ admin_repo = "#{GitHosting.repository_base}/#{GitHosting::GitoliteConfig::ADMIN_REPO}"
+ shell %[#{GitHosting.git_user_runner} git clone #{admin_repo} #{repo_dir}]
+
+ # Load up existing conf file
+ shell %[mkdir -p #{tmp_conf_dir}]
+ shell %[#{GitHosting.git_user_runner} 'cat #{conf_file}' | cat > #{tmp_conf_file}]
+ conf = GitoliteConfig.new(tmp_conf_file)
+
+ # copy key into home directory...
+ shell %[cat #{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']} | #{GitHosting.git_user_runner} 'cat > ~/id_rsa.pub']
+
+ # Locate any keys that match new key -- save first one
+ admin_key_matches = %x[#{GitHosting.git_user_runner} 'find #{keydir} -type f -exec cmp -s ~/id_rsa.pub {} \\; -print'].chomp.split("\n").map do |name|
+ my_basename = File.basename(name,".pub")
+ shell %[#{GitHosting.git_user_runner} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{my_basename}.pub]
+ my_basename
+ end
+
+ unless admin_key_matches.empty?
+ oldkeys = admin_key_matches.join(", ")
+ logger.warn " Deleting old keys in keydir that match gitoliteIdentityPublicKeyFile: #{oldkeys}"
+ end
+
+ # Grab admin key name out of conf file (if it exists)
+ my_admin_key = conf.get_admin_key
+
+ # Try to deduce administrative key name first from conf file, then from keydir, then use default.
+ # Remove all extraneous ".pub" from end, in case something crept through.
+ new_admin_key_name = (/^(.*?)(\.pub)*$/.match(my_admin_key || admin_key_matches.first || GitHosting::GitoliteConfig::DEFAULT_ADMIN_KEY_NAME))[1]
+ if my_admin_key
+ logger.warn " Using admin key name from conf file: '#{new_admin_key_name}'"
+ else
+ logger.warn " Using '#{new_admin_key_name}' as the admin key name"
+ end
+
+ conf.set_admin_key new_admin_key_name
+ conf.save
+ shell %[cat #{tmp_conf_file} | #{GitHosting.git_user_runner} 'cat > #{conf_file}']
+ shell %[#{GitHosting.git_user_runner} 'mv ~/id_rsa.pub #{keydir}/#{new_admin_key_name}.pub']
+
+ shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add keydir/*"]
+ shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add conf/#{gitolite_conf}"]
+ shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.email '#{Setting.mail_from}'"]
+ shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.name 'Redmine'"]
+ shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' commit -m 'Updated by Redmine: Emergency repair of gitolite admin key'"]
+ begin
+ logger.warn " Pushing fixes using gl-admin-push"
+ shell %[#{GitHosting.git_user_runner} "cd #{repo_dir}; gl-admin-push -f"]
+ logger.warn "Successfully reestablished gitolite admin key!"
+ rescue
+ logger.error "gl-admin-push failed (pre 2.0.3 gitolite?). Trying 'gl-setup #{keydir}/#{new_admin_key_name}.pub'"
+ shell %[#{GitHosting.git_user_runner} "gl-setup #{keydir}/#{new_admin_key_name}.pub"]
+ logger.warn "Hopefully we have successfully reestablished gitolite admin key."
+ end
+ %x[#{GitHosting.git_user_runner} 'rm -rf "#{File.join(Dir.tmpdir,'fixrepo')}"']
+ %x[rm -rf "#{File.join(Dir.tmpdir,'fixconf')}"]
+ "Success!"
+ rescue
+ logger.error "Failed to reestablish gitolite admin key."
+ %x[#{GitHosting.git_user_runner} 'rm -f ~/id_rsa.pub']
+ %x[#{GitHosting.git_user_runner} 'rm -rf "#{File.join(Dir.tmpdir,'fixrepo')}"']
+ %x[rm -rf "#{File.join(Dir.tmpdir,'fixconf')}"]
+ raise GitHostingException, "Failure to Repair Gitolite Admin Key"
+ end
end
- # Recover from failure to clone repository.
- #
- # This routine attempts to recover from a failure to clone by reestablishing the gitolite
- # key. It does so by directly cloning the gitolite-admin repository and editing the gitolite.conf
- # file. If we ever try to allow gitolite services on a separate server from Redmine, we will
- # have to turn this into a stand-alone script.
- #
- # Ideally, we have gitolite >= 2.0.3 so that we have 'gl-admin-push'. If not, we try to use gl-setup
- # which has some quirks and is not as good.
- #
- # We try to:
- # (1) figure out what the proper name is for the access key by first looking in the conf file, then
- # looking for a matching keyname in the keydir.
- # (2) delete any keys in the keydir that match our key
- # (3) reestablish the keyname in the conf file and the key in the keydir
- # (4) push the result back to the admin repo.
- #
- # Most of this activity is all done as the git user, hence the long command lines. Only parsing of the
- # conf file is done as the redmine user (hence the need for the separate "tmp_conf_dir".
- #
- # Return: on success, returns "Success!". On Failure, throws a GitHostingException.
- #
- # Consider this the "nuclear" option....
- def self.fixup_gitolite_admin
- logger.warn "Attempting to restore repository access key:"
- begin
- repo_dir = File.join(Dir.tmpdir,"fixrepo",git_user,GitHosting::GitoliteConfig::ADMIN_REPO)
- conf_file = File.join(repo_dir,"conf","gitolite.conf")
- keydir = File.join(repo_dir, 'keydir')
-
- tmp_conf_dir = File.join(Dir.tmpdir,"fixconf",git_user)
- tmp_conf_file = File.join(tmp_conf_dir,"gitolite.conf")
-
- logger.warn " Cloning administrative repo directly as #{git_user} in #{repo_dir}"
- shell %[rm -rf "#{repo_dir}"] if File.exists?(repo_dir)
- admin_repo = "#{GitHosting.repository_base}/#{GitHosting::GitoliteConfig::ADMIN_REPO}"
- shell %[#{GitHosting.git_user_runner} git clone #{admin_repo} #{repo_dir}]
-
- # Load up existing conf file
- shell %[mkdir -p #{tmp_conf_dir}]
- shell %[#{GitHosting.git_user_runner} 'cat #{conf_file}' | cat > #{tmp_conf_file}]
- conf = GitoliteConfig.new(tmp_conf_file)
-
- # copy key into home directory...
- shell %[cat #{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']} | #{GitHosting.git_user_runner} 'cat > ~/id_rsa.pub']
-
- # Locate any keys that match new key -- save first one
- admin_key_matches = %x[#{GitHosting.git_user_runner} 'find #{keydir} -type f -exec cmp -s ~/id_rsa.pub {} \\; -print'].chomp.split("\n").map do |name|
- my_basename = File.basename(name,".pub")
- shell %[#{GitHosting.git_user_runner} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{my_basename}.pub]
- my_basename
- end
-
- unless admin_key_matches.empty?
- oldkeys = admin_key_matches.join(", ")
- logger.warn " Deleting old keys in keydir that match gitoliteIdentityPublicKeyFile: #{oldkeys}"
- end
-
- # Grab admin key name out of conf file (if it exists)
- my_admin_key = conf.get_admin_key
-
- # Try to deduce administrative key name first from conf file, then from keydir, then use default.
- # Remove all extraneous ".pub" from end, in case something crept through.
- new_admin_key_name = (/^(.*?)(\.pub)*$/.match(my_admin_key || admin_key_matches.first || GitHosting::GitoliteConfig::DEFAULT_ADMIN_KEY_NAME))[1]
- if my_admin_key
- logger.warn " Using admin key name from conf file: '#{new_admin_key_name}'"
- else
- logger.warn " Using '#{new_admin_key_name}' as the admin key name"
- end
-
- conf.set_admin_key new_admin_key_name
- conf.save
- shell %[cat #{tmp_conf_file} | #{GitHosting.git_user_runner} 'cat > #{conf_file}']
- shell %[#{GitHosting.git_user_runner} 'mv ~/id_rsa.pub #{keydir}/#{new_admin_key_name}.pub']
-
- shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add keydir/*"]
- shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add conf/gitolite.conf"]
- shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.email '#{Setting.mail_from}'"]
- shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.name 'Redmine'"]
- shell %[#{GitHosting.git_user_runner} "git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' commit -m 'Updated by Redmine: Emergency repair of gitolite admin key'"]
- begin
- logger.warn " Pushing fixes using gl-admin-push"
- shell %[#{GitHosting.git_user_runner} "cd #{repo_dir}; gl-admin-push -f"]
- logger.warn "Successfully reestablished gitolite admin key!"
- rescue
- logger.error "gl-admin-push failed (pre 2.0.3 gitolite?). Trying 'gl-setup #{keydir}/#{new_admin_key_name}.pub'"
- shell %[#{GitHosting.git_user_runner} "gl-setup #{keydir}/#{new_admin_key_name}.pub"]
- logger.warn "Hopefully we have successfully reestablished gitolite admin key."
- end
- %x[#{GitHosting.git_user_runner} 'rm -rf "#{File.join(Dir.tmpdir,'fixrepo')}"']
- %x[rm -rf "#{File.join(Dir.tmpdir,'fixconf')}"]
- "Success!"
- rescue
- logger.error "Failed to reestablish gitolite admin key."
- %x[#{GitHosting.git_user_runner} 'rm -f ~/id_rsa.pub']
- %x[#{GitHosting.git_user_runner} 'rm -rf "#{File.join(Dir.tmpdir,'fixrepo')}"']
- %x[rm -rf "#{File.join(Dir.tmpdir,'fixconf')}"]
- raise GitHostingException, "Failure to Repair Gitolite Admin Key"
- end
- end
-
- # Commit Changes to the gitolite-admin repository. This assumes that repository exists
- # (i.e. that a clone_or_fetch_gitolite_admin has already be called).
- #
- # This routine must only be called after acquisition of the lock
- #
- # John Kubiatowicz, 11/15/11
- def self.commit_gitolite_admin(*args)
+ # Commit Changes to the gitolite-admin repository. This assumes that repository exists
+ # (i.e. that a clone_or_fetch_gitolite_admin has already be called).
+ #
+ # This routine must only be called after acquisition of the lock
+ #
+ # John Kubiatowicz, 11/15/11
+ def self.commit_gitolite_admin(*args)
resyncing = args && args.first
# create tmp dir, return cleanly if, for some reason, we don't have proper permissions
- repo_dir = File.join(get_tmp_dir,GitHosting::GitoliteConfig::ADMIN_REPO)
+ repo_dir = File.join(get_tmp_dir,GitHosting::GitoliteConfig::ADMIN_REPO)
# commit / push changes to gitolite admin repo
- begin
+ begin
if (!resyncing)
- logger.info "Committing changes to gitolite-admin repository"
- message = "Updated by Redmine"
- else
- logger.info "Committing corrections to gitolite-admin repository"
- message = "Updated by Redmine: Corrections discovered during RESYNC_ALL"
- end
+ logger.info "Committing changes to gitolite-admin repository"
+ message = "Updated by Redmine"
+ else
+ logger.info "Committing corrections to gitolite-admin repository"
+ message = "Updated by Redmine: Corrections discovered during RESYNC_ALL"
+ end
shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add keydir/*]
- shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add conf/gitolite.conf]
- shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.email '#{Setting.mail_from}']
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' add conf/#{gitolite_conf}]
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.email '#{Setting.mail_from}']
shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' config user.name 'Redmine']
- shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' commit -a -m '#{message}']
+ shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' commit -a -m '#{message}']
shell %[env GIT_SSH=#{gitolite_ssh()} git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' push ]
- rescue
- logger.error "Problems committing changes to gitolite-admin repository!! Probably requires human intervention"
- raise GitHostingException, "Gitlite-admin Commit Failure"
- end
- end
-
- # Update keys for all members of projects of interest
- #
- # This code is entirely self-correcting for keys owned by users of the specified
- # projects. It should work regardless of the history of steps that got us here.
- #
- # Note that this code has changed from the original. Now, we look at all keys owned
- # by users in the specified projects to make sure that they are still live. We
- # do this with a single pass through the keydir and do not rely on the "inactive"
- # status to tell us that a key should be deleted. The reason is that weird
- # synchronization issues (not entirely understood) can cause phantom keys to get left
- # in the keydir which can really mess up gitolite.
- #
- # As of the latest release, we also recover from a variety of aborted MOVE and DELETE
- # operations. Further, we better handle movement of complete trees of projects.
- #
- # Also, when performing :resync_all, if the 'deleteGitRepositories' setting is 'true',
- # then we will remove repositories in the gitolite.conf file that are identifiable as
- # "redmine managed" (because they have one or more keys of the right form) but which
- # are nolonger live for some reason (probably because the project was deleted).
- #
- # John Kubiatowicz, 01/04/12
- #
- # Usage:
- #
- # 1) update_repositories(project) => update for specified project
- # 2) update_repositories([list of projects]) => update all projects
- # 3) update_repositories(:flag1=>true, :flag2 => false)
- #
- # Current flags:
- # :resync_all => go through all redmine-maintained gitolite repos,
- # clean up keydir, delete unused keys, clean up gitolite.conf
- # :delete => Clean up keydir, delete unused keys, remove redmine-maintaind
- # gitolite entries and repositories unassociated with live projects.
- # Unlike :resync_all, do not fix up live projects
- # :descendants => for every given project, update self and all decendants
- # :archive => Project is being archived -- remove keys from gitolite.conf,
- # and possibly keydir if not used by any other project
- #
+ rescue
+ logger.error "Problems committing changes to gitolite-admin repository!! Probably requires human intervention"
+ raise GitHostingException, "Gitlite-admin Commit Failure"
+ end
+ end
+
+ # Update keys for all members of projects of interest
+ #
+ # This code is entirely self-correcting for keys owned by users of the specified
+ # projects. It should work regardless of the history of steps that got us here.
+ #
+ # Note that this code has changed from the original. Now, we look at all keys owned
+ # by users in the specified projects to make sure that they are still live. We
+ # do this with a single pass through the keydir and do not rely on the "inactive"
+ # status to tell us that a key should be deleted. The reason is that weird
+ # synchronization issues (not entirely understood) can cause phantom keys to get left
+ # in the keydir which can really mess up gitolite.
+ #
+ # As of the latest release, we also recover from a variety of aborted MOVE and DELETE
+ # operations. Further, we better handle movement of complete trees of projects.
+ #
+ # Also, when performing :resync_all, if the 'deleteGitRepositories' setting is 'true',
+ # then we will remove repositories in the configuration file (gitolite.conf) that are
+ # identifiable as "redmine managed" (because they have one or more keys of the right form)
+ # but which are nolonger live for some reason (probably because the project was deleted).
+ #
+ # John Kubiatowicz, 01/04/12
+ #
+ # Usage:
+ #
+ # 1) update_repositories(project) => update for specified project
+ # 2) update_repositories([list of projects]) => update all projects
+ # 3) update_repositories(:flag1=>true, :flag2 => false)
+ #
+ # Current flags:
+ # :resync_all => go through all redmine-maintained gitolite repos,
+ # clean up keydir, delete unused keys, clean up gitolite.conf
+ # :delete => Clean up keydir, delete unused keys, remove redmine-maintaind
+ # gitolite entries and repositories unassociated with live projects.
+ # Unlike :resync_all, do not fix up live projects
+ # :descendants => for every given project, update self and all decendants
+ # :archive => Project is being archived -- remove keys from gitolite.conf,
+ # and possibly keydir if not used by any other project
+ #
@@recursionCheck = false
def self.update_repositories(*args)
- flags = {}
- args.each {|arg| flags.merge!(arg) if arg.is_a?(Hash)}
- if flags[:resync_all]
- logger.info "Executing RESYNC_ALL operation on gitolite configuration"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
- elsif flags[:delete]
- # When delete, want to recompute users, so need to go through all projects
- logger.info "Executing DELETE operation (resync keys, remove dead repositories)"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
- elsif flags[:archive]
- # When archive, want to recompute users, so need to go through all projects
- logger.info "Executing ARCHIVE operation (remove keys)"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
- elsif flags[:descendants]
- if Project.method_defined?(:self_and_descendants)
- projects = (args.flatten.select{|p| p.is_a?(Project)}).collect{|p| p.self_and_descendants}.flatten
- else
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
- end
- else
- projects = args.flatten.select{|p| p.is_a?(Project)}
- end
+ flags = {}
+ args.each {|arg| flags.merge!(arg) if arg.is_a?(Hash)}
+ if flags[:resync_all]
+ logger.info "Executing RESYNC_ALL operation on gitolite configuration"
+ projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ elsif flags[:delete]
+ # When delete, want to recompute users, so need to go through all projects
+ logger.info "Executing DELETE operation (resync keys, remove dead repositories)"
+ projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ elsif flags[:archive]
+ # When archive, want to recompute users, so need to go through all projects
+ logger.info "Executing ARCHIVE operation (remove keys)"
+ projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ elsif flags[:descendants]
+ if Project.method_defined?(:self_and_descendants)
+ projects = (args.flatten.select{|p| p.is_a?(Project)}).collect{|p| p.self_and_descendants}.flatten
+ else
+ projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ end
+ else
+ projects = args.flatten.select{|p| p.is_a?(Project)}
+ end
git_projects = projects.uniq.select{|p| p.repository.is_a?(Repository::Git) }
- return if git_projects.empty?
+ return if git_projects.empty?
if(defined?(@@recursionCheck))
if(@@recursionCheck)
- # This shouldn't happen any more -- log as error
- logger.error "git_hosting: update_repositories() exited with positive recursionCheck flag!"
+ # This shouldn't happen any more -- log as error
+ logger.error "git_hosting: update_repositories() exited with positive recursionCheck flag!"
return
end
- end
+ end
@@recursionCheck = true
# Grab actual lock
if !lock(lock_wait_time)
- logger.error "git_hosting: update_repositories() exited without acquiring lock!"
+ logger.error "git_hosting: update_repositories() exited without acquiring lock!"
@@recursionCheck = false
return
end
- begin
- # Make sure we have gitoite-admin cloned.
- # If have uncommitted changes, reflect in "changed" flag.
+ begin
+ # Make sure we have gitoite-admin cloned.
+ # If have uncommitted changes, reflect in "changed" flag.
changed = !clone_or_pull_gitolite_admin(flags[:resync_all])
- # Get directory for the gitolite-admin
- repo_dir = File.join(get_tmp_dir,"gitolite-admin")
-
- # logger.info "Updating keydirectory for projects: #{git_projects.join ', '}"
- keydir = File.join(repo_dir,"keydir")
- old_keyhash = {}
- Dir.foreach(keydir) do |keyfile|
- user_token = GitolitePublicKey.ident_to_user_token(keyfile)
- if !user_token.nil?
- old_keyhash[user_token] ||= []
- old_keyhash[user_token] << keyfile
- end
- end
-
- # Collect relevant users into hash with user as key and activity (in some active project) as value
- git_projects.select{|proj| proj.active?}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq.each do |cur_user|
- active_keys = cur_user.gitolite_public_keys.active || []
-
- # Remove old keys that happen to be left around
+ # Get directory for the gitolite-admin
+ repo_dir = File.join(get_tmp_dir,"gitolite-admin")
+
+ # logger.info "Updating keydirectory for projects: #{git_projects.join ', '}"
+ keydir = File.join(repo_dir,"keydir")
+ old_keyhash = {}
+ Dir.foreach(keydir) do |keyfile|
+ user_token = GitolitePublicKey.ident_to_user_token(keyfile)
+ if !user_token.nil?
+ old_keyhash[user_token] ||= []
+ old_keyhash[user_token] << keyfile
+ end
+ end
+
+ # Collect relevant users into hash with user as key and activity (in some active project) as value
+ git_projects.select{|proj| proj.active?}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq.each do |cur_user|
+ active_keys = cur_user.gitolite_public_keys.active || []
+
+ # Remove old keys that happen to be left around
cur_token = GitolitePublicKey.user_to_user_token(cur_user)
# Current filenames
- old_keynames = old_keyhash[cur_token] || []
- cur_keynames = []
-
- # Get list of active keys that SHOULD be in the keydir
- active_keys.each do |key|
- key_id = key.identifier
- key_token = GitolitePublicKey.ident_to_user_token(key_id)
- if key_token != cur_token
- # Rare case -- user login changed. Fix it.
- key_id = key.reset_identifier
-
- # Add all key filenames with this (incorrect) token into the set of names
- old_keynames += (old_keyhash[key_token] || [])
- old_keyhash.delete(key_token)
- end
- cur_keynames << "#{key_id}.pub"
- end
-
- (old_keynames - cur_keynames).each do |keyname|
- filename = File.join(keydir,"#{keyname}")
- logger.warn "Removing gitolite key: #{keyname}"
- %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
+ old_keynames = old_keyhash[cur_token] || []
+ cur_keynames = []
+
+ # Get list of active keys that SHOULD be in the keydir
+ active_keys.each do |key|
+ key_id = key.identifier
+ key_token = GitolitePublicKey.ident_to_user_token(key_id)
+ if key_token != cur_token
+ # Rare case -- user login changed. Fix it.
+ key_id = key.reset_identifier
+
+ # Add all key filenames with this (incorrect) token into the set of names
+ old_keynames += (old_keyhash[key_token] || [])
+ old_keyhash.delete(key_token)
+ end
+ cur_keynames << "#{key_id}.pub"
+ end
+
+ (old_keynames - cur_keynames).each do |keyname|
+ filename = File.join(keydir,"#{keyname}")
+ logger.warn "Removing gitolite key: #{keyname}"
+ %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
changed = true
- end
-
- # Remove inactive keys (will already be deleted by above code)
- cur_user.gitolite_public_keys.inactive.each {|key| GitolitePublicKey.destroy(key.id)}
-
- # Add missing keys to the keydir
- active_keys.each do |key|
- keyname = "#{key.identifier}.pub"
- unless old_keynames.index(keyname)
- filename = File.join(keydir,"#{keyname}")
- logger.info "Adding gitolite key: #{keyname}"
+ end
+
+ # Remove inactive keys (will already be deleted by above code)
+ cur_user.gitolite_public_keys.inactive.each {|key| GitolitePublicKey.destroy(key.id)}
+
+ # Add missing keys to the keydir
+ active_keys.each do |key|
+ keyname = "#{key.identifier}.pub"
+ unless old_keynames.index(keyname)
+ filename = File.join(keydir,"#{keyname}")
+ logger.info "Adding gitolite key: #{keyname}"
File.open(filename, 'w') {|f| f.write(key.key.gsub(/\n/,'')) }
changed = true
end
- end
-
- # In preparation for resync_all, below
- old_keyhash.delete(cur_token)
- end
+ end
+
+ # In preparation for resync_all, below
+ old_keyhash.delete(cur_token)
+ end
# Remove keys for deleted users
- orphanString=flags[:resync_all] ? "orphan " : ""
- if flags[:resync_all] || flags[:delete] || flags[:archive]
- # All keys left in old_keyhash should be for users nolonger authorized for gitolite repos
+ orphanString=flags[:resync_all] ? "orphan " : ""
+ if flags[:resync_all] || flags[:delete] || flags[:archive]
+ # All keys left in old_keyhash should be for users nolonger authorized for gitolite repos
old_keyhash.each_value do |keyset|
- keyset.each do |keyname|
- filename = File.join(keydir,"#{keyname}")
- logger.warn "Removing #{orphanString}gitolite key: #{keyname}"
- %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
+ keyset.each do |keyname|
+ filename = File.join(keydir,"#{keyname}")
+ logger.warn "Removing #{orphanString}gitolite key: #{keyname}"
+ %x[git --git-dir='#{repo_dir}/.git' --work-tree='#{repo_dir}' rm keydir/#{keyname}]
changed = true
- end
- end
+ end
+ end
end
- conf = GitoliteConfig.new(File.join(repo_dir, 'conf', 'gitolite.conf'))
-
-
- # Current redmine repositories (basename=>[repo_name1,repo_name2])
- redmine_repos = conf.redmine_repo_map
-
- # The set of actual repositories (basename=>[repo_name1,repo_name2])
- actual_repos = GitoliteConfig.gitolite_repository_map
-
- # Set of all entries in gitolite.conf file (name1=>1, name2=>2)
- total_entries = conf.all_repos
-
- # Projects for which we want to update hooks
- new_projects = []
-
- # Regenerate configuration file for projects of interest
- # Also, try to match up actual repositories with projects (being somewhat conservative
- # when a project might be out of control of redmine.
- #
- # Note that we go through all projects, including archived ones, since we may need to
- # find orphaned repos. Archived projects get left with a "ARCHIVED_REDMINE_KEY".
- git_projects.each do |proj|
- repo_name = repository_name(proj)
-
- # Common case: these are nil or lists of one element.
- my_entries = redmine_repos[proj.identifier]
- my_repos = actual_repos[proj.identifier]
-
- # We have one or more gitolite.conf entries with the right base name. Pick one with
- # closest name (will pick one with 'repo_name' if it exists.
- closest_entry = closest_path(my_entries,repo_name)
- if !closest_entry
- # CREATION case.
- if !total_entries[repo_name]
- logger.warn "Creating new entry '#{repo_name}' in gitolite.conf"
- else
- logger.warn "Utilizing existing non-redmine entry '#{repo_name}' in gitolite.conf"
- end
- elsif closest_entry != repo_name
- # MOVE case.
- logger.warn "Moving entry '#{closest_entry}' to '#{repo_name}' in gitolite.conf."
- conf.rename_repo(closest_entry,repo_name)
- else
- # NORMAL case. Have entry with correct name.
- if !my_repos.index(repo_name)
- logger.warn "Missing or misnamed repository for existing gitolite entry '#{repo_name}'."
- end
- end
- new_projects << proj unless my_repos.index(closest_entry) # Reinit hooks unless NORMAL or MOVE case
- my_entries.delete closest_entry # Claimed this one => don't need to delete later
-
- if my_repos.empty?
- # This is the normal CREATION case. No repositories with matching basenames
- # Attempt to recover repository from recycle_bin, if present. Else, create new repository.
- if !GitoliteRecycle.recover_repository_if_present repo_name
- logger.warn " Letting gitolite create empty repository: '#{repository_path(repo_name)}'"
- end
- elsif my_repos.index(closest_entry)
- # We have a repository that matches the entry we used above. Move this one to match if necessary
- # If closest_entry == repo_name, this is a NORMAL case (do nothing!)
- # If closest_entry != repo_name, this is the MOVE case.
- move_physical_repo(closest_entry,repo_name) if closest_entry != repo_name
- elsif my_repos.index(repo_name)
- # Existing repo with right name. We know that there wasn't a corresponding gitolite.conf entry....
- logger.warn " Using existing repository: '#{repository_path(repo_name)}'"
- else
- # Of the repos in my_repo with a matching base name, only steal away those not already controlled
- # by gitolite.conf. The one reasonable case here is if (for some reason) a move was properly
- # executed in gitolite.conf but the repo didn't get moved.
- closest_repo = closest_path((my_repos - total_entries.keys),repo_name)
- if !closest_repo
- logger.error "One or more repositories with matching base name '#{proj.identifier}' exist, but already have entries in gitolite.conf"
- logger.error "They are: #{my_repos.join(', ')}"
- # Attempt to recover repository from recycle_bin, if present. Else, create new repository.
- if !GitoliteRecycle.recover_repository_if_present repo_name
- logger.warn " Letting gitolite create empty repository: '#{repository_path(repo_name)}'"
- end
- else
- logger.warn " Claiming orphan repository '#{repository_path(closest_repo)}' in gitolite repository."
- move_physical_repo(closest_repo,repo_name)
- end
- end
-
- # Update repository url and root_url if necessary
+ conf = GitoliteConfig.new(File.join(repo_dir, 'conf', gitolite_conf))
+
+ # Current redmine repositories (basename=>[repo_name1,repo_name2])
+ redmine_repos = conf.redmine_repo_map
+
+ # The set of actual repositories (basename=>[repo_name1,repo_name2])
+ actual_repos = GitoliteConfig.gitolite_repository_map
+
+ # Set of all entries in gitolite.conf file (name1=>1, name2=>2)
+ total_entries = conf.all_repos
+
+ # Projects for which we want to update hooks
+ new_projects = []
+
+ # Regenerate configuration file for projects of interest
+ # Also, try to match up actual repositories with projects (being somewhat conservative
+ # when a project might be out of control of redmine.
+ #
+ # Note that we go through all projects, including archived ones, since we may need to
+ # find orphaned repos. Archived projects get left with a "ARCHIVED_REDMINE_KEY".
+ git_projects.each do |proj|
+ repo_name = repository_name(proj)
+
+ # Common case: these are nil or lists of one element.
+ my_entries = redmine_repos[proj.identifier]
+ my_repos = actual_repos[proj.identifier]
+
+ # We have one or more gitolite.conf entries with the right base name. Pick one with
+ # closest name (will pick one with 'repo_name' if it exists.
+ closest_entry = closest_path(my_entries,repo_name)
+ if !closest_entry
+ # CREATION case.
+ if !total_entries[repo_name]
+ logger.warn "Creating new entry '#{repo_name}' in #{gitolite_conf}"
+ else
+ logger.warn "Utilizing existing non-redmine entry '#{repo_name}' in #{gitolite_conf}"
+ end
+ elsif closest_entry != repo_name
+ # MOVE case.
+ logger.warn "Moving entry '#{closest_entry}' to '#{repo_name}' in #{gitolite_conf}."
+ conf.rename_repo(closest_entry,repo_name)
+ else
+ # NORMAL case. Have entry with correct name.
+ if !my_repos.index(repo_name)
+ logger.warn "Missing or misnamed repository for existing gitolite entry '#{repo_name}'."
+ end
+ end
+ new_projects << proj unless my_repos.index(closest_entry) # Reinit hooks unless NORMAL or MOVE case
+ my_entries.delete closest_entry # Claimed this one => don't need to delete later
+
+ if my_repos.empty?
+ # This is the normal CREATION case. No repositories with matching basenames
+ # Attempt to recover repository from recycle_bin, if present. Else, create new repository.
+ if !GitoliteRecycle.recover_repository_if_present repo_name
+ logger.warn " Letting gitolite create empty repository: '#{repository_path(repo_name)}'"
+ end
+ elsif my_repos.index(closest_entry)
+ # We have a repository that matches the entry we used above. Move this one to match if necessary
+ # If closest_entry == repo_name, this is a NORMAL case (do nothing!)
+ # If closest_entry != repo_name, this is the MOVE case.
+ move_physical_repo(closest_entry,repo_name) if closest_entry != repo_name
+ elsif my_repos.index(repo_name)
+ # Existing repo with right name. We know that there wasn't a corresponding gitolite.conf entry....
+ logger.warn " Using existing repository: '#{repository_path(repo_name)}'"
+ else
+ # Of the repos in my_repo with a matching base name, only steal away those not already controlled
+ # by gitolite.conf. The one reasonable case here is if (for some reason) a move was properly
+ # executed in gitolite.conf but the repo didn't get moved.
+ closest_repo = closest_path((my_repos - total_entries.keys),repo_name)
+ if !closest_repo
+ logger.error "One or more repositories with matching base name '#{proj.identifier}' exist, but already have entries in gitolite.conf"
+ logger.error "They are: #{my_repos.join(', ')}"
+ # Attempt to recover repository from recycle_bin, if present. Else, create new repository.
+ if !GitoliteRecycle.recover_repository_if_present repo_name
+ logger.warn " Letting gitolite create empty repository: '#{repository_path(repo_name)}'"
+ end
+ else
+ logger.warn " Claiming orphan repository '#{repository_path(closest_repo)}' in gitolite repository."
+ move_physical_repo(closest_repo,repo_name)
+ end
+ end
+
+ # Update repository url and root_url if necessary
myrepo = proj.repository
- target_url = repository_path(proj)
- if myrepo.url != target_url || myrepo.root_url != target_url
- # logger.warn " Updating internal access path to '#{target_url}'."
- myrepo.url = myrepo.root_url = target_url
- proj.repository.save
- end
-
- # If this is an active (non-archived) project, then update gitolite entry. Add GIT_DAEMON_KEY.
- if proj.active?
+ target_url = repository_path(proj)
+ if myrepo.url != target_url || myrepo.root_url != target_url
+ # logger.warn " Updating internal access path to '#{target_url}'."
+ myrepo.url = myrepo.root_url = target_url
+ proj.repository.save
+ end
+
+ # If this is an active (non-archived) project, then update gitolite entry. Add GIT_DAEMON_KEY.
+ if proj.active?
# fetch users
users = proj.member_principals.map(&:user).compact.uniq
write_users = users.select{ |user| user.allowed_to?( :commit_access, proj ) }
read_users = users.select{ |user| user.allowed_to?( :view_changesets, proj ) && !user.allowed_to?( :commit_access, proj ) }
-
+
# update users
read_user_keys = []
write_user_keys = []
read_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
read_user_keys.push key.identifier
- end
+ end
write_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
write_user_keys.push key.identifier
end
-
+
#git daemon support
- if (proj.repository.extra.git_daemon == 1 || proj.repository.extra.git_daemon == nil ) && proj.is_public
+ if (proj.repository.extra.git_daemon == 1 || proj.repository.extra.git_daemon == nil ) && proj.is_public
read_user_keys.push GitoliteConfig::GIT_DAEMON_KEY
end
-
+
# Remove previous redmine keys, then add new keys
- # By doing things this way, we leave non-redmine keys alone
- # Note -- delete_redmine_keys() will also remove the GIT_DAEMON_KEY for repos with redmine keys
- # (to be put back as above, when appropriate).
- conf.delete_redmine_keys repo_name
+ # By doing things this way, we leave non-redmine keys alone
+ # Note -- delete_redmine_keys() will also remove the GIT_DAEMON_KEY for repos with redmine keys
+ # (to be put back as above, when appropriate).
+ conf.delete_redmine_keys repo_name
conf.add_read_user repo_name, read_user_keys
conf.add_write_user repo_name, write_user_keys
- # If no redmine keys, mark with dummy key
- if (read_user_keys+write_user_keys).empty?
- conf.mark_with_dummy_key repo_name
- end
- else
- # Must be an archived project! Clear out redmine keys. Mark as an archived project.
- conf.delete_redmine_keys repo_name
- conf.mark_archived repo_name
- end
+ # If no redmine keys, mark with dummy key
+ if (read_user_keys+write_user_keys).empty?
+ conf.mark_with_dummy_key repo_name
+ end
+ else
+ # Must be an archived project! Clear out redmine keys. Mark as an archived project.
+ conf.delete_redmine_keys repo_name
+ conf.mark_archived repo_name
+ end
end
-
+
# If resyncing or deleting, check for orphan repositories which still have redmine keys...
- # At this point, redmine_repos contains all repositories in original gitolite.conf
- # which have redmine keys but are not part of an active redmine project.
- # There are three possibilities:
- #
- # 1) They have both redmine keys and other (non-redmine) keys => remove redmine keys
- # 2) They have only redmine keys, but repository delete is not enabled
- # => remove redmine keys (will leave redmine_dummy_key when we save)
- # 3) They have only redmine keys and repository delete is enabled => delete repository
+ # At this point, redmine_repos contains all repositories in original gitolite.conf
+ # which have redmine keys but are not part of an active redmine project.
+ # There are three possibilities:
+ #
+ # 1) They have both redmine keys and other (non-redmine) keys => remove redmine keys
+ # 2) They have only redmine keys, but repository delete is not enabled
+ # => remove redmine keys (will leave redmine_dummy_key when we save)
+ # 3) They have only redmine keys and repository delete is enabled => delete repository
if flags[:resync_all] || flags[:delete]
- if flags[:delete]
- # Get rid of all live repos from redmine_repos
- proj_ids = git_projects.map{|proj| proj.identifier}
- redmine_repos.delete_if{|basename,values| proj_ids.index(basename)}
- end
- redmine_repos.values.flatten.each do |repo_name|
- # First, delete redmine keys for this repository
- conf.delete_redmine_keys repo_name
- if (Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true")
- if conf.repo_has_no_keys? repo_name
- logger.warn "Deleting #{orphanString}entry '#{repo_name}' from gitolite.conf"
- conf.delete_repo repo_name
- GitoliteRecycle.move_repository_to_recycle repo_name
- else
- logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in gitolite.conf"
- if git_repository_exists? repo_name
- logger.info " Not removing #{repo_name}.git from gitolite repository, because non-redmine keys remain."
- end
- end
- else
- logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in gitolite.conf"
- end
- end
- # Delete expired files from recycle bin.
- GitoliteRecycle.delete_expired_files
- end
+ if flags[:delete]
+ # Get rid of all live repos from redmine_repos
+ proj_ids = git_projects.map{|proj| proj.identifier}
+ redmine_repos.delete_if{|basename,values| proj_ids.index(basename)}
+ end
+ redmine_repos.values.flatten.each do |repo_name|
+ # First, delete redmine keys for this repository
+ conf.delete_redmine_keys repo_name
+ if (Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true")
+ if conf.repo_has_no_keys? repo_name
+ logger.warn "Deleting #{orphanString}entry '#{repo_name}' from #{gitolite_conf}"
+ conf.delete_repo repo_name
+ GitoliteRecycle.move_repository_to_recycle repo_name
+ else
+ logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in #{gitolite_conf}"
+ if git_repository_exists? repo_name
+ logger.info " Not removing #{repo_name}.git from gitolite repository, because non-redmine keys remain."
+ end
+ end
+ else
+ logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in #{gitolite_conf}"
+ end
+ end
+ # Delete expired files from recycle bin.
+ GitoliteRecycle.delete_expired_files
+ end
if conf.changed?
conf.save
changed = true
end
-
+
if changed
- # Have changes. Commit / push changes to gitolite admin repo
+ # Have changes. Commit / push changes to gitolite admin repo
commit_gitolite_admin flags[:resync_all]
end
-
+
# Set post receive hooks for new projects (or check all repositories on :resync_all).
# We need to do this AFTER push, otherwise necessary repos may not be created yet.
- GitAdapterHooks.setup_hooks_params((flags[:resync_all]||flags[:resync_hooks]) ? git_projects : new_projects)
-
- rescue GitHostingException
- logger.error "git_hosting: update_repositories() failed"
- rescue => e
- logger.error e.message
- logger.error e.backtrace[0..4].join("\n")
- logger.error "git_hosting: update_repositories() failed"
- end
+ GitAdapterHooks.setup_hooks_params((flags[:resync_all]||flags[:resync_hooks]) ? git_projects : new_projects)
+
+ rescue GitHostingException
+ logger.error "git_hosting: update_repositories() failed"
+ rescue => e
+ logger.error e.message
+ logger.error e.backtrace[0..4].join("\n")
+ logger.error "git_hosting: update_repositories() failed"
+ end
unlock()
@@recursionCheck = false
end
- # This routine moves a repository in the gitolite repository structure.
- def self.move_physical_repo(old_name,new_name)
- begin
- logger.warn " Moving gitolite repository from '#{old_name}.git' to '#{new_name}.git'"
-
- if git_repository_exists? new_name
- logger.error "Repository already exists at #{new_name}.git! Moving to recycle bin to avoid overwrite."
- GitoliteRecycle.move_repository_to_recycle new_name
- end
-
- # physicaly move the repo BEFORE committing/pushing conf changes to gitolite admin repo
- prefix = new_name[/.*(?=\/)/] # Complete directory path (if exists) without trailing '/'
- if prefix
- # Has subdirectory. Must construct destination directory
- repo_prefix = File.join(repository_base, prefix)
- GitHosting.shell %[#{git_user_runner} mkdir -p '#{repo_prefix}']
- end
- old_path = repository_path(old_name)
- new_path = repository_path(new_name)
- shell %[#{git_user_runner} 'mv "#{old_path}" "#{new_path}"']
-
- # If any empty directories left behind, try to delete them. Ignore failure.
- old_prefix = old_name[/.*?(?=\/)/] # Top-level old directory without trailing '/'
- if old_prefix
- repo_subpath = File.join(repository_base, old_prefix)
- result = %x[#{GitHosting.git_user_runner} find '#{repo_subpath}' -type d ! -regex '.*\.git/.*' -empty -depth -delete -print].chomp.split("\n")
- result.each { |dir| logger.warn " Removing empty repository subdirectory: #{dir}"}
- end
- rescue GitHostingException
- logger.error "git_hosting: move_physical_repo(#{old_name},#{new_name}) failed"
- rescue => e
- logger.error e.message
- logger.error e.backtrace[0..4].join("\n")
- logger.error "git_hosting: move_physical_repo(#{old_name},#{new_name}) failed"
- end
- end
-
- # Check to see if the given repository exists or not...
- # Need to work a bit, since we have to su to figure it out...
- def self.git_repository_exists?(repo_name)
- file_exists?(repository_path(repo_name))
- end
-
- # Check to see if the given file exists off the git user's homedirectory.
- # Need to work a bit, since we have to su to figure it out...
- def self.file_exists?(filename)
- (%x[#{GitHosting.git_user_runner} test -r '#{filename}' && echo 'yes' || echo 'no']).match(/yes/) ? true : false
- end
-
- # Takes a list of path names and a path name and attempts to find the item in the list that matches
- # in the most components. Assume at least one element in list
- def self.closest_path(path_list,target_path)
- path_list.sort do |x, y|
- # sort by length of match, then dictionary
- lmatchx = longest_match_length(x,target_path)
- lmatchy = longest_match_length(y,target_path)
- if (lmatchx < lmatchy)
- -1
- elsif (lmatchy < lmatchx)
- 1
- else
- # in case of equivalence, want earliest alphabetical
- y <=> x
- end
- end.last
- end
-
- # return the number of characters that match between str1 and str2
- def self.longest_match_length(str1,str2)
- for result in 0..str1.length-1
- # note that str2[result]=nil if beyond end of string, which works fine!
- if str1[result] != str2[result]
- return result
- end
- end
- str1.length
- end
-
- def self.clear_cache_for_project(project)
+ # This routine moves a repository in the gitolite repository structure.
+ def self.move_physical_repo(old_name,new_name)
+ begin
+ logger.warn " Moving gitolite repository from '#{old_name}.git' to '#{new_name}.git'"
+
+ if git_repository_exists? new_name
+ logger.error "Repository already exists at #{new_name}.git! Moving to recycle bin to avoid overwrite."
+ GitoliteRecycle.move_repository_to_recycle new_name
+ end
+
+ # physicaly move the repo BEFORE committing/pushing conf changes to gitolite admin repo
+ prefix = new_name[/.*(?=\/)/] # Complete directory path (if exists) without trailing '/'
+ if prefix
+ # Has subdirectory. Must construct destination directory
+ repo_prefix = File.join(repository_base, prefix)
+ GitHosting.shell %[#{git_user_runner} mkdir -p '#{repo_prefix}']
+ end
+ old_path = repository_path(old_name)
+ new_path = repository_path(new_name)
+ shell %[#{git_user_runner} 'mv "#{old_path}" "#{new_path}"']
+
+ # If any empty directories left behind, try to delete them. Ignore failure.
+ old_prefix = old_name[/.*?(?=\/)/] # Top-level old directory without trailing '/'
+ if old_prefix
+ repo_subpath = File.join(repository_base, old_prefix)
+ result = %x[#{GitHosting.git_user_runner} find '#{repo_subpath}' -type d ! -regex '.*\.git/.*' -empty -depth -delete -print].chomp.split("\n")
+ result.each { |dir| logger.warn " Removing empty repository subdirectory: #{dir}"}
+ end
+ rescue GitHostingException
+ logger.error "git_hosting: move_physical_repo(#{old_name},#{new_name}) failed"
+ rescue => e
+ logger.error e.message
+ logger.error e.backtrace[0..4].join("\n")
+ logger.error "git_hosting: move_physical_repo(#{old_name},#{new_name}) failed"
+ end
+ end
+
+ # Check to see if the given repository exists or not...
+ # Need to work a bit, since we have to su to figure it out...
+ def self.git_repository_exists?(repo_name)
+ file_exists?(repository_path(repo_name))
+ end
+
+ # Check to see if the given file exists off the git user's homedirectory.
+ # Need to work a bit, since we have to su to figure it out...
+ def self.file_exists?(filename)
+ (%x[#{GitHosting.git_user_runner} test -r '#{filename}' && echo 'yes' || echo 'no']).match(/yes/) ? true : false
+ end
+
+ # Takes a list of path names and a path name and attempts to find the item in the list that matches
+ # in the most components. Assume at least one element in list
+ def self.closest_path(path_list,target_path)
+ path_list.sort do |x, y|
+ # sort by length of match, then dictionary
+ lmatchx = longest_match_length(x,target_path)
+ lmatchy = longest_match_length(y,target_path)
+ if (lmatchx < lmatchy)
+ -1
+ elsif (lmatchy < lmatchx)
+ 1
+ else
+ # in case of equivalence, want earliest alphabetical
+ y <=> x
+ end
+ end.last
+ end
+
+ # return the number of characters that match between str1 and str2
+ def self.longest_match_length(str1,str2)
+ for result in 0..str1.length-1
+ # note that str2[result]=nil if beyond end of string, which works fine!
+ if str1[result] != str2[result]
+ return result
+ end
+ end
+ str1.length
+ end
+
+ def self.clear_cache_for_project(project)
if project.is_a?(Project)
project = project.identifier
end
@@ -1084,23 +1091,23 @@ def self.update_global_hook_params
end
end
- class MyLogger
- # Prefix to error messages
- ERROR_PREFIX = "***> "
-
- # For errors, add our prefix to all messages
- def error(*progname, &block)
- if block_given?
- Rails.logger.error(*progname) { "#{ERROR_PREFIX}#{yield}".gsub(/\n/,"\n#{ERROR_PREFIX}") }
- else
- Rails.logger.error "#{ERROR_PREFIX}#{progname}".gsub(/\n/,"\n#{ERROR_PREFIX}")
- end
- end
-
- # Handle everything else with base object
- def method_missing(m, *args, &block)
- Rails.logger.send m, *args, &block
- end
- end
+ class MyLogger
+ # Prefix to error messages
+ ERROR_PREFIX = "***> "
+
+ # For errors, add our prefix to all messages
+ def error(*progname, &block)
+ if block_given?
+ Rails.logger.error(*progname) { "#{ERROR_PREFIX}#{yield}".gsub(/\n/,"\n#{ERROR_PREFIX}") }
+ else
+ Rails.logger.error "#{ERROR_PREFIX}#{progname}".gsub(/\n/,"\n#{ERROR_PREFIX}")
+ end
+ end
+
+ # Handle everything else with base object
+ def method_missing(m, *args, &block)
+ Rails.logger.send m, *args, &block
+ end
+ end
end
diff --git a/lib/gitolite_conf.rb b/lib/gitolite_conf.rb
index 1dc44d61d..5edd7ba18 100755
--- a/lib/gitolite_conf.rb
+++ b/lib/gitolite_conf.rb
@@ -1,25 +1,43 @@
module GitHosting
class GitoliteConfig
- DUMMY_REDMINE_KEY="redmine_dummy_key"
+ DUMMY_REDMINE_KEY="redmine_dummy_key"
ARCHIVED_REDMINE_KEY="redmine_archived_project"
- GIT_DAEMON_KEY="daemon"
- ADMIN_REPO = "gitolite-admin"
- DEFAULT_ADMIN_KEY_NAME = "id_rsa"
+ GIT_DAEMON_KEY="daemon"
+ ADMIN_REPO = "gitolite-admin"
+ PRIMARY_CONF_FILE = "gitolite.conf"
+ DEFAULT_ADMIN_KEY_NAME = "id_rsa"
+
+ def self.gitolite_conf
+ Setting.plugin_redmine_git_hosting['gitConfigFile'] || PRIMARY_CONF_FILE
+ end
+
+ def self.default_conf?
+ gitolite_conf == PRIMARY_CONF_FILE
+ end
+
+ # Need admin key if conf file is default file or if there was an admin key.
+ def self.has_admin_key?
+ Setting.plugin_redmine_git_hosting['gitConfigHasAdminKey'] != 'false' || default_conf?
+ end
def initialize file_path
@path = file_path
load
end
- def logger
+ def logger
return GitHosting.logger
end
def save
- File.open(@path, "w") do |f|
- f.puts content
+ begin
+ File.open(@path, "w") do |f|
+ f.puts content
+ end
+ @original_content = content
+ rescue => e
+ GitHosting.logger.error "Error trying to write config file: #{e.to_s}"
end
- @original_content = content
end
def add_write_user repo_name, users
@@ -39,21 +57,21 @@ def set_read_user repo_name, users
end
def mark_with_dummy_key repo_name
- add_read_user repo_name, [DUMMY_REDMINE_KEY]
- end
+ add_read_user repo_name, [DUMMY_REDMINE_KEY]
+ end
def mark_archived repo_name
- add_read_user repo_name, [ARCHIVED_REDMINE_KEY]
- end
+ add_read_user repo_name, [ARCHIVED_REDMINE_KEY]
+ end
- # Grab admin key (assuming it exists)
- def get_admin_key
- return (repository(ADMIN_REPO).get "RW+").first
- end
+ # Grab admin key (assuming it exists)
+ def get_admin_key
+ return (repository(ADMIN_REPO).get "RW+").first
+ end
- def set_admin_key new_name
- repository(ADMIN_REPO).set "RW+", new_name
- end
+ def set_admin_key new_name
+ repository(ADMIN_REPO).set "RW+", new_name
+ end
def delete_repo repo_name
@repositories.delete(repo_name)
@@ -66,35 +84,35 @@ def rename_repo old_name, new_name
end
end
- # A repository is a "redmine" repository if it has redmine keys or no keys
- # (latter case is checked, since we end up adding the DUMMY_REDMINE_KEY to
- # a repository with no keys anyway....
- def is_redmine_repo? repo_name
- repository(repo_name).rights.detect {|perm, users| users.detect {|key| is_redmine_key? key}} || (repo_has_no_keys? repo_name)
- end
+ # A repository is a "redmine" repository if it has redmine keys or no keys
+ # (latter case is checked, since we end up adding the DUMMY_REDMINE_KEY to
+ # a repository with no keys anyway....
+ def is_redmine_repo? repo_name
+ repository(repo_name).rights.detect {|perm, users| users.detect {|key| is_redmine_key? key}} || (repo_has_no_keys? repo_name)
+ end
- # Delete all of the redmine keys from a repository
- # In addition, if there are any redmine keys, delete the GIT_DAEMON_KEY as well,
- # since we assume this under control of redmine server.
- def delete_redmine_keys repo_name
+ # Delete all of the redmine keys from a repository
+ # In addition, if there are any redmine keys, delete the GIT_DAEMON_KEY as well,
+ # since we assume this under control of redmine server.
+ def delete_redmine_keys repo_name
return unless @repositories[repo_name] && is_redmine_repo?(repo_name)
-
- repository(repo_name).rights.each do |perm, users|
- users.delete_if {|key| ((is_redmine_key? key) || (is_daemon_key? key))}
- end
- end
-
+
+ repository(repo_name).rights.each do |perm, users|
+ users.delete_if {|key| ((is_redmine_key? key) || (is_daemon_key? key))}
+ end
+ end
+
def repo_has_no_keys? repo_name
- !repository(repo_name).rights.detect {|perm, users| users.length > 0}
- end
+ !repository(repo_name).rights.detect {|perm, users| users.length > 0}
+ end
- def is_redmine_key? keyname
- (GitolitePublicKey::ident_to_user_token(keyname) || keyname == DUMMY_REDMINE_KEY || keyname == ARCHIVED_REDMINE_KEY) ? true : false
- end
+ def is_redmine_key? keyname
+ (GitolitePublicKey::ident_to_user_token(keyname) || keyname == DUMMY_REDMINE_KEY || keyname == ARCHIVED_REDMINE_KEY) ? true : false
+ end
- def is_daemon_key? keyname
- (keyname == GIT_DAEMON_KEY)
- end
+ def is_daemon_key? keyname
+ (keyname == GIT_DAEMON_KEY)
+ end
def changed?
@original_content != content
@@ -108,50 +126,57 @@ def all_repos
return repos
end
- # For redmine repos, return map of basename (unique for redmine repos) => repo path
- def redmine_repo_map
- redmine_repos=Hash.new{|hash, key| hash[key] = []} # default -- empty list
- @repositories.each do |repo, rights|
- if is_redmine_repo? repo
- # Represents bug in conf file, but must allow more than one
- mybase = File.basename(repo)
- redmine_repos[mybase] << repo
- end
- end
- return redmine_repos
- end
-
- def self.gitolite_repository_map
- gitolite_repos=Hash.new{|hash, key| hash[key] = []} # default -- empty list
- myfiles = %x[#{GitHosting.git_user_runner} 'find #{GitHosting.repository_base} -type d -name "*.git" -prune -print'].chomp.split("\n")
- filesplit = /(\.\/)*#{GitHosting.repository_base}(.*?)([^\/]+)\.git/
- myfiles.each do |nextfile|
- if filesplit =~ nextfile
- gitolite_repos[$3] << "#{$2}#{$3}"
- end
- end
- gitolite_repos
- end
+ # For redmine repos, return map of basename (unique for redmine repos) => repo path
+ def redmine_repo_map
+ redmine_repos=Hash.new{|hash, key| hash[key] = []} # default -- empty list
+ @repositories.each do |repo, rights|
+ if is_redmine_repo? repo
+ # Represents bug in conf file, but must allow more than one
+ mybase = File.basename(repo)
+ redmine_repos[mybase] << repo
+ end
+ end
+ return redmine_repos
+ end
+
+ def self.gitolite_repository_map
+ gitolite_repos=Hash.new{|hash, key| hash[key] = []} # default -- empty list
+ myfiles = %x[#{GitHosting.git_user_runner} 'find #{GitHosting.repository_base} -type d -name "*.git" -prune -print'].chomp.split("\n")
+ filesplit = /(\.\/)*#{GitHosting.repository_base}(.*?)([^\/]+)\.git/
+ myfiles.each do |nextfile|
+ if filesplit =~ nextfile
+ gitolite_repos[$3] << "#{$2}#{$3}"
+ end
+ end
+ gitolite_repos
+ end
private
def load
@original_content = []
@repositories = ActiveSupport::OrderedHash.new
- cur_repo_name = nil
- File.open(@path).each_line do |line|
- @original_content << line
- tokens = line.strip.split
- if tokens.first == 'repo'
- cur_repo_name = tokens.last
- @repositories[cur_repo_name] = GitoliteAccessRights.new
- next
- end
- cur_repo_right = @repositories[cur_repo_name]
- if cur_repo_right and tokens[1] == '='
- cur_repo_right.add tokens.first, tokens[2..-1]
+ begin
+ cur_repo_name = nil
+ File.open(@path).each_line do |line|
+ @original_content << line
+ tokens = line.strip.split
+ if tokens.first == 'repo'
+ cur_repo_name = tokens.last
+ @repositories[cur_repo_name] = GitoliteAccessRights.new
+ next
+ end
+ cur_repo_right = @repositories[cur_repo_name]
+ if cur_repo_right and tokens[1] == '='
+ cur_repo_right.add tokens.first, tokens[2..-1]
+ end
end
+ # If no admin key in repo, delete any residual
+ @repositories.delete(ADMIN_REPO) unless self.class.has_admin_key?
+
+ @original_content = @original_content.join
+ rescue => e
+ GitHosting.logger.error "Error trying to read config file: #{e.to_s}"
end
- @original_content = @original_content.join
end
def repository repo_name
@@ -161,21 +186,23 @@ def repository repo_name
def content
content = []
- # Make sure that admin repo is first
- content << "repo\t#{ADMIN_REPO}"
- admin_key = (@repositories[ADMIN_REPO].get "RW+").first
- unless admin_key.nil?
- # Put in a single admi nkey
- content << "\tRW+\t=\t#{admin_key}"
- else
- # If no repo, put in a default -- will try to fix later if problem.
- content << "\tRW+\t=\t#{DEFAULT_ADMIN_KEY_NAME}"
- end
- content << ""
+ if self.class.has_admin_key?
+ # Make sure that admin repo is first
+ content << "repo\t#{ADMIN_REPO}"
+ admin_key = @repositories[ADMIN_REPO] && (@repositories[ADMIN_REPO].get "RW+").first
+ unless admin_key.nil?
+ # Put in a single admin key
+ content << "\tRW+\t=\t#{admin_key}"
+ else
+ # If no repo, put in a default -- will try to fix later if problem.
+ content << "\tRW+\t=\t#{DEFAULT_ADMIN_KEY_NAME}"
+ end
+ content << ""
+ end
@repositories.each do |repo, rights|
- unless repo == ADMIN_REPO
- content << "repo\t#{repo}"
+ unless repo == ADMIN_REPO
+ content << "repo\t#{repo}"
has_users=false
rights.each do |perm, users|
if users.length > 0
@@ -185,10 +212,10 @@ def content
end
if !has_users
# If no users, use dummy key to make sure repo created
- content << "\tR\t=\t#{DUMMY_REDMINE_KEY}"
+ content << "\tR\t=\t#{DUMMY_REDMINE_KEY}"
end
content << ""
- end
+ end
end
return content.join("\n")
end
@@ -215,13 +242,12 @@ def set perm, users
add perm, users
end
- def get perm
- @rights[perm.to_sym] || []
- end
+ def get perm
+ @rights[perm.to_sym] || []
+ end
def each
@rights.each {|k,v| yield k, v}
end
end
end
-
From 946aafced67b6d475daec985e887ca260d9d7aa1 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Fri, 27 Jul 2012 16:26:01 -0700
Subject: [PATCH 057/107] Remove dispatcher from init file, since this nolonger
exists in Rails 3.0.
Reorganized patches to put all of the patch-specific includes
and patching operations into the individual patch files. This leaves
only a need for explicitly loading each of the patch files, which
is now done with a require_dependency inside a loop...
---
init.rb | 65 +--------
lib/git_hosting/patches/git_adapter_patch.rb | 31 ++--
.../patches/git_repository_patch.rb | 25 ++--
.../patches/groups_controller_patch.rb | 8 ++
.../patches/members_controller_patch.rb | 62 ++++----
.../patches/my_controller_patch.rb | 49 ++++---
lib/git_hosting/patches/project_patch.rb | 20 ++-
.../patches/projects_controller_patch.rb | 120 ++++++++--------
.../patches/repositories_controller_patch.rb | 22 ++-
.../patches/repository_cia_filters.rb | 1 +
lib/git_hosting/patches/repository_patch.rb | 72 +++++-----
.../patches/roles_controller_patch.rb | 46 +++---
.../patches/sys_controller_patch.rb | 30 ++--
lib/git_hosting/patches/user_patch.rb | 21 +++
.../patches/users_controller_patch.rb | 136 +++++++++---------
15 files changed, 385 insertions(+), 323 deletions(-)
create mode 100644 lib/git_hosting/patches/user_patch.rb
diff --git a/init.rb b/init.rb
index 4084f9e52..88990ef31 100755
--- a/init.rb
+++ b/init.rb
@@ -17,7 +17,7 @@
'gitServer' => 'localhost',
'gitUser' => 'git',
'gitConfigPath' => 'gitolite.conf', # Redmine gitolite config file
- 'gitConfigHasAdminKey' => 'true', # Conf file should have admin key
+ 'gitConfigHasAdminKey' => 'true', # Conf file should have admin key
'gitRepositoryBasePath' => 'repositories/',
'gitRedmineSubdir' => '',
'gitRepositoryHierarchy' => 'true',
@@ -51,67 +51,10 @@
permission :edit_repository_post_receive_urls, :repository_post_receive_urls => :edit
end
end
-require "dispatcher"
-Dispatcher.to_prepare :redmine_git_patches do
- require_dependency 'principal'
- require_dependency 'user'
- require_dependency 'git_hosting'
-
- require_dependency 'projects_controller'
- require 'git_hosting/patches/projects_controller_patch'
- ProjectsController.send(:include, GitHosting::Patches::ProjectsControllerPatch)
-
- require_dependency 'project'
- require 'git_hosting/patches/project_patch'
- Project.send(:include, GitHosting::Patches::ProjectPatch)
-
- require_dependency 'repositories_controller'
- require 'git_hosting/patches/repositories_controller_patch'
- RepositoriesController.send(:include, GitHosting::Patches::RepositoriesControllerPatch)
-
- require_dependency 'repository'
- require 'git_hosting/patches/repository_patch'
- Repository.send(:include, GitHosting::Patches::RepositoryPatch)
-
- require 'stringio'
- require_dependency 'redmine/scm/adapters/git_adapter'
- require 'git_hosting/patches/git_adapter_patch'
- Redmine::Scm::Adapters::GitAdapter.send(:include, GitHosting::Patches::GitAdapterPatch)
-
- require_dependency 'groups_controller'
- require 'git_hosting/patches/groups_controller_patch'
- GroupsController.send(:include, GitHosting::Patches::GroupsControllerPatch)
-
- require_dependency 'repository'
- require_dependency 'repository/git'
- require 'git_hosting/patches/git_repository_patch'
- Repository::Git.send(:include, GitHosting::Patches::GitRepositoryPatch)
-
- require_dependency 'sys_controller'
- require 'git_hosting/patches/sys_controller_patch'
- SysController.send(:include, GitHosting::Patches::SysControllerPatch)
-
- require_dependency 'members_controller'
- require 'git_hosting/patches/members_controller_patch'
- MembersController.send(:include, GitHosting::Patches::MembersControllerPatch)
-
- # initialize association from user -> public keys
- User.send(:has_many, :gitolite_public_keys, :dependent => :destroy)
-
- require_dependency 'users_controller'
- require 'git_hosting/patches/users_controller_patch'
- UsersController.send(:include, GitHosting::Patches::UsersControllerPatch)
-
- require_dependency 'roles_controller'
- require 'git_hosting/patches/roles_controller_patch'
- RolesController.send(:include, GitHosting::Patches::RolesControllerPatch)
-
- require_dependency 'my_controller'
- require 'git_hosting/patches/my_controller_patch'
- MyController.send(:include, GitHosting::Patches::MyControllerPatch)
-
- require_dependency 'git_hosting/patches/repository_cia_filters'
+# Set up autoload of patches
+Dir[File.dirname(__FILE__)+"/lib/git_hosting/patches/*.rb"].each do |patch|
+ require_dependency 'git_hosting/patches/'+File.basename(patch,".rb")
end
# initialize hooks
diff --git a/lib/git_hosting/patches/git_adapter_patch.rb b/lib/git_hosting/patches/git_adapter_patch.rb
index 90298b685..f09d181b6 100644
--- a/lib/git_hosting/patches/git_adapter_patch.rb
+++ b/lib/git_hosting/patches/git_adapter_patch.rb
@@ -1,3 +1,9 @@
+require 'stringio'
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'redmine/scm/adapters/git_adapter'
+
module GitHosting
module Patches
module GitAdapterPatch
@@ -15,17 +21,17 @@ def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
- begin
- alias_method_chain :sq_bin, :sudo
- begin
+ begin
+ alias_method_chain :sq_bin, :sudo
+ begin
alias_method_chain :client_command, :sudo
rescue Exception =>e
end
- rescue Exception => e
- # Hm.... Might be Redmine version < 1.2 (i.e. 1.1). Try redefining GIT_BIN.
- GitHosting.logger.warn "Seems to be early version of Redmine(1.1?), try redefining GIT_BIN."
- Redmine::Scm::Adapters::GitAdapter::GIT_BIN = GitHosting::git_exec()
- end
+ rescue Exception => e
+ # Hm.... Might be Redmine version < 1.2 (i.e. 1.1). Try redefining GIT_BIN.
+ GitHosting.logger.warn "Seems to be early version of Redmine(1.1?), try redefining GIT_BIN."
+ Redmine::Scm::Adapters::GitAdapter::GIT_BIN = GitHosting::git_exec()
+ end
end
end
end
@@ -43,9 +49,9 @@ def client_command_with_sudo
def scm_cmd_with_sudo(*args, &block)
- max_cache_time = (Setting.plugin_redmine_git_hosting['gitCacheMaxTime']).to_i # in seconds, default = 60
- max_cache_elements = (Setting.plugin_redmine_git_hosting['gitCacheMaxElements']).to_i # default = 100
- max_cache_size = (Setting.plugin_redmine_git_hosting['gitCacheMaxSize']).to_i*1024*1024 # In MB, default = 16MB, converted to bytes
+ max_cache_time = (Setting.plugin_redmine_git_hosting['gitCacheMaxTime']).to_i # in seconds, default = 60
+ max_cache_elements = (Setting.plugin_redmine_git_hosting['gitCacheMaxElements']).to_i # default = 100
+ max_cache_size = (Setting.plugin_redmine_git_hosting['gitCacheMaxSize']).to_i*1024*1024 # In MB, default = 16MB, converted to bytes
repo_path = root_url || url
full_args = [GitHosting::git_exec(), '--git-dir', repo_path]
@@ -107,3 +113,6 @@ def scm_cmd_with_sudo(*args, &block)
end
end
end
+
+# Patch in changes
+Redmine::Scm::Adapters::GitAdapter.send(:include, GitHosting::Patches::GitAdapterPatch)
diff --git a/lib/git_hosting/patches/git_repository_patch.rb b/lib/git_hosting/patches/git_repository_patch.rb
index af081f1ff..60027d79d 100644
--- a/lib/git_hosting/patches/git_repository_patch.rb
+++ b/lib/git_hosting/patches/git_repository_patch.rb
@@ -1,3 +1,9 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'repository'
+require_dependency 'repository/git'
+
module GitHosting
module Patches
module GitRepositoryPatch
@@ -9,16 +15,16 @@ def extra_report_last_commit_with_always_true
true
end
- def fetch_changesets_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def fetch_changesets_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- fetch_changesets_without_disable_update
+ # Do actual update
+ fetch_changesets_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
+ end
def self.included(base)
base.class_eval do
@@ -27,7 +33,7 @@ def self.included(base)
begin
base.send(:alias_method_chain, :report_last_commit, :always_true)
base.send(:alias_method_chain, :extra_report_last_commit, :always_true)
- base.send(:alias_method_chain, :fetch_changesets, :disable_update)
+ base.send(:alias_method_chain, :fetch_changesets, :disable_update)
rescue
end
@@ -35,3 +41,6 @@ def self.included(base)
end
end
end
+
+# Patch in changes
+Repository::Git.send(:include, GitHosting::Patches::GitRepositoryPatch)
diff --git a/lib/git_hosting/patches/groups_controller_patch.rb b/lib/git_hosting/patches/groups_controller_patch.rb
index 66e4656ab..5f8df39a8 100644
--- a/lib/git_hosting/patches/groups_controller_patch.rb
+++ b/lib/git_hosting/patches/groups_controller_patch.rb
@@ -1,3 +1,8 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'groups_controller'
+
module GitHosting
module Patches
module GroupsControllerPatch
@@ -23,3 +28,6 @@ def self.included(base)
end
end
end
+
+# Patch in changes
+GroupsController.send(:include, GitHosting::Patches::GroupsControllerPatch)
diff --git a/lib/git_hosting/patches/members_controller_patch.rb b/lib/git_hosting/patches/members_controller_patch.rb
index faef8a623..57ab30493 100644
--- a/lib/git_hosting/patches/members_controller_patch.rb
+++ b/lib/git_hosting/patches/members_controller_patch.rb
@@ -1,48 +1,56 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'members_controller'
+
module GitHosting
module Patches
module MembersControllerPatch
- def new_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def new_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- new_without_disable_update
+ # Do actual update
+ new_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- def edit_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def edit_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- edit_without_disable_update
+ # Do actual update
+ edit_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- def destroy_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def destroy_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- destroy_without_disable_update
+ # Do actual update
+ destroy_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(:delete => true);
- end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- begin
- base.send(:alias_method_chain, :new, :disable_update)
- base.send(:alias_method_chain, :edit, :disable_update)
- base.send(:alias_method_chain, :destroy, :disable_update)
- rescue
- end
+ begin
+ base.send(:alias_method_chain, :new, :disable_update)
+ base.send(:alias_method_chain, :edit, :disable_update)
+ base.send(:alias_method_chain, :destroy, :disable_update)
+ rescue
+ end
end
end
end
end
+
+# Patch in changes
+MembersController.send(:include, GitHosting::Patches::MembersControllerPatch)
diff --git a/lib/git_hosting/patches/my_controller_patch.rb b/lib/git_hosting/patches/my_controller_patch.rb
index 359a84f8c..9dfd582cb 100644
--- a/lib/git_hosting/patches/my_controller_patch.rb
+++ b/lib/git_hosting/patches/my_controller_patch.rb
@@ -1,34 +1,41 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'my_controller'
+
module GitHosting
module Patches
module MyControllerPatch
- # Add in values for viewing public keys:
- def account_with_public_keys
- # Previous routine
- account_without_public_keys
+ # Add in values for viewing public keys:
+ def account_with_public_keys
+ # Previous routine
+ account_without_public_keys
- @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
- @gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
- if @gitolite_public_key.nil?
- if params[:public_key_id]
- # public_key specified that doesn't belong to @user. Kill off public_key_id and try again
- redirect_to :public_key_id => nil, :tab => nil
- return
- else
- @gitolite_public_key = GitolitePublicKey.new
- end
- end
- end
+ @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
+ @gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
+ if @gitolite_public_key.nil?
+ if params[:public_key_id]
+ # public_key specified that doesn't belong to @user. Kill off public_key_id and try again
+ redirect_to :public_key_id => nil, :tab => nil
+ return
+ else
+ @gitolite_public_key = GitolitePublicKey.new
+ end
+ end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- begin
- base.send(:alias_method_chain, :account, :public_keys)
- rescue
- end
+ begin
+ base.send(:alias_method_chain, :account, :public_keys)
+ rescue
+ end
end
end
end
end
-
+
+# Patch in changes
+MyController.send(:include, GitHosting::Patches::MyControllerPatch)
diff --git a/lib/git_hosting/patches/project_patch.rb b/lib/git_hosting/patches/project_patch.rb
index b040364d9..231054aef 100644
--- a/lib/git_hosting/patches/project_patch.rb
+++ b/lib/git_hosting/patches/project_patch.rb
@@ -1,3 +1,8 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'project'
+
module GitHosting
module Patches
module ProjectPatch
@@ -5,17 +10,20 @@ def self.included(base)
base.class_eval do
unloadable
- named_scope :archived, { :conditions => {:status => "#{Project::STATUS_ARCHIVED}"}}
- named_scope :active_or_archived, { :conditions => "status=#{Project::STATUS_ACTIVE} OR status=#{Project::STATUS_ARCHIVED}" }
+ named_scope :archived, { :conditions => {:status => "#{Project::STATUS_ARCHIVED}"}}
+ named_scope :active_or_archived, { :conditions => "status=#{Project::STATUS_ACTIVE} OR status=#{Project::STATUS_ARCHIVED}" }
- # initialize association from project -> repository mirrors
+ # initialize association from project -> repository mirrors
has_many :repository_mirrors, :dependent => :destroy
- # initialize association from project -> repository post receive urls
- has_many :repository_post_receive_urls, :dependent => :destroy
+ # initialize association from project -> repository post receive urls
+ has_many :repository_post_receive_urls, :dependent => :destroy
- end
+ end
end
end
end
end
+
+# Patch in changes
+Project.send(:include, GitHosting::Patches::ProjectPatch)
diff --git a/lib/git_hosting/patches/projects_controller_patch.rb b/lib/git_hosting/patches/projects_controller_patch.rb
index 6a7583747..3862cb6fa 100644
--- a/lib/git_hosting/patches/projects_controller_patch.rb
+++ b/lib/git_hosting/patches/projects_controller_patch.rb
@@ -1,3 +1,8 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'projects_controller'
+
module GitHosting
module Patches
module ProjectsControllerPatch
@@ -12,10 +17,10 @@ def git_repo_init
membership.save
end
if @project.module_enabled?('repository') && Setting.plugin_redmine_git_hosting['allProjectsUseGit'] == "true"
- # Create new repository
+ # Create new repository
repo = Repository.factory("Git")
- # Set urls
- repo.url = repo.root_url = GitHosting.repository_path(@project)
+ # Set urls
+ repo.url = repo.root_url = GitHosting.repository_path(@project)
@project.repository = repo
repo.save
end
@@ -27,92 +32,95 @@ def disable_git_daemon_if_not_public
if @project.repository.extra.git_daemon == 1 && (not @project.is_public )
@project.repository.extra.git_daemon = 0;
@project.repository.extra.save
- @project.repository.save # Trigger update_repositories
+ @project.repository.save # Trigger update_repositories
end
end
end
end
- def create_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def create_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- create_without_disable_update
+ # Do actual update
+ create_without_disable_update
- # Fix up repository
- git_repo_init
+ # Fix up repository
+ git_repo_init
- # Adjust daemon status
- disable_git_daemon_if_not_public
+ # Adjust daemon status
+ disable_git_daemon_if_not_public
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
+ end
- def update_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def update_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- update_without_disable_update
+ # Do actual update
+ update_without_disable_update
- # Adjust daemon status
- disable_git_daemon_if_not_public
+ # Adjust daemon status
+ disable_git_daemon_if_not_public
- myrepo = @project.repository
- if myrepo.is_a?(Repository::Git) && (myrepo.url != GitHosting::repository_path(@project) || myrepo.url != myrepo.root_url)
- # Hm... something about parent hierarchy changed. Update us and our children
- GitHostingObserver.set_update_active(@project, :descendants)
- else
- # Reenable updates to perform a single update
+ myrepo = @project.repository
+ if myrepo.is_a?(Repository::Git) && (myrepo.url != GitHosting::repository_path(@project) || myrepo.url != myrepo.root_url)
+ # Hm... something about parent hierarchy changed. Update us and our children
+ GitHostingObserver.set_update_active(@project, :descendants)
+ else
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- end
+ end
+ end
- def destroy_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def destroy_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- destroy_without_disable_update
+ # Do actual update
+ destroy_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
+ end
- def archive_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def archive_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- archive_without_disable_update
+ # Do actual update
+ archive_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(@project, :archive);
- end
+ end
- def unarchive_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def unarchive_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- unarchive_without_disable_update
+ # Do actual update
+ unarchive_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(@project);
- end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- base.send(:alias_method_chain, :create, :disable_update)
- base.send(:alias_method_chain, :update, :disable_update)
- base.send(:alias_method_chain, :destroy, :disable_update)
- base.send(:alias_method_chain, :archive, :disable_update)
- base.send(:alias_method_chain, :unarchive, :disable_update)
+ base.send(:alias_method_chain, :create, :disable_update)
+ base.send(:alias_method_chain, :update, :disable_update)
+ base.send(:alias_method_chain, :destroy, :disable_update)
+ base.send(:alias_method_chain, :archive, :disable_update)
+ base.send(:alias_method_chain, :unarchive, :disable_update)
end
end
end
end
+
+# Patch in changes
+ProjectsController.send(:include, GitHosting::Patches::ProjectsControllerPatch)
diff --git a/lib/git_hosting/patches/repositories_controller_patch.rb b/lib/git_hosting/patches/repositories_controller_patch.rb
index 77b7c4e0a..64dadb462 100644
--- a/lib/git_hosting/patches/repositories_controller_patch.rb
+++ b/lib/git_hosting/patches/repositories_controller_patch.rb
@@ -1,3 +1,8 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'repositories_controller'
+
module GitHosting
module Patches
module RepositoriesControllerPatch
@@ -12,8 +17,8 @@ def show_with_git_instructions
def edit_with_scm_settings
GitHosting.logger.debug "On edit_with_scm_settings"
- # Turn off updates during repository update
- GitHostingObserver.set_update_active(false);
+ # Turn off updates during repository update
+ GitHostingObserver.set_update_active(false);
params[:repository] ||= {}
if params[:repository_scm] == "Git"
@@ -44,15 +49,15 @@ def edit_with_scm_settings
page.replace_html "main-menu", render_main_menu(@project)
end
end
-
- if !@project.repository.nil?
- GitHostingObserver.bracketed_update_repositories(@project)
- end
+
+ if !@project.repository.nil?
+ GitHostingObserver.bracketed_update_repositories(@project)
+ end
else
edit_without_scm_settings
end
- GitHostingObserver.set_update_active(true);
+ GitHostingObserver.set_update_active(true);
end
def self.included(base)
@@ -65,3 +70,6 @@ def self.included(base)
end
end
end
+
+# Patch in changes
+RepositoriesController.send(:include, GitHosting::Patches::RepositoriesControllerPatch)
diff --git a/lib/git_hosting/patches/repository_cia_filters.rb b/lib/git_hosting/patches/repository_cia_filters.rb
index be72b52fb..839a05040 100644
--- a/lib/git_hosting/patches/repository_cia_filters.rb
+++ b/lib/git_hosting/patches/repository_cia_filters.rb
@@ -29,3 +29,4 @@ def self.included(base)
end
end
+
diff --git a/lib/git_hosting/patches/repository_patch.rb b/lib/git_hosting/patches/repository_patch.rb
index 8b68284e4..c422119da 100644
--- a/lib/git_hosting/patches/repository_patch.rb
+++ b/lib/git_hosting/patches/repository_patch.rb
@@ -1,3 +1,8 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'repository'
+
module GitHosting
module Patches
module RepositoryPatch
@@ -20,65 +25,68 @@ def factory_with_git_extra_init(klass_name, *args)
if new_repo.is_a?(Repository::Git)
if new_repo.extra.nil?
# Note that this autoinitializes default values and hook key
- GitHosting.logger.error "Automatic initialization of git_repository_extra failed for #{self.project.to_s}"
+ GitHosting.logger.error "Automatic initialization of git_repository_extra failed for #{self.project.to_s}"
end
end
return new_repo
end
- def fetch_changesets_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def fetch_changesets_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- fetch_changesets_without_disable_update
+ # Do actual update
+ fetch_changesets_without_disable_update
- # Reenable updates to perform a sync of all projects
+ # Reenable updates to perform a sync of all projects
GitHostingObserver.set_update_active(:resync_all);
- end
+ end
end
- module InstanceMethods
- # New version of extra() -- construct extra association if missing
- def extra
+ module InstanceMethods
+ # New version of extra() -- construct extra association if missing
+ def extra
retval = self.git_extra
- if retval.nil?
- # Construct new extra structure, followed by updating hooks (if necessary)
- GitHostingObserver.set_update_active(false);
+ if retval.nil?
+ # Construct new extra structure, followed by updating hooks (if necessary)
+ GitHostingObserver.set_update_active(false);
- retval = GitRepositoryExtra.new()
- self.git_extra = retval # Should save object...
+ retval = GitRepositoryExtra.new()
+ self.git_extra = retval # Should save object...
- # If self.project != nil, trigger repair of hooks
- GitHostingObserver.set_update_active(true, self.project, :resync_hooks => true)
- end
- retval
- end
+ # If self.project != nil, trigger repair of hooks
+ GitHostingObserver.set_update_active(true, self.project, :resync_hooks => true)
+ end
+ retval
+ end
- def extra=(new_extra_struct)
- self.git_extra=(new_extra_struct)
- end
- end
+ def extra=(new_extra_struct)
+ self.git_extra=(new_extra_struct)
+ end
+ end
def self.included(base)
base.class_eval do
unloadable
- extend(ClassMethods)
+ extend(ClassMethods)
class << self
alias_method_chain :factory, :git_extra_init
- alias_method_chain :fetch_changesets, :disable_update
+ alias_method_chain :fetch_changesets, :disable_update
end
- # initialize association from git repository -> git_extra
- has_one :git_extra, :foreign_key =>'repository_id', :class_name => 'GitRepositoryExtra', :dependent => :destroy
+ # initialize association from git repository -> git_extra
+ has_one :git_extra, :foreign_key =>'repository_id', :class_name => 'GitRepositoryExtra', :dependent => :destroy
- # initialize association from git repository -> cia_notifications
- has_many :cia_notifications, :foreign_key =>'repository_id', :class_name => 'GitCiaNotification', :dependent => :destroy, :extend => GitHosting::Patches::RepositoryCiaFilters::FilterMethods
+ # initialize association from git repository -> cia_notifications
+ has_many :cia_notifications, :foreign_key =>'repository_id', :class_name => 'GitCiaNotification', :dependent => :destroy, :extend => GitHosting::Patches::RepositoryCiaFilters::FilterMethods
- include(InstanceMethods)
+ include(InstanceMethods)
end
end
end
end
end
+
+# Patch in changes
+Repository.send(:include, GitHosting::Patches::RepositoryPatch)
diff --git a/lib/git_hosting/patches/roles_controller_patch.rb b/lib/git_hosting/patches/roles_controller_patch.rb
index 33782df66..73b0be3a5 100644
--- a/lib/git_hosting/patches/roles_controller_patch.rb
+++ b/lib/git_hosting/patches/roles_controller_patch.rb
@@ -1,36 +1,44 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'roles_controller'
+
module GitHosting
module Patches
module RolesControllerPatch
- def edit_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def edit_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- edit_without_disable_update
+ # Do actual update
+ edit_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- def destroy_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def destroy_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- destroy_without_disable_update
+ # Do actual update
+ destroy_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- begin
- base.send(:alias_method_chain, :edit, :disable_update)
- base.send(:alias_method_chain, :destroy, :disable_update)
- rescue
- end
+ begin
+ base.send(:alias_method_chain, :edit, :disable_update)
+ base.send(:alias_method_chain, :destroy, :disable_update)
+ rescue
+ end
end
end
end
end
+
+# Patch in changes
+RolesController.send(:include, GitHosting::Patches::RolesControllerPatch)
diff --git a/lib/git_hosting/patches/sys_controller_patch.rb b/lib/git_hosting/patches/sys_controller_patch.rb
index cf473c949..0eddce9ed 100644
--- a/lib/git_hosting/patches/sys_controller_patch.rb
+++ b/lib/git_hosting/patches/sys_controller_patch.rb
@@ -1,26 +1,34 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'sys_controller'
+
module GitHosting
module Patches
module SysControllerPatch
- def fetch_changesets_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def fetch_changesets_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- fetch_changesets_without_disable_update
+ # Do actual update
+ fetch_changesets_without_disable_update
- # Perform the updating process on all projects
+ # Perform the updating process on all projects
GitHostingObserver.set_update_active(:resync_all);
- end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- begin
- base.send(:alias_method_chain, :fetch_changesets, :disable_update)
- rescue
- end
+ begin
+ base.send(:alias_method_chain, :fetch_changesets, :disable_update)
+ rescue
+ end
end
end
end
end
+
+# Patch in changes
+SysController.send(:include, GitHosting::Patches::SysControllerPatch)
diff --git a/lib/git_hosting/patches/user_patch.rb b/lib/git_hosting/patches/user_patch.rb
new file mode 100644
index 000000000..e749e6cfb
--- /dev/null
+++ b/lib/git_hosting/patches/user_patch.rb
@@ -0,0 +1,21 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+
+module GitHosting
+ module Patches
+ module UserPatch
+ def self.included(base)
+ base.class_eval do
+ unloadable
+
+ # initialize association from user -> gitolite_public_keys
+ has_many :gitolite_public_keys, :dependent => :destroy
+ end
+ end
+ end
+ end
+end
+
+# Patch in changes
+User.send(:include, GitHosting::Patches::UserPatch)
diff --git a/lib/git_hosting/patches/users_controller_patch.rb b/lib/git_hosting/patches/users_controller_patch.rb
index 9d0086dba..0b283447e 100644
--- a/lib/git_hosting/patches/users_controller_patch.rb
+++ b/lib/git_hosting/patches/users_controller_patch.rb
@@ -1,90 +1,98 @@
+require_dependency 'principal'
+require_dependency 'user'
+require_dependency 'git_hosting'
+require_dependency 'users_controller'
+
module GitHosting
module Patches
module UsersControllerPatch
- def create_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ def create_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- create_without_disable_update
+ # Do actual update
+ create_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- def update_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def update_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Set public key values for view
- set_public_key_values
+ # Set public key values for view
+ set_public_key_values
- # Do actual update
- update_without_disable_update
+ # Do actual update
+ update_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
- def destroy_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def destroy_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- destroy_without_disable_update
+ # Do actual update
+ destroy_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(:delete);
- end
- def edit_membership_with_disable_update
- # Turn of updates during repository update
- GitHostingObserver.set_update_active(false);
+ end
+ def edit_membership_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
- # Do actual update
- edit_membership_without_disable_update
+ # Do actual update
+ edit_membership_without_disable_update
- # Reenable updates to perform a single update
+ # Reenable updates to perform a single update
GitHostingObserver.set_update_active(true);
- end
-
- # Add in values for viewing public keys:
- def edit_with_public_keys
- # Set public key values for view
- set_public_key_values
-
- # Previous routine
- edit_without_public_keys
- end
-
- # Add in values for viewing public keys:
- def set_public_key_values
- @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
- @gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
- if @gitolite_public_key.nil?
- if params[:public_key_id]
- # public_key specified that doesn't belong to @user. Kill off public_key_id and try again
- redirect_to :public_key_id => nil, :tab => params[:tab]
- return
- else
- @gitolite_public_key = GitolitePublicKey.new
- end
- end
- end
+ end
+
+ # Add in values for viewing public keys:
+ def edit_with_public_keys
+ # Set public key values for view
+ set_public_key_values
+
+ # Previous routine
+ edit_without_public_keys
+ end
+
+ # Add in values for viewing public keys:
+ def set_public_key_values
+ @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
+ @gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
+ if @gitolite_public_key.nil?
+ if params[:public_key_id]
+ # public_key specified that doesn't belong to @user. Kill off public_key_id and try again
+ redirect_to :public_key_id => nil, :tab => params[:tab]
+ return
+ else
+ @gitolite_public_key = GitolitePublicKey.new
+ end
+ end
+ end
def self.included(base)
base.class_eval do
unloadable
end
- # Edit adds new functionality, so don't silently fail!
- base.send(:alias_method_chain, :edit, :public_keys)
- begin
- base.send(:alias_method_chain, :create, :disable_update)
- base.send(:alias_method_chain, :update, :disable_update)
- base.send(:alias_method_chain, :edit_membership, :disable_update)
- # Put this last, since Redmine 1.1 doesn't have it....
- base.send(:alias_method_chain, :destroy, :disable_update)
- rescue
- end
+ # Edit adds new functionality, so don't silently fail!
+ base.send(:alias_method_chain, :edit, :public_keys)
+ begin
+ base.send(:alias_method_chain, :create, :disable_update)
+ base.send(:alias_method_chain, :update, :disable_update)
+ base.send(:alias_method_chain, :edit_membership, :disable_update)
+ # Put this last, since Redmine 1.1 doesn't have it....
+ base.send(:alias_method_chain, :destroy, :disable_update)
+ rescue
+ end
end
end
end
end
+
+# Patch in changes
+UsersController.send(:include, GitHosting::Patches::UsersControllerPatch)
From c16bbb308081d240947d5244772de2799fe362a2 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Sat, 28 Jul 2012 13:24:26 -0700
Subject: [PATCH 058/107] Fix slight errors on 'my_account' page
---
app/views/my/account.html.erb | 2 +-
config/routes.rb | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index 67623e766..8f8e46b49 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -4,7 +4,7 @@
+
+
+
diff --git a/app/views/deployment_credentials/create_with_key.html.erb b/app/views/deployment_credentials/create_with_key.html.erb
new file mode 100644
index 000000000..ed337c871
--- /dev/null
+++ b/app/views/deployment_credentials/create_with_key.html.erb
@@ -0,0 +1,7 @@
+<% if not @is_xhr %>
<%=l(:label_deployment_credential_create)%>
<% end %>
+<% labelled_remote_form_for :deployment_credentials, @cred,
+ :url => { :controller => 'deployment_credentials', :action => 'create_with_key', :project_id => @project, :id => @cred.id },
+ :html => {:method => :post} do |f| %>
+<%= render :partial => 'form_with_key', :locals => { :f => f } %>
+<%= submit_tag l(:button_save) %>
+<% end %>
diff --git a/app/views/deployment_credentials/destroy.html.erb b/app/views/deployment_credentials/destroy.html.erb
new file mode 100644
index 000000000..1fabd6c59
--- /dev/null
+++ b/app/views/deployment_credentials/destroy.html.erb
@@ -0,0 +1,16 @@
+<% if not @is_xhr %>
<%=l(:label_deployment_credential_delete)%>
<% end %>
+
+
+ <%= "#{keylabel(@cred.gitolite_public_key)} => #{@cred.perm}".html_safe %>
+ Are you sure you want to delete this deployment credential?
+ <% if @will_delete_key %>
+ (Will delete corresponding key: <%= "#{keylabel(@cred.gitolite_public_key)}".html_safe %>)
+ <% end %>
+
diff --git a/assets/stylesheets/application.css b/assets/stylesheets/application.css
index 8166c27b5..1227d6cca 100644
--- a/assets/stylesheets/application.css
+++ b/assets/stylesheets/application.css
@@ -45,7 +45,7 @@ padding:5px;
.public_key_view label {
font-weight: bold;
-text-align: left;
+text-align: right;
}
.public_key_view .myhead {
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index bac4065ef..72b772751 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -62,20 +62,45 @@ bg:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index 7158f7e3d..acb112115 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -62,20 +62,45 @@ bs:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index ed842f7a9..3675b3f32 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -62,20 +62,45 @@ ca:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index e1fa96dde..57b8e66ba 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -62,20 +62,45 @@ cs:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 973630c8d..9fe0a79f2 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -62,20 +62,45 @@ da:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 5e5a4b949..55cbc2d64 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -62,20 +62,45 @@ de:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/el.yml b/config/locales/el.yml
index be4529f04..d525128b1 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -62,20 +62,45 @@ el:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cb36bc86c..368b9b327 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -62,20 +62,45 @@ en:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 573b7f209..0d64f8331 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -62,20 +62,45 @@ es:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index d63be5e6d..e4b50c459 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -62,20 +62,45 @@ fi:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 4d2ac0a49..bc0a2849a 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -62,20 +62,45 @@ fr:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index d03af4042..10eae6611 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -62,20 +62,45 @@ gl:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 02252b0e6..66ece3a8e 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -62,20 +62,45 @@ he:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index e6c37c6cc..73fe1aa3b 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -62,20 +62,45 @@
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/id.yml b/config/locales/id.yml
index 8e63e11b1..7033e1721 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -62,20 +62,45 @@ id:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 6be58efd4..aabcbecad 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -62,20 +62,45 @@ it:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 0e6ae9c4f..b978f96ef 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -62,20 +62,45 @@ ja:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 6cb43503e..3db715414 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -62,20 +62,45 @@ ko:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 1f621b474..c91b0e9cf 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -62,20 +62,45 @@ lt:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index a1a64f9cc..0b9f633e2 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -62,20 +62,45 @@ nl:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 5b01171c6..97b4a9062 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -62,20 +62,45 @@
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 8c2fc822a..45085fa2d 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -62,20 +62,45 @@ pl:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index d36ceb9bd..520a23764 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -60,20 +60,45 @@ pt-BR:
label_public_keys: 'Chaves públicas'
label_current_public_keys: 'As chaves públicas atuais'
+ label_current_user_keys: 'Atuais Chaves Usuário'
+ label_current_deploy_keys: 'Atuais Chaves Deployment'
+ label_user_key: 'Chaves Usuário'
+ label_deploy_key: 'Chaves Deployment'
+ field_key_type: 'Tipo de Chave Pública'
+ field_delete_when_unused: 'Excluir chave quando não for utilizado'
label_identifier_can_be_arbitrary: 'Identificador (Qualquer texto significativa)'
label_cut_and_paste: 'Chave (cortar e colar arquivo .pub ficheiro)'
label_public_key_new: 'Nova chave pública'
label_public_key_edit: 'Editar a chave pública existentes'
+ field_key: Chave
field_public_key: Chave
- notice_public_key_updated: 'A chave pública "%{title}" foi actualizada com sucesso.'
- notice_public_key_added: 'A chave pública "%{title}" foi adicionada com sucesso.'
- notice_public_key_deleted: 'A chave pública "%{title}" foi excluído com sucesso.'
+ field_title: Identifier
+ notice_public_key_updated: 'A chave pública %{title} foi actualizada com sucesso.'
+ notice_public_key_added: 'A chave pública %{title} foi adicionada com sucesso.'
+ notice_public_key_deleted: 'A chave pública %{title} foi excluído com sucesso.'
+ error_public_key_create_failed: 'Não Conseguiu Criar Chave Pública'
+ error_public_key_update_failed: 'Não Conseguiu Atualizar Chave Pública'
label_key_cannot_be_changed_please_create_new_key: 'A chave já não pode ser alterada. No entanto, pode excluí-lo e criar uma nova.'
activerecord:
errors:
messages:
'não pode ser mudada': 'não pode ser mudada'
- text_gitolite_key_destroy_confirmation: 'Tem certeza de que quer destruir "%{title}"?'
+ text_gitolite_key_destroy_confirmation: 'Tem certeza de que quer destruir %{title}?'
+ text_this_key: esta chave
+ label_deploy_perm: 'Permissões de Acesso'
+ select_create_new_key: 'Criar Nova Chave (Abaixo)'
+ select_other_keys: 'Outras Chaves'
+ label_deployment_credential_create: 'Criar Credencial Deployment Novo'
+ label_deployment_credential_edit: 'Editar Credencial Deployment'
+ label_deployment_credential_delete: 'Excluir Credencial Deployment'
+ label_which_deploy_key: 'Selecione a Chave Deployment'
+ notice_deployment_credential_updated: "Credencial Deployment %{title} => %{perm} foi atualizado com sucesso."
+ notice_deployment_credential_added: "Credencial Deployment %{title} => %{perm} foi adicionado com sucesso."
+ notice_deployment_credential_deleted: "Credencial Deployment %{title} => %{perm} excluído com sucesso."
+ notice_deployment_credential_deleted_with_key: "Ambos os Credencial Deployment %{title} => %{perm} and Key %{title} foram excluído com sucesso."
+ error_deployment_credential_create_failed: 'Não Conseguiu Criar Credencial Deployment.'
+ error_deployment_credential_update_failed: 'Não Conseguiu Atualizar Credencial Deployment.'
+ field_perm: 'Permissões'
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index c420e5a0d..2361afcbc 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -6,8 +6,8 @@ pt:
label_git_user: Nome de Utilizador Git
label_gitolite_identity_public_key_file: Gitolite SSH Identity File (Public Key)
label_gitolite_identity_file: Ficheiro de identidade SSH Gitolite (Chave Privada)
- label_gitolite_config_file: Arquivo de configuração Gitolite (relativo ao diretório conf)
- label_gitolite_config_has_admin_key: Arquivo de configuração Gitolite tem admin chave
+ label_gitolite_config_file: 'Arquivo de configuração Gitolite (relativo ao diretório conf)'
+ label_gitolite_config_has_admin_key: 'Arquivo de configuração Gitolite tem admin chave'
label_git_repository_base_path: 'Directório Git base (Relativo à "home" do utilizador git)'
label_git_recycle_base_path: 'Directório Recycle Bin base (Relativo à "home" do utilizador git)'
label_git_recycle_expire_time: 'expirar o tempo para Recycle Bin (em horas)'
@@ -60,20 +60,45 @@ pt:
label_public_keys: 'Chaves públicas'
label_current_public_keys: 'As chaves públicas atuais'
+ label_current_user_keys: 'Atuais Chaves Usuário'
+ label_current_deploy_keys: 'Atuais Chaves Deployment'
+ label_user_key: 'Chaves Usuário'
+ label_deploy_key: 'Chaves Deployment'
+ field_key_type: 'Tipo de Chave Pública'
+ field_delete_when_unused: 'Excluir chave quando não for utilizado'
label_identifier_can_be_arbitrary: 'Identificador (Qualquer texto significativa)'
label_cut_and_paste: 'Chave (cortar e colar arquivo .pub ficheiro)'
label_public_key_new: 'Nova chave pública'
label_public_key_edit: 'Editar a chave pública existentes'
+ field_key: Chave
field_public_key: Chave
- notice_public_key_updated: 'A chave pública "%{title}" foi actualizada com sucesso.'
- notice_public_key_added: 'A chave pública "%{title}" foi adicionada com sucesso.'
- notice_public_key_deleted: 'A chave pública "%{title}" foi excluído com sucesso.'
+ field_title: Identifier
+ notice_public_key_updated: 'A chave pública %{title} foi actualizada com sucesso.'
+ notice_public_key_added: 'A chave pública %{title} foi adicionada com sucesso.'
+ notice_public_key_deleted: 'A chave pública %{title} foi excluído com sucesso.'
+ error_public_key_create_failed: 'Não Conseguiu Criar Chave Pública'
+ error_public_key_update_failed: 'Não Conseguiu Atualizar Chave Pública'
label_key_cannot_be_changed_please_create_new_key: 'A chave já não pode ser alterada. No entanto, pode excluí-lo e criar uma nova.'
activerecord:
errors:
messages:
'não pode ser mudada': 'não pode ser mudada'
- text_gitolite_key_destroy_confirmation: 'Tem certeza de que quer destruir "%{title}"?'
+ text_gitolite_key_destroy_confirmation: 'Tem certeza de que quer destruir %{title}?'
+ text_this_key: esta chave
+ label_deploy_perm: 'Permissões de Acesso'
+ select_create_new_key: 'Criar Nova Chave (Abaixo)'
+ select_other_keys: 'Outras Chaves'
+ label_deployment_credential_create: 'Criar Credencial Deployment Novo'
+ label_deployment_credential_edit: 'Editar Credencial Deployment'
+ label_deployment_credential_delete: 'Excluir Credencial Deployment'
+ label_which_deploy_key: 'Selecione a Chave Deployment'
+ notice_deployment_credential_updated: "Credencial Deployment %{title} => %{perm} foi atualizado com sucesso."
+ notice_deployment_credential_added: "Credencial Deployment %{title} => %{perm} foi adicionado com sucesso."
+ notice_deployment_credential_deleted: "Credencial Deployment %{title} => %{perm} excluído com sucesso."
+ notice_deployment_credential_deleted_with_key: "Ambos os Credencial Deployment %{title} => %{perm} and Key %{title} foram excluído com sucesso."
+ error_deployment_credential_create_failed: 'Não Conseguiu Criar Credencial Deployment.'
+ error_deployment_credential_update_failed: 'Não Conseguiu Atualizar Credencial Deployment.'
+ field_perm: 'Permissões'
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 6c2978bc4..ea8d13ec0 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -62,20 +62,45 @@ ro:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index cd6852f21..22cc8f614 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -62,20 +62,45 @@ ru:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 0c18347e9..bcfea1cfe 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -62,20 +62,45 @@ sk:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 5ea76e91d..ef3716b74 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -62,20 +62,45 @@ sl:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 1b7388206..058101a22 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -62,20 +62,45 @@ sr:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index bc039bd38..b5f529517 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -62,20 +62,45 @@ sv:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 4621d24a1..ac5bf7b90 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -62,20 +62,45 @@ th:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index 752100704..93b237ecc 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -62,20 +62,45 @@ tr:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index a84293b29..37b654927 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -62,20 +62,45 @@ uk:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index 6dd5c2963..c9610a808 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -62,20 +62,45 @@ vi:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 61031f104..91897c6e2 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -62,20 +62,45 @@
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index d86b3eba9..0e1492b1e 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -62,20 +62,45 @@ zh:
label_public_keys: Public keys
label_current_public_keys: Current Public keys
+ label_current_user_keys: Current User Keys
+ label_current_deploy_keys: Current Deployment Keys
+ label_user_key: User Key
+ label_deploy_key: Deploy Key
+ field_key_type: Public Key Type
+ field_delete_when_unused: Delete Key When Unused
label_identifier_can_be_arbitrary: Identifier (can be any meaningful string)
label_cut_and_paste: Key (cut and paste entire .pub file)
label_public_key_new: Enter new Public key
label_public_key_edit: Edit existing Public key
+ field_key: Key
field_public_key: Key
- notice_public_key_updated: Public key '%{title}' was successfully updated.
- notice_public_key_added: Public key '%{title}' was successfully added.
- notice_public_key_deleted: Public key '%{title}' was successfully deleted.
+ field_title: Identifier
+ notice_public_key_updated: Public key %{title} was successfully updated.
+ notice_public_key_added: Public key %{title} was successfully added.
+ notice_public_key_deleted: Public key %{title} was successfully deleted.
+ error_public_key_create_failed: Failed to create public key.
+ error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
activerecord:
errors:
messages:
'may not be changed': 'may not be changed'
- text_gitolite_key_destroy_confirmation: Are you sure you want to destroy '%{title}'?
+ text_gitolite_key_destroy_confirmation: Are you sure you want to destroy %{title}?
+ text_this_key: this key
+ label_deploy_perm: Access Permissions
+ select_create_new_key: Create New Key (Below)
+ select_other_keys: 'Other Keys'
+ label_deployment_credential_create: Create New Deployment Credential
+ label_deployment_credential_edit: Edit Deployment Credential
+ label_deployment_credential_delete: Delete Deployment Credential
+ label_which_deploy_key: Select Deployment Key
+ notice_deployment_credential_updated: Deployment Credential %{title} => %{perm} was successfully updated.
+ notice_deployment_credential_added: Deployment Credential %{title} => %{perm} was successfully added.
+ notice_deployment_credential_deleted: Deployment Credential %{title} =>%{perm} was successfully deleted.
+ notice_deployment_credential_deleted_with_key: Both Deployment Credential %{title} => %{perm} and Key %{title} were successfully deleted.
+ error_deployment_credential_create_failed: Failed to create Deployment Credential.
+ error_deployment_credential_update_failed: Failed to update Deployment Credential.
+ field_perm: Permissions
label_git_cache_max_time: Max Cache Time
label_git_cache_max_elements: Max Cache Elements
diff --git a/config/routes.rb b/config/routes.rb
index 0fd926585..1708754e8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -27,6 +27,12 @@ def install_redmine_git_hosting_routes(map)
project_views.connect 'projects/:project_id/settings/repository/post-receive-urls/update/:id', :action => 'update', :conditions => {:method => :post}
project_views.connect 'projects/:project_id/settings/repository/post-receive-urls/delete/:id', :action => 'destroy', :conditions => {:method => [:get, :delete]}
end
+ project_mapper.with_options :controller => 'deployment_credentials' do |project_views|
+ project_views.connect 'projects/:project_id/settings/repository/deployment-credentials/new', :action => 'create_with_key', :conditions => {:method => [:get, :post]}
+ project_views.connect 'projects/:project_id/settings/repository/deployment-credentials/edit/:id', :action => 'edit'
+ project_views.connect 'projects/:project_id/settings/repository/deployment-credentials/update/:id', :action => 'update', :conditions => {:method => :post}
+ project_views.connect 'projects/:project_id/settings/repository/deployment-credentials/delete/:id', :action => 'destroy', :conditions => {:method => [:get, :delete]}
+ end
end
end
diff --git a/db/migrate/20120803043256_create_deployment_credentials.rb b/db/migrate/20120803043256_create_deployment_credentials.rb
new file mode 100644
index 000000000..2c3396583
--- /dev/null
+++ b/db/migrate/20120803043256_create_deployment_credentials.rb
@@ -0,0 +1,53 @@
+class CreateDeploymentCredentials < ActiveRecord::Migration
+ def self.up
+ begin
+ create_table :deployment_credentials do |t|
+ t.references :repository
+ t.references :gitolite_public_key
+ t.references :user
+ t.column :active, :integer, :default => 1
+ t.column :perm, :string, :null => false
+ end
+ add_index :deployment_credentials, :repository_id
+ add_index :deployment_credentials, :gitolite_public_key_id
+
+ add_column :gitolite_public_keys, :key_type, :integer, :default => GitolitePublicKey::KEY_TYPE_USER
+ add_column :gitolite_public_keys, :delete_when_unused, :boolean, :default => true
+
+ GitHostingObserver.set_update_active(false)
+
+ manager_role = Role.find_by_name(I18n.t(:default_role_manager))
+ manager_role.add_permission! :view_deployment_keys
+ manager_role.add_permission! :edit_deployment_keys
+ manager_role.add_permission! :create_deployment_keys
+ manager_role.save
+
+ developer_role = Role.find_by_name(I18n.t(:default_role_developer))
+ developer_role.add_permission! :view_deployment_keys
+ developer_role.save
+ rescue => e
+ puts "#{e}"
+ end
+ end
+
+ def self.down
+ begin
+ drop_table :deployment_credentials
+ remove_column :gitolite_public_keys, :key_type
+ remove_column :gitolite_public_keys, :delete_when_unused
+
+ GitHostingObserver.set_update_active(false)
+ manager_role = Role.find_by_name(I18n.t(:default_role_manager))
+ manager_role.remove_permission! :view_deployment_keys
+ manager_role.remove_permission! :edit_deployment_keys
+ manager_role.remove_permission! :create_deployment_keys
+ manager_role.save
+
+ developer_role = Role.find_by_name(I18n.t(:default_role_developer))
+ developer_role.remove_permission! :view_deployment_keys
+ developer_role.save
+ rescue => e
+ puts "#{e}"
+ end
+ end
+end
diff --git a/init.rb b/init.rb
index f8d32aabd..838133f80 100755
--- a/init.rb
+++ b/init.rb
@@ -49,6 +49,9 @@
permission :create_repository_post_receive_urls, :repository_post_receive_urls => :create
permission :view_repository_post_receive_urls, :repository_post_receive_urls => :index
permission :edit_repository_post_receive_urls, :repository_post_receive_urls => :edit
+ permission :create_deployment_keys, :deployment_credentials => :create_with_key
+ permission :view_deployment_keys, :deployment_credentials => :index
+ permission :edit_deployment_keys, :deployment_credentials => :edit
end
end
diff --git a/lib/git_hosting.rb b/lib/git_hosting.rb
index 27801f739..f5b3d1bba 100755
--- a/lib/git_hosting.rb
+++ b/lib/git_hosting.rb
@@ -10,13 +10,13 @@
module GitHosting
- LOCK_WAIT_IF_UNDEF = 10 # In case settings not migrated (normally from settings)
- REPOSITORY_IF_UNDEF = "repositories/" # In case settings not migrated (normally from settings)
- REDMINE_SUBDIR = "" # In case settings not migrated (normally from settings)
- REDMINE_HIERARCHICAL = "true" # In case settings not migrated (normally from settings)
- HTTP_SERVER_SUBDIR = "" # In case settings not migrated (normally from settings)
+ LOCK_WAIT_IF_UNDEF = 10 # In case settings not migrated (normally from settings)
+ REPOSITORY_IF_UNDEF = "repositories/" # In case settings not migrated (normally from settings)
+ REDMINE_SUBDIR = "" # In case settings not migrated (normally from settings)
+ REDMINE_HIERARCHICAL = "true" # In case settings not migrated (normally from settings)
+ HTTP_SERVER_SUBDIR = "" # In case settings not migrated (normally from settings)
TEMP_DATA_DIR = "/tmp/redmine_git_hosting" # In case settings not migrated (normally from settings)
- SCRIPT_DIR = "" # In case settings not migrated (normally from settings)
+ SCRIPT_DIR = "" # In case settings not migrated (normally from settings)
SCRIPT_PARENT = "bin"
# Used to register errors when pulling and pushing the conf file
@@ -719,11 +719,20 @@ def self.update_repositories(*args)
end
# Collect relevant users into hash with user as key and activity (in some active project) as value
- git_projects.select{|proj| proj.active?}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq.each do |cur_user|
- active_keys = cur_user.gitolite_public_keys.active || []
+ (git_projects.select{|proj| proj.active?}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq << GitolitePublicKey::DEPLOY_PSEUDO_USER).each do |cur_user|
+ if cur_user == GitolitePublicKey::DEPLOY_PSEUDO_USER
+ active_keys = DeploymentCredential.active.select(&:honored?).map(&:gitolite_public_key).uniq
+ cur_token = cur_user
- # Remove old keys that happen to be left around
- cur_token = GitolitePublicKey.user_to_user_token(cur_user)
+ # Remove inactive Deployment Credentials
+ DeploymentCredential.inactive.each {|cred| DeploymentCredential.destroy(cred.id)}
+ else
+ active_keys = cur_user.gitolite_public_keys.active.select{|x| x.user_key?} || []
+ cur_token = GitolitePublicKey.user_to_user_token(cur_user)
+
+ # Remove inactive keys (will be deleted below)
+ cur_user.gitolite_public_keys.inactive.each {|key| GitolitePublicKey.destroy(key.id)}
+ end
# Current filenames
old_keynames = old_keyhash[cur_token] || []
@@ -751,9 +760,6 @@ def self.update_repositories(*args)
changed = true
end
- # Remove inactive keys (will already be deleted by above code)
- cur_user.gitolite_public_keys.inactive.each {|key| GitolitePublicKey.destroy(key.id)}
-
# Add missing keys to the keydir
active_keys.each do |key|
keyname = "#{key.identifier}.pub"
@@ -876,19 +882,19 @@ def self.update_repositories(*args)
# If this is an active (non-archived) project, then update gitolite entry. Add GIT_DAEMON_KEY.
if proj.active?
+ # Get deployment keys (could be empty)
+ write_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
+ read_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:view_changesets) && !cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
+
# fetch users
users = proj.member_principals.map(&:user).compact.uniq
write_users = users.select{ |user| user.allowed_to?( :commit_access, proj ) }
read_users = users.select{ |user| user.allowed_to?( :view_changesets, proj ) && !user.allowed_to?( :commit_access, proj ) }
- # update users
- read_user_keys = []
- write_user_keys = []
-
- read_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
+ read_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
read_user_keys.push key.identifier
end
- write_users.map{|u| u.gitolite_public_keys.active}.flatten.compact.uniq.each do |key|
+ write_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
write_user_keys.push key.identifier
end
@@ -902,8 +908,8 @@ def self.update_repositories(*args)
# Note -- delete_redmine_keys() will also remove the GIT_DAEMON_KEY for repos with redmine keys
# (to be put back as above, when appropriate).
conf.delete_redmine_keys repo_name
- conf.add_read_user repo_name, read_user_keys
- conf.add_write_user repo_name, write_user_keys
+ conf.add_read_user repo_name, read_user_keys.uniq
+ conf.add_write_user repo_name, write_user_keys.uniq
# If no redmine keys, mark with dummy key
if (read_user_keys+write_user_keys).empty?
diff --git a/lib/git_hosting/patches/members_controller_patch.rb b/lib/git_hosting/patches/members_controller_patch.rb
index 085181a51..92c356caa 100644
--- a/lib/git_hosting/patches/members_controller_patch.rb
+++ b/lib/git_hosting/patches/members_controller_patch.rb
@@ -37,14 +37,32 @@ def destroy_with_disable_update
GitHostingObserver.set_update_active(:delete => true);
end
+ # Need to make sure that we can re-render the repository settings page
+ def render_with_trigger_refresh(*options, &myblock)
+ doing_update = options.detect {|x| x==:update || (x.is_a?(Hash) && x[:update])}
+ if !doing_update
+ render_without_trigger_refresh(*options, &myblock)
+ else
+ # For repository partial
+ @repository ||= @project.repository
+ render_without_trigger_refresh *options do |page|
+ yield page
+ page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'
+ end
+ end
+ end
+
def self.included(base)
base.class_eval do
unloadable
+
+ helper :repositories
end
begin
base.send(:alias_method_chain, :new, :disable_update)
base.send(:alias_method_chain, :edit, :disable_update)
base.send(:alias_method_chain, :destroy, :disable_update)
+ base.send(:alias_method_chain, :render, :trigger_refresh)
rescue
end
end
diff --git a/lib/git_hosting/patches/my_controller_patch.rb b/lib/git_hosting/patches/my_controller_patch.rb
index f5ccc53ef..6dfcb22ce 100644
--- a/lib/git_hosting/patches/my_controller_patch.rb
+++ b/lib/git_hosting/patches/my_controller_patch.rb
@@ -11,7 +11,9 @@ def account_with_public_keys
# Previous routine
account_without_public_keys
- @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
+ @gitolite_user_keys = @user.gitolite_public_keys.active.user_key.find(:all,:order => 'title ASC, created_at ASC')
+ @gitolite_deploy_keys = @user.gitolite_public_keys.active.deploy_key.find(:all,:order => 'title ASC, created_at ASC')
+ @gitolite_public_keys = @gitolite_user_keys + @gitolite_deploy_keys
@gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
if @gitolite_public_key.nil?
if params[:public_key_id]
@@ -27,6 +29,8 @@ def account_with_public_keys
def self.included(base)
base.class_eval do
unloadable
+
+ helper :gitolite_public_keys
end
begin
base.send(:alias_method_chain, :account, :public_keys)
diff --git a/lib/git_hosting/patches/repository_patch.rb b/lib/git_hosting/patches/repository_patch.rb
index 9855f48f0..28f95302f 100644
--- a/lib/git_hosting/patches/repository_patch.rb
+++ b/lib/git_hosting/patches/repository_patch.rb
@@ -81,6 +81,8 @@ class << self
# initialize association from git repository -> cia_notifications
has_many :cia_notifications, :foreign_key =>'repository_id', :class_name => 'GitCiaNotification', :dependent => :destroy, :extend => GitHosting::Patches::RepositoryCiaFilters::FilterMethods
+ has_many :deployment_credentials, :dependent => :destroy
+
include(InstanceMethods)
end
end
diff --git a/lib/git_hosting/patches/users_controller_patch.rb b/lib/git_hosting/patches/users_controller_patch.rb
index 7bb0524bc..c257584a9 100644
--- a/lib/git_hosting/patches/users_controller_patch.rb
+++ b/lib/git_hosting/patches/users_controller_patch.rb
@@ -61,12 +61,14 @@ def edit_with_public_keys
# Add in values for viewing public keys:
def set_public_key_values
- @gitolite_public_keys = @user.gitolite_public_keys.all(:order => 'active DESC, created_at DESC', :conditions => "active=1")
+ @gitolite_user_keys = @user.gitolite_public_keys.all(:order => 'title ASC, created_at ASC', :conditions => "active=1 && key_type=#{GitolitePublicKey::KEY_TYPE_USER}")
+ @gitolite_deploy_keys = @user.gitolite_public_keys.all(:order => 'title ASC, created_at ASC', :conditions => "active=1 && key_type=#{GitolitePublicKey::KEY_TYPE_DEPLOY}")
+ @gitolite_public_keys = @gitolite_user_keys + @gitolite_deploy_keys
@gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
if @gitolite_public_key.nil?
if params[:public_key_id]
# public_key specified that doesn't belong to @user. Kill off public_key_id and try again
- redirect_to :public_key_id => nil, :tab => params[:tab]
+ redirect_to :public_key_id => nil, :tab => nil
return
else
@gitolite_public_key = GitolitePublicKey.new
@@ -74,10 +76,11 @@ def set_public_key_values
end
end
-
def self.included(base)
base.class_eval do
unloadable
+
+ helper :gitolite_public_keys
end
# Edit adds new functionality, so don't silently fail!
base.send(:alias_method_chain, :edit, :public_keys)
From f0884bdd5f6c7e3fa53da0fa19cfbd7e85fa8263 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Fri, 17 Aug 2012 14:48:39 -0700
Subject: [PATCH 062/107] Fix formatting on "my account" page to match more
recent changes.
---
app/views/my/account.html.erb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index e4b58c702..f65083e19 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -6,7 +6,10 @@
<%= error_messages_for 'user' %>
From 7f766a254f6219b257c71656b39161c8fc29f04a Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Sun, 19 Aug 2012 12:48:03 -0700
Subject: [PATCH 063/107] Validate global uniqueness of public keys.
---
app/helpers/gitolite_public_keys_helper.rb | 12 ++
app/models/gitolite_public_key.rb | 131 +++++++++++++++++++--
config/locales/bg.yml | 9 ++
config/locales/bs.yml | 9 ++
config/locales/ca.yml | 9 ++
config/locales/cs.yml | 9 ++
config/locales/da.yml | 9 ++
config/locales/de.yml | 9 ++
config/locales/el.yml | 9 ++
config/locales/en.yml | 9 ++
config/locales/es.yml | 9 ++
config/locales/fi.yml | 9 ++
config/locales/fr.yml | 9 ++
config/locales/gl.yml | 9 ++
config/locales/he.yml | 9 ++
config/locales/hu.yml | 9 ++
config/locales/id.yml | 9 ++
config/locales/it.yml | 9 ++
config/locales/ja.yml | 9 ++
config/locales/ko.yml | 9 ++
config/locales/lt.yml | 9 ++
config/locales/nl.yml | 9 ++
config/locales/no.yml | 9 ++
config/locales/pl.yml | 9 ++
config/locales/pt-BR.yml | 9 ++
config/locales/pt.yml | 9 ++
config/locales/ro.yml | 9 ++
config/locales/ru.yml | 9 ++
config/locales/sk.yml | 9 ++
config/locales/sl.yml | 9 ++
config/locales/sr.yml | 9 ++
config/locales/sv.yml | 9 ++
config/locales/th.yml | 9 ++
config/locales/tr.yml | 9 ++
config/locales/uk.yml | 9 ++
config/locales/vi.yml | 9 ++
config/locales/zh-TW.yml | 9 ++
config/locales/zh.yml | 9 ++
38 files changed, 454 insertions(+), 13 deletions(-)
diff --git a/app/helpers/gitolite_public_keys_helper.rb b/app/helpers/gitolite_public_keys_helper.rb
index e50482a3b..6b6e29531 100644
--- a/app/helpers/gitolite_public_keys_helper.rb
+++ b/app/helpers/gitolite_public_keys_helper.rb
@@ -21,4 +21,16 @@ def keylabel_text(key)
"#{key.user.login}@#{key.title}"
end
end
+
+ def wrap_and_join(in_array,my_or="or")
+ my_array = in_array.map{|x| "\"#{x}\""}
+ length = my_array.length
+ return my_array if length < 2
+ my_array[length-1] = my_or+" "+my_array[length-1]
+ if length == 2
+ my_array.join(' ')
+ else
+ my_array.join(', ')
+ end
+ end
end
diff --git a/app/models/gitolite_public_key.rb b/app/models/gitolite_public_key.rb
index 2de728ad9..3b6457eac 100755
--- a/app/models/gitolite_public_key.rb
+++ b/app/models/gitolite_public_key.rb
@@ -1,3 +1,6 @@
+require 'base64'
+include GitolitePublicKeysHelper
+
class GitolitePublicKey < ActiveRecord::Base
STATUS_ACTIVE = 1
STATUS_LOCKED = 0
@@ -7,6 +10,10 @@ class GitolitePublicKey < ActiveRecord::Base
DEPLOY_PSEUDO_USER = "_deploy_key_"
+ # These two constants are related -- don't change one without the other
+ KEY_FORMATS = ['ssh-rsa', 'ssh-dss']
+ KEY_NUM_COMPONENTS = [3,5]
+
belongs_to :user
validates_uniqueness_of :title, :scope => :user_id
validates_uniqueness_of :identifier, :scope => :user_id
@@ -23,18 +30,12 @@ def validate_associated_records_for_deployment_credentials() end
validate :has_not_been_changed
validates_inclusion_of :key_type, :in => [KEY_TYPE_USER, KEY_TYPE_DEPLOY]
+ validate :key_format_and_uniqueness
before_validation :set_identifier
+ before_validation :strip_whitespace
before_validation :remove_control_characters
- def has_not_been_changed
- unless new_record?
- %w(identifier key user_id key_type).each do |attribute|
- errors.add(attribute, 'may not be changed') unless changes[attribute].blank?
- end
- end
- end
-
def set_identifier
self.identifier ||=
begin
@@ -81,11 +82,6 @@ def reset_identifier
self.identifier
end
- # Remove control characters from key
- def remove_control_characters
- self.key=key.gsub(/[\a\r\n\t]/,'')
- end
-
def to_s ; title ; end
@@myregular = /^redmine_(.*)_\d*_\d*(.pub)?$/
@@ -97,4 +93,113 @@ def self.ident_to_user_token(identifier)
def self.user_to_user_token(user)
user.login.underscore.gsub(/[^0-9a-zA-Z\-]/,'_')
end
+
+ protected
+
+ # Strip leading and trailing whitespace
+ def strip_whitespace
+ self.title = title.strip
+ self.key = key.strip
+ end
+
+ # Remove control characters from key
+ def remove_control_characters
+ # First -- let the first control char or space stand (to divide key type from key)
+ # Really, this is catching a special case in which there is a \n between type and key.
+ # Most common case turns first space back into space....
+ self.key=key.sub(/[ \r\n\t]/,' ')
+
+ # Next, if comment divided from key by control char, let that one stand as well
+ # We can only tell this if there is an "=" in the key. So, won't help 1/3 times.
+ self.key=key.sub(/=[ \r\n\t]/,'= ')
+
+ # Delete any remaining control characters....
+ self.key=key.gsub(/[\a\r\n\t]/,'').strip
+ end
+
+ def has_not_been_changed
+ unless new_record?
+ %w(identifier key user_id key_type).each do |attribute|
+ errors.add(attribute, 'may not be changed') unless changes[attribute].blank?
+ end
+ end
+ end
+
+ def key_format_and_uniqueness
+ return if key.blank? || !new_record?
+
+ # First, check that key crypto type is present and of correct form. Also, decode base64 and see if key
+ # crypto type matches. Note that we ignore presence of comment!
+ keypieces = key.match(/^(\S+)\s+(\S+)/)
+ if !keypieces || keypieces[1].length > 10 # Probably has key as first component
+ errors.add(:key,l(:error_key_needs_two_components))
+ return
+ end
+
+ if !(KEY_FORMATS.index(keypieces[1]))
+ errors.add(:key,l(:error_key_bad_type,:types=>wrap_and_join(KEY_FORMATS,l(:word_or))))
+ return
+ end
+
+ # Make sure that key has proper number of characters (divisible by 4) and no more than 2 '='
+ if (keypieces[2].length % 4) != 0 || !(keypieces[2].match(/^[a-zA-Z0-9\+\/]+={0,2}$/))
+ Rails.logger.error "Key error: #{keypieces[2].length % 4}"
+ errors.add(:key,l(:error_key_corrupted))
+ return
+ end
+
+ deckey = Base64.decode64(keypieces[2])
+ piecearray=[]
+ while deckey.length >= 4
+ length = 0
+ deckey.slice!(0..3).bytes do |byte|
+ length = length * 256 + byte
+ end
+ if deckey.length < length
+ errors.add(:key,l(:error_key_corrupted))
+ return
+ end
+ piecearray << deckey.slice!(0..length-1)
+ end
+ if deckey.length != 0
+ errors.add(:key,l(:error_key_corrupted))
+ return
+ end
+
+ if piecearray[0] != keypieces[1]
+ errors.add(:key,l(:error_key_type_mismatch,:type1=>keypieces[1],:type2=>piecearray[0]))
+ return
+ end
+
+ if piecearray.length != KEY_NUM_COMPONENTS[KEY_FORMATS.index(piecearray[0])]
+ errors.add(:key,l(:error_key_corrupted))
+ return
+ end
+
+
+ # First version of uniqueness check -- simply check all keys...
+
+ # Check against the gitolite administrator key file (owned by noone).
+ allkeys = [GitolitePublicKey.new({ :user=>nil, :key=>%x[cat '#{Setting.plugin_redmine_git_hosting['gitoliteIdentityPublicKeyFile']}'] })]
+ # Check all active keys
+ allkeys += (GitolitePublicKey.active.all)
+
+ allkeys.each do |existingkey|
+ existingpieces = existingkey.key.match(/^(\S+)\s+(\S+)/)
+ if existingpieces && (existingpieces[2] == keypieces[2])
+ # Hm.... have a duplicate key!
+ if existingkey.user == User.current
+ errors.add(:key,l(:error_key_in_use_by_you,:name=>existingkey.title))
+ elsif User.current.admin?
+ if existingkey.user
+ errors.add(:key,l(:error_key_in_use_by_other,:login=>existingkey.user.login,:name=>existingkey.title))
+ else
+ errors.add(:key,l(:error_key_in_use_by_admin))
+ end
+ else
+ errors.add(:key,l(:error_key_in_use_by_someone))
+ end
+ end
+ end
+ end
end
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 72b772751..d62a2872f 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -81,6 +81,15 @@ bg:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index acb112115..edbfc9016 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -81,6 +81,15 @@ bs:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 3675b3f32..5be176a96 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -81,6 +81,15 @@ ca:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 57b8e66ba..3e6ee5afa 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -81,6 +81,15 @@ cs:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 9fe0a79f2..e615c4ebe 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -81,6 +81,15 @@ da:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 55cbc2d64..fec8dccea 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -81,6 +81,15 @@ de:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/el.yml b/config/locales/el.yml
index d525128b1..0e9fa6c40 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -81,6 +81,15 @@ el:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 368b9b327..8b069ae81 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -81,6 +81,15 @@ en:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 0d64f8331..069431f15 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -81,6 +81,15 @@ es:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index e4b50c459..64986bb6e 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -81,6 +81,15 @@ fi:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index bc0a2849a..7573ff07e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -81,6 +81,15 @@ fr:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 10eae6611..7484e58d5 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -81,6 +81,15 @@ gl:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 66ece3a8e..1f296dcb6 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -81,6 +81,15 @@ he:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 73fe1aa3b..b1181dc62 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -81,6 +81,15 @@
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/id.yml b/config/locales/id.yml
index 7033e1721..fd8df3976 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -81,6 +81,15 @@ id:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/it.yml b/config/locales/it.yml
index aabcbecad..7167c17e3 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -81,6 +81,15 @@ it:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index b978f96ef..b3b436804 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -81,6 +81,15 @@ ja:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 3db715414..1e24f4faf 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -81,6 +81,15 @@ ko:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index c91b0e9cf..426485d67 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -81,6 +81,15 @@ lt:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 0b9f633e2..5043c0971 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -81,6 +81,15 @@ nl:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 97b4a9062..d13f16f69 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -81,6 +81,15 @@
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 45085fa2d..377d0a852 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -81,6 +81,15 @@ pl:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 520a23764..128679ec3 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -79,6 +79,15 @@ pt-BR:
error_public_key_create_failed: 'Não Conseguiu Criar Chave Pública'
error_public_key_update_failed: 'Não Conseguiu Atualizar Chave Pública'
label_key_cannot_be_changed_please_create_new_key: 'A chave já não pode ser alterada. No entanto, pode excluí-lo e criar uma nova.'
+ error_key_corrupted: parece ser corrompido.
+ error_key_needs_two_components: 'precisa de pelo menos dois componentes: a tecla [tipo] e [valor-chave].'
+ error_key_bad_type: 'tem um tipo ruim. Os tipos válidos são %{types}.'
+ word_or: ou
+ error_key_type_mismatch: tipo (%{type1}) não corresponde ao tipo dentro do corpo da chave (%{type2}).
+ error_key_in_use_by_you: 'já está em uso por você como "%{name}".'
+ error_key_in_use_by_other: 'já está em uso por "%{login}" usuário como "%{name}".'
+ error_key_in_use_by_admin: 'já está em uso como a chave administrador gitolite.'
+ error_key_in_use_by_someone: 'já está em uso. Ela pertence a outro usuário (perguntar ao administrador para detalhes).'
activerecord:
errors:
messages:
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 2361afcbc..2c564336c 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -79,6 +79,15 @@ pt:
error_public_key_create_failed: 'Não Conseguiu Criar Chave Pública'
error_public_key_update_failed: 'Não Conseguiu Atualizar Chave Pública'
label_key_cannot_be_changed_please_create_new_key: 'A chave já não pode ser alterada. No entanto, pode excluí-lo e criar uma nova.'
+ error_key_corrupted: parece ser corrompido.
+ error_key_needs_two_components: 'precisa de pelo menos dois componentes: a tecla [tipo] e [valor-chave].'
+ error_key_bad_type: 'tem um tipo ruim. Os tipos válidos são %{types}.'
+ word_or: ou
+ error_key_type_mismatch: tipo (%{type1}) não corresponde ao tipo dentro do corpo da chave (%{type2}).
+ error_key_in_use_by_you: 'já está em uso por você como "%{name}".'
+ error_key_in_use_by_other: 'já está em uso por "%{login}" usuário como "%{name}".'
+ error_key_in_use_by_admin: 'já está em uso como a chave administrador gitolite.'
+ error_key_in_use_by_someone: 'já está em uso. Ela pertence a outro usuário (perguntar ao administrador para detalhes).'
activerecord:
errors:
messages:
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index ea8d13ec0..ea20b6076 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -81,6 +81,15 @@ ro:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 22cc8f614..fd0d538f0 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -81,6 +81,15 @@ ru:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index bcfea1cfe..2166dddd8 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -81,6 +81,15 @@ sk:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index ef3716b74..862d43743 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -81,6 +81,15 @@ sl:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 058101a22..ef8dd9d17 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -81,6 +81,15 @@ sr:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index b5f529517..fb331d1f4 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -81,6 +81,15 @@ sv:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/th.yml b/config/locales/th.yml
index ac5bf7b90..eb06ed302 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -81,6 +81,15 @@ th:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index 93b237ecc..6762b1be3 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -81,6 +81,15 @@ tr:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 37b654927..1e3a58642 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -81,6 +81,15 @@ uk:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index c9610a808..14443e0e4 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -81,6 +81,15 @@ vi:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 91897c6e2..e16e54dca 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -81,6 +81,15 @@
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 0e1492b1e..eeb2aea6e 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -81,6 +81,15 @@ zh:
error_public_key_create_failed: Failed to create public key.
error_public_key_update_failed: Failed to update public key.
label_key_cannot_be_changed_please_create_new_key: 'The key cannot be altered anymore. However, you can delete it and create a new one.'
+ error_key_corrupted: seems to be corrupted.
+ error_key_needs_two_components: 'needs at least two components: [key-type] and [key-value].'
+ error_key_bad_type: 'has a bad type. Valid types are %{types}.'
+ word_or: or
+ error_key_type_mismatch: type (%{type1}) does not match type within body of key (%{type2}).
+ error_key_in_use_by_you: 'is already in use by you as "%{name}".'
+ error_key_in_use_by_other: 'is already in use by user "%{login}" as "%{name}".'
+ error_key_in_use_by_admin: is already in use as the gitolite administrator key.
+ error_key_in_use_by_someone: is already in use. It belongs to another user (ask administrator for details).
activerecord:
errors:
messages:
From 44cec8ed0bf5d53dffc74ddbb68740b00e2d3bf0 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Mon, 20 Aug 2012 11:49:51 -0700
Subject: [PATCH 064/107] Relax public key validation for old (possibly
non-conforming) keys.
---
app/controllers/gitolite_public_keys_controller.rb | 5 ++++-
app/models/gitolite_public_key.rb | 9 ++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/app/controllers/gitolite_public_keys_controller.rb b/app/controllers/gitolite_public_keys_controller.rb
index 9ac3a501f..874122809 100644
--- a/app/controllers/gitolite_public_keys_controller.rb
+++ b/app/controllers/gitolite_public_keys_controller.rb
@@ -127,7 +127,10 @@ def find_gitolite_public_key
def destroy_key
@gitolite_public_key[:active] = 0
- @gitolite_public_key.save
+
+ # Since we are ultimately destroying this key, just force save (since old keys may fail new validations)
+ @gitolite_public_key.save((Rails::VERSION::STRING.split('.')[0].to_i > 2) ? { :validate => false } : false)
+
flash[:notice] = l(:notice_public_key_deleted, :title=>keylabel(@gitolite_public_key))
end
end
diff --git a/app/models/gitolite_public_key.rb b/app/models/gitolite_public_key.rb
index 3b6457eac..5e6919673 100755
--- a/app/models/gitolite_public_key.rb
+++ b/app/models/gitolite_public_key.rb
@@ -98,12 +98,18 @@ def self.user_to_user_token(user)
# Strip leading and trailing whitespace
def strip_whitespace
+ # Don't mess with existing keys (since cannot change key text anyway)
+ return if !new_record?
+
self.title = title.strip
self.key = key.strip
end
# Remove control characters from key
def remove_control_characters
+ # Don't mess with existing keys (since cannot change key text anyway)
+ return if !new_record?
+
# First -- let the first control char or space stand (to divide key type from key)
# Really, this is catching a special case in which there is a \n between type and key.
# Most common case turns first space back into space....
@@ -126,7 +132,7 @@ def has_not_been_changed
end
def key_format_and_uniqueness
- return if key.blank? || !new_record?
+ return if key.blank?
# First, check that key crypto type is present and of correct form. Also, decode base64 and see if key
# crypto type matches. Note that we ignore presence of comment!
@@ -185,6 +191,7 @@ def key_format_and_uniqueness
allkeys += (GitolitePublicKey.active.all)
allkeys.each do |existingkey|
+ next if existingkey.id == id
existingpieces = existingkey.key.match(/^(\S+)\s+(\S+)/)
if existingpieces && (existingpieces[2] == keypieces[2])
# Hm.... have a duplicate key!
From ec01acdfa8337ece2ffc6dfcca687b8eaef5b0b3 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Mon, 20 Aug 2012 16:02:10 -0700
Subject: [PATCH 065/107] Better handling of projects with a disabled
repository module.
We now treat this case exactly the same as an archived
project/repository. Before, it was handled inconsistently. Three
changes:
1) When a repository module is disabled/enabled through settings page
call update_repositories to update state. A disabling of the
repository module will call update_repositories with :archive.
2) Existing repositories will be left alone and marked with a dummy
redmine key of "redmine_disabled_project". Reenabling of the
repository module will restore project and keys to accessibility.
3) When removing redmine keys from a gitolite.conf entry, don't report
in the log unless removing real readmine keys. This avoids a weird
circumstance in which every fetch_changesets operation reports that
it is deleting redmine keys (caused when repo entry exists but the
"delete_repositories" flag is disabled at the time that the repo is
deleted. This fix is entirely about removing confusing messages
from the log.
---
lib/git_hosting.rb | 87 ++++++++++---------
.../patches/projects_controller_patch.rb | 16 ++++
lib/gitolite_conf.rb | 12 ++-
3 files changed, 75 insertions(+), 40 deletions(-)
diff --git a/lib/git_hosting.rb b/lib/git_hosting.rb
index f5b3d1bba..5ad3edf43 100755
--- a/lib/git_hosting.rb
+++ b/lib/git_hosting.rb
@@ -662,20 +662,20 @@ def self.update_repositories(*args)
args.each {|arg| flags.merge!(arg) if arg.is_a?(Hash)}
if flags[:resync_all]
logger.info "Executing RESYNC_ALL operation on gitolite configuration"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ projects = Project.active_or_archived.find(:all, :include => :repository)
elsif flags[:delete]
# When delete, want to recompute users, so need to go through all projects
logger.info "Executing DELETE operation (resync keys, remove dead repositories)"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ projects = Project.active_or_archived.find(:all, :include => :repository)
elsif flags[:archive]
# When archive, want to recompute users, so need to go through all projects
logger.info "Executing ARCHIVE operation (remove keys)"
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ projects = Project.active_or_archived.find(:all, :include => :repository)
elsif flags[:descendants]
if Project.method_defined?(:self_and_descendants)
projects = (args.flatten.select{|p| p.is_a?(Project)}).collect{|p| p.self_and_descendants}.flatten
else
- projects = Project.active_or_archived.has_module(:repository).find(:all, :include => :repository)
+ projects = Project.active_or_archived.find(:all, :include => :repository)
end
else
projects = args.flatten.select{|p| p.is_a?(Project)}
@@ -719,7 +719,7 @@ def self.update_repositories(*args)
end
# Collect relevant users into hash with user as key and activity (in some active project) as value
- (git_projects.select{|proj| proj.active?}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq << GitolitePublicKey::DEPLOY_PSEUDO_USER).each do |cur_user|
+ (git_projects.select{|proj| proj.active? && proj.module_enabled?(:repository)}.map{|proj| proj.member_principals.map(&:user).compact}.flatten.uniq << GitolitePublicKey::DEPLOY_PSEUDO_USER).each do |cur_user|
if cur_user == GitolitePublicKey::DEPLOY_PSEUDO_USER
active_keys = DeploymentCredential.active.select(&:honored?).map(&:gitolite_public_key).uniq
cur_token = cur_user
@@ -882,41 +882,47 @@ def self.update_repositories(*args)
# If this is an active (non-archived) project, then update gitolite entry. Add GIT_DAEMON_KEY.
if proj.active?
- # Get deployment keys (could be empty)
- write_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
- read_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:view_changesets) && !cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
-
- # fetch users
- users = proj.member_principals.map(&:user).compact.uniq
- write_users = users.select{ |user| user.allowed_to?( :commit_access, proj ) }
- read_users = users.select{ |user| user.allowed_to?( :view_changesets, proj ) && !user.allowed_to?( :commit_access, proj ) }
-
- read_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
- read_user_keys.push key.identifier
- end
- write_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
- write_user_keys.push key.identifier
- end
-
- #git daemon support
- if (proj.repository.extra.git_daemon == 1 || proj.repository.extra.git_daemon == nil ) && proj.is_public
- read_user_keys.push GitoliteConfig::GIT_DAEMON_KEY
- end
+ if proj.module_enabled?(:repository)
+ # Get deployment keys (could be empty)
+ write_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
+ read_user_keys = myrepo.deployment_credentials.active.select{|cred| cred.honored? && cred.allowed_to?(:view_changesets) && !cred.allowed_to?(:commit_access)}.map{|x| x.gitolite_public_key.identifier}
+
+ # fetch users
+ users = proj.member_principals.map(&:user).compact.uniq
+ write_users = users.select{ |user| user.allowed_to?( :commit_access, proj ) }
+ read_users = users.select{ |user| user.allowed_to?( :view_changesets, proj ) && !user.allowed_to?( :commit_access, proj ) }
+
+ read_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
+ read_user_keys.push key.identifier
+ end
+ write_users.map{|u| u.gitolite_public_keys.active.user_key}.flatten.compact.uniq.each do |key|
+ write_user_keys.push key.identifier
+ end
- # Remove previous redmine keys, then add new keys
- # By doing things this way, we leave non-redmine keys alone
- # Note -- delete_redmine_keys() will also remove the GIT_DAEMON_KEY for repos with redmine keys
- # (to be put back as above, when appropriate).
- conf.delete_redmine_keys repo_name
- conf.add_read_user repo_name, read_user_keys.uniq
- conf.add_write_user repo_name, write_user_keys.uniq
+ #git daemon support
+ if (proj.repository.extra.git_daemon == 1 || proj.repository.extra.git_daemon == nil ) && proj.is_public
+ read_user_keys.push GitoliteConfig::GIT_DAEMON_KEY
+ end
- # If no redmine keys, mark with dummy key
- if (read_user_keys+write_user_keys).empty?
- conf.mark_with_dummy_key repo_name
+ # Remove previous redmine keys, then add new keys
+ # By doing things this way, we leave non-redmine keys alone
+ # Note -- delete_redmine_keys() will also remove the GIT_DAEMON_KEY for repos with redmine keys
+ # (to be put back as above, when appropriate).
+ conf.delete_redmine_keys repo_name
+ conf.add_read_user repo_name, read_user_keys.uniq
+ conf.add_write_user repo_name, write_user_keys.uniq
+
+ # If no redmine keys, mark with dummy key
+ if (read_user_keys+write_user_keys).empty?
+ conf.mark_with_dummy_key repo_name
+ end
+ else
+ # Must be a project that has repositories disabled. Mark as disabled project.
+ conf.delete_redmine_keys repo_name
+ conf.mark_disabled repo_name
end
else
- # Must be an archived project! Clear out redmine keys. Mark as an archived project.
+ # Must be an archived project! Clear out redmine keys. Mark as an archived project.
conf.delete_redmine_keys repo_name
conf.mark_archived repo_name
end
@@ -938,20 +944,23 @@ def self.update_repositories(*args)
redmine_repos.delete_if{|basename,values| proj_ids.index(basename)}
end
redmine_repos.values.flatten.each do |repo_name|
- # First, delete redmine keys for this repository
+ # First, check if there are any redmine keys other than the DUMMY or ARCHIVED key
+ has_keys = conf.has_actual_redmine_keys? repo_name
+
+ # Next, delete redmine keys for this repository
conf.delete_redmine_keys repo_name
if (Setting.plugin_redmine_git_hosting['deleteGitRepositories'] == "true")
if conf.repo_has_no_keys? repo_name
logger.warn "Deleting #{orphanString}entry '#{repo_name}' from #{gitolite_conf}"
conf.delete_repo repo_name
GitoliteRecycle.move_repository_to_recycle repo_name
- else
+ elsif has_keys # Something changed when we deleted keys
logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in #{gitolite_conf}"
if git_repository_exists? repo_name
logger.info " Not removing #{repo_name}.git from gitolite repository, because non-redmine keys remain."
end
end
- else
+ elsif has_keys # Something changed when we deleted keys
logger.info "Deleting redmine keys from #{orphanString}entry '#{repo_name}' in #{gitolite_conf}"
end
end
diff --git a/lib/git_hosting/patches/projects_controller_patch.rb b/lib/git_hosting/patches/projects_controller_patch.rb
index 6228635b8..798fb48fa 100644
--- a/lib/git_hosting/patches/projects_controller_patch.rb
+++ b/lib/git_hosting/patches/projects_controller_patch.rb
@@ -108,6 +108,21 @@ def unarchive_with_disable_update
GitHostingObserver.set_update_active(@project);
end
+ def settings_with_disable_update
+ # Turn of updates during repository update
+ GitHostingObserver.set_update_active(false);
+
+ # Do actual update
+ settings_without_disable_update
+
+ # Reenable updates to perform a single update
+ if @project.module_enabled?(:repository)
+ GitHostingObserver.set_update_active(@project);
+ else
+ GitHostingObserver.set_update_active(:archive);
+ end
+ end
+
def self.included(base)
base.class_eval do
unloadable
@@ -117,6 +132,7 @@ def self.included(base)
base.send(:alias_method_chain, :destroy, :disable_update)
base.send(:alias_method_chain, :archive, :disable_update)
base.send(:alias_method_chain, :unarchive, :disable_update)
+ base.send(:alias_method_chain, :settings, :disable_update)
end
end
end
diff --git a/lib/gitolite_conf.rb b/lib/gitolite_conf.rb
index fc38a0b24..f15c85457 100755
--- a/lib/gitolite_conf.rb
+++ b/lib/gitolite_conf.rb
@@ -2,6 +2,7 @@ module GitHosting
class GitoliteConfig
DUMMY_REDMINE_KEY="redmine_dummy_key"
ARCHIVED_REDMINE_KEY="redmine_archived_project"
+ DISABLED_REDMINE_KEY="redmine_disabled_project"
GIT_DAEMON_KEY="daemon"
ADMIN_REPO = "gitolite-admin"
PRIMARY_CONF_FILE = "gitolite.conf"
@@ -64,6 +65,10 @@ def mark_archived repo_name
add_read_user repo_name, [ARCHIVED_REDMINE_KEY]
end
+ def mark_disabled repo_name
+ add_read_user repo_name, [DISABLED_REDMINE_KEY]
+ end
+
# Grab admin key (assuming it exists)
def get_admin_key
return (repository(ADMIN_REPO).get "RW+").first
@@ -91,6 +96,11 @@ def is_redmine_repo? repo_name
repository(repo_name).rights.detect {|perm, users| users.detect {|key| is_redmine_key? key}} || (repo_has_no_keys? repo_name)
end
+ # Return true if repository has any redmine keys other than the DUMMY_REDMINE_KEY
+ def has_actual_redmine_keys? repo_name
+ repository(repo_name).rights.detect {|perm, users| users.detect {|key| GitolitePublicKey::ident_to_user_token(key)}}
+ end
+
# Delete all of the redmine keys from a repository
# In addition, if there are any redmine keys, delete the GIT_DAEMON_KEY as well,
# since we assume this under control of redmine server.
@@ -107,7 +117,7 @@ def repo_has_no_keys? repo_name
end
def is_redmine_key? keyname
- (GitolitePublicKey::ident_to_user_token(keyname) || keyname == DUMMY_REDMINE_KEY || keyname == ARCHIVED_REDMINE_KEY) ? true : false
+ (GitolitePublicKey::ident_to_user_token(keyname) || keyname == DUMMY_REDMINE_KEY || keyname == ARCHIVED_REDMINE_KEY || keyname == DISABLED_REDMINE_KEY) ? true : false
end
def is_daemon_key? keyname
From 07762126d456a5bdb9236b6d98a44775a334c2f9 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Wed, 22 Aug 2012 17:50:33 -0700
Subject: [PATCH 066/107] Remove excess whitespace before validation.
---
app/models/gitolite_public_key.rb | 9 +++++----
app/models/repository_mirror.rb | 8 ++++++++
app/models/repository_post_receive_url.rb | 11 ++++++++++-
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/app/models/gitolite_public_key.rb b/app/models/gitolite_public_key.rb
index 5e6919673..1bcd286fd 100755
--- a/app/models/gitolite_public_key.rb
+++ b/app/models/gitolite_public_key.rb
@@ -98,11 +98,12 @@ def self.user_to_user_token(user)
# Strip leading and trailing whitespace
def strip_whitespace
- # Don't mess with existing keys (since cannot change key text anyway)
- return if !new_record?
-
self.title = title.strip
- self.key = key.strip
+
+ # Don't mess with existing keys (since cannot change key text anyway)
+ if new_record?
+ self.key = key.strip
+ end
end
# Remove control characters from key
diff --git a/app/models/repository_mirror.rb b/app/models/repository_mirror.rb
index 4bd6e4e94..0fd03834f 100644
--- a/app/models/repository_mirror.rb
+++ b/app/models/repository_mirror.rb
@@ -16,6 +16,8 @@ class RepositoryMirror < ActiveRecord::Base
validate :check_refspec
+ before_validation :strip_whitespace
+
named_scope :active, {:conditions => {:active => RepositoryMirror::STATUS_ACTIVE}}
named_scope :inactive, {:conditions => {:active => RepositoryMirror::STATUS_INACTIVE}}
@@ -77,6 +79,12 @@ def to_s
protected
+ # Strip leading and trailing whitespace
+ def strip_whitespace
+ self.url = url.strip
+ self.explicit_refspec = explicit_refspec.strip
+ end
+
# Put backquote in front of crucial characters
def dequote(in_string)
in_string.gsub(/[$,"\\\n]/) {|x| "\\"+x}
diff --git a/app/models/repository_post_receive_url.rb b/app/models/repository_post_receive_url.rb
index 620d1ec86..19d1ea3b1 100644
--- a/app/models/repository_post_receive_url.rb
+++ b/app/models/repository_post_receive_url.rb
@@ -7,10 +7,12 @@ class RepositoryPostReceiveUrl < ActiveRecord::Base
attr_accessible :url, :mode, :active
validates_uniqueness_of :url, :scope => [:project_id]
- validates_presence_of :project_id, :url
+ validates_presence_of :project_id
validates_format_of :url, :with => URI::regexp(%w(http https))
validates_associated :project
+ before_validation :strip_whitespace
+
named_scope :active, {:conditions => {:active => RepositoryPostReceiveUrl::STATUS_ACTIVE}}
named_scope :inactive, {:conditions => {:active => RepositoryPostReceiveUrl::STATUS_INACTIVE}}
@@ -25,4 +27,11 @@ def mode= (value)
def to_s
return File.join("#{project.identifier}-#{url}")
end
+
+ protected
+
+ # Strip leading and trailing whitespace
+ def strip_whitespace
+ self.url = url.strip
+ end
end
From 1c770d88f5a29772b24562a28c85f556afaf19db Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Wed, 22 Aug 2012 18:20:20 -0700
Subject: [PATCH 067/107] Formatting tweak: bigger key text box.
---
app/views/gitolite_public_keys/_view.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/gitolite_public_keys/_view.html.erb b/app/views/gitolite_public_keys/_view.html.erb
index dafe4d647..38fa83a00 100644
--- a/app/views/gitolite_public_keys/_view.html.erb
+++ b/app/views/gitolite_public_keys/_view.html.erb
@@ -66,7 +66,7 @@
<% end %>
<%= f.text_area :key, :label => (@new_key? :label_cut_and_paste : :field_public_key), :required => true, :disabled => !@new_key,
- :style => "width:99%;height:#{params[:id]?100:200}px;overflow:auto;",
+ :style => "width:99%;height:200px;overflow:auto;",
:cols => nil, :rows => nil %>
<%= hidden_field_tag :button_submit_field, "true" %>
<% if !@new_key%>
From 468ae9895f2b08ec7393e4ee7cd1c098aafcf893 Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Wed, 22 Aug 2012 18:23:20 -0700
Subject: [PATCH 068/107] Incremented redmine_git_hosting version from 0.4.5x
=> 0.4.6x
This is a feature release. It includes:
1) Post-Receive URLS
2) Updated Mirror Functionality
3) Deployment Credentials
4) Support for secondary gitolite configuration file
It also includes a series of bug fixes. See release notes at:
https://github.com/kubitron/redmine_git_hosting/wiki/_history
---
README.mkd | 52 ++++++++++++++++++++++++++++++++++++++--------------
init.rb | 2 +-
2 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/README.mkd b/README.mkd
index 160ca8aab..7d89b6e4b 100755
--- a/README.mkd
+++ b/README.mkd
@@ -1,4 +1,4 @@
-# Redmine Git Hosting Plugin (v0.4.5x)
+# Redmine Git Hosting Plugin (v0.4.6x)
A ChiliProject / Redmine plugin which makes configuring your own git hosting easy. This plugin allows straightforward management
of gitolite and associated public keys, the git daemon, and integrates code from Scott Schacon's "grack" utility
@@ -354,6 +354,43 @@ This command will install the new values in the database. You should follow up
parameter(s)). If you are moving the location of the *gitScriptDir*, you might want to remove the old scripts before executing 'restore_defaults'
as described above.
+## Deployment Credentials
+
+As of version 0.4.6x, this plugin provides deployment credentials on a per-repository basis. These credentials are combinations of a public key and access
+permissions (R or RW+) which are attached directly to a repository rather than by attaching users to repositories. Deployment credentials may be
+added to a repository through the repository settings interface. They may be added by anyone who is a manager for the project or by the administrator.
+
+Public keys used in this way are called "deploy keys". They are owned by the user who created them and may be edited on the user's public_key page (which is under
+"my account" for individual users). Since keys have unique names (per creator), they may be reused in multiple deployment credentials (in multiple repositories),
+simply by selecting them from the pulldown menu on the "deployment credentials create" dialog box.
+
+One typical use-case would be for all deploy keys to be owned by the administrator and attached selectively to various repositories. Note that the "deployment
+credentials create" dialog is actually a convenience dialog in that it allows the simultaneous creation of both a deploy key and deployment credential in a single step,
+even suggesting a name for the deployment credential, with the eye to deployments that have a separate deploy key for each repository. Reusing a deploy key in
+another credential is a simple matter of selecting the key from a drop-down menu.
+
+## Post-Receive URLs
+
+As of version 0.4.6x, this plugin supports the inclusion of GitHub-style Post-Receive URLs. Once added, a post-receive URL will be notified when new changes
+are pushed to the repository. Two versions of this functionality are available: (1) either a GitHub-style POST operation will include json-encoded information
+about the updated branch or (2) an empty GET request will be issued to the given URL. Post-Receive URLs may be added from the repository settings page.
+
+## Automatic Mirror Updates
+
+As of version 0.4.0, this plugin can automatically push updates to repository mirrors when new changes are pushed to the repository. Mirrors
+must grant access to the public key defined in the gitolite_admin_id_rsa.pub public key file, which is displayed for convenience in the
+repository settings tab.
+
+Note that 0.4.6x introduced the ability to selectively push branches to the mirror (using the git-push refspec mechanism) rather than mirroring all branches and tags.
+To utilize this feature, simply select a mirror update mode of "Force Update Remote" or "Fast Forward (unforced)" instead of the default "Complete Mirroring" in the
+mirror create/edit dialog. More options will then become available.
+
+
+## Notification to CIA.vc
+
+As of version 0.4.0, this plugin can notify CIA.vc when changes are pushed to the repository. The project identifier on CIA.vc must match the
+project identifier specified in ChiliProject/Redmine exactly
+
## "Smart" HTTP Functionality
@@ -429,19 +466,6 @@ max_allowed_packet=32M
The above example should allow **Max Cache Element Size** == 32M.
-## Notification to CIA.vc
-
-As of version 0.4.0, this plugin can notify CIA.vc when changes are pushed to the repository. The project identifier on CIA.vc must match the
-project identifier specified in ChiliProject/Redmine exactly
-
-
-## Automatic Mirror Updates
-
-As of version 0.4.0, this plugin can automatically push updates to repository mirrors when new changes are pushed to the repository. Mirrors
-must grant access to the public key defined in the gitolite_admin_id_rsa.pub public key file, which is displayed for convenience in the
-repository settings tab.
-
-
## Fast Deployment with YourChili Bash Library
Instead of installing/configuring by hand, one option for quickly deploying a fully-functional system for hosting
diff --git a/init.rb b/init.rb
index 838133f80..b9b6c902a 100755
--- a/init.rb
+++ b/init.rb
@@ -8,7 +8,7 @@
name 'Redmine Git Hosting Plugin'
author 'Eric Bishop, Pedro Algarvio, Christian Käser, Zsolt Parragi, Yunsang Choi, Joshua Hogendorn, Jan Schulz-Hofen, John Kubiatowicz and others'
description 'Enables Redmine / ChiliProject to control hosting of git repositories'
- version '0.4.5x'
+ version '0.4.6x'
url 'https://github.com/ericpaulbishop/redmine_git_hosting'
settings :default => {
From d512172064161524d18103e48002a5abfc28a07f Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Sun, 26 Aug 2012 14:25:48 -0700
Subject: [PATCH 069/107] Fixed non-standard condition that tripped-up SQLite3.
---
lib/git_hosting/patches/users_controller_patch.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/git_hosting/patches/users_controller_patch.rb b/lib/git_hosting/patches/users_controller_patch.rb
index c257584a9..cb5b9fe68 100644
--- a/lib/git_hosting/patches/users_controller_patch.rb
+++ b/lib/git_hosting/patches/users_controller_patch.rb
@@ -61,8 +61,8 @@ def edit_with_public_keys
# Add in values for viewing public keys:
def set_public_key_values
- @gitolite_user_keys = @user.gitolite_public_keys.all(:order => 'title ASC, created_at ASC', :conditions => "active=1 && key_type=#{GitolitePublicKey::KEY_TYPE_USER}")
- @gitolite_deploy_keys = @user.gitolite_public_keys.all(:order => 'title ASC, created_at ASC', :conditions => "active=1 && key_type=#{GitolitePublicKey::KEY_TYPE_DEPLOY}")
+ @gitolite_user_keys = @user.gitolite_public_keys.active.user_key.find(:all,:order => 'title ASC, created_at ASC')
+ @gitolite_deploy_keys = @user.gitolite_public_keys.active.deploy_key.find(:all,:order => 'title ASC, created_at ASC')
@gitolite_public_keys = @gitolite_user_keys + @gitolite_deploy_keys
@gitolite_public_key = @gitolite_public_keys.detect{|x| x.id == params[:public_key_id].to_i}
if @gitolite_public_key.nil?
From 82ac05226e03c1abf9fa867373e8f3bae1d3cd4b Mon Sep 17 00:00:00 2001
From: John Kubiatowicz
Date: Mon, 3 Sep 2012 22:37:29 -0700
Subject: [PATCH 070/107] First take at integration (basically works for 1
repo).
---
.../deployment_credentials_controller.rb | 43 +-
.../repository_mirrors_controller.rb | 41 +-
...repository_post_receive_urls_controller.rb | 41 +-
app/models/git_repository_extra.rb | 2 -
app/models/gitolite_public_key.rb | 2 +-
.../_view_list.html.erb | 111 +++++
.../projects/settings/_repository.html.erb | 444 +++---------------
app/views/repositories/_form.html.erb | 69 +++
.../repository_mirrors/_view_list.html.erb | 157 +++++++
.../_view_list.html.erb | 97 ++++
config/routes.rb | 34 +-
lib/git_hosting.rb | 15 +
lib/git_hosting/patches/git_adapter_patch.rb | 11 +-
.../patches/members_controller_patch.rb | 49 +-
.../patches/repositories_controller_patch.rb | 57 ++-
.../patches/roles_controller_patch.rb | 53 ++-
.../patches/users_controller_patch.rb | 11 +
17 files changed, 770 insertions(+), 467 deletions(-)
create mode 100644 app/views/deployment_credentials/_view_list.html.erb
create mode 100644 app/views/repositories/_form.html.erb
create mode 100644 app/views/repository_mirrors/_view_list.html.erb
create mode 100644 app/views/repository_post_receive_urls/_view_list.html.erb
diff --git a/app/controllers/deployment_credentials_controller.rb b/app/controllers/deployment_credentials_controller.rb
index 13dfc74dc..a94cc1951 100644
--- a/app/controllers/deployment_credentials_controller.rb
+++ b/app/controllers/deployment_credentials_controller.rb
@@ -2,8 +2,8 @@ class DeploymentCredentialsController < ApplicationController
before_filter :require_login
before_filter :set_user_variable
- before_filter :set_project_variable
before_filter :set_repository_variable
+ before_filter :set_project_variable
before_filter :can_create_credentials, :only => [:create, :create_with_key]
before_filter :can_edit_credentials, :only => [:edit, :update, :destroy]
@@ -74,11 +74,7 @@ def create_with_key
if @cred.valid? && @key.save && @cred.save
flash[:notice] = l(:notice_deployment_credential_added, :title=>keylabel(@key),:perm=>@cred[:perm])
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @project.id,
- :tab => 'repository')
-
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -114,11 +110,8 @@ def update
# Can only alter the permissions
if @cred.update_attributes(params[:deployment_credentials])
flash[:notice] = l(:notice_deployment_credential_updated, :title=>keylabel(@key),:perm=>@cred[:perm])
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @project.id,
- :tab => 'repository')
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -150,10 +143,6 @@ def destroy
# display confirmation view
else
GitHostingObserver.set_update_active(false);
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @project.id,
- :tab => 'repository')
if params[:confirm]
key = @cred.gitolite_public_key
@cred.destroy
@@ -166,6 +155,7 @@ def destroy
end
end
+ redirect_url = success_url
respond_to do |format|
format.html {redirect_to(redirect_url)}
end
@@ -178,6 +168,19 @@ def settings
protected
+ # This is a success URL to return to basic listing
+ def success_url
+ if GitHosting.multi_repos?
+ url_for(:controller => 'repositories',
+ :action => 'edit',
+ :id => @repository.id)
+ else
+ url_for(:controller => 'projects',
+ :action => 'settings',
+ :id => @project.id,
+ :tab => 'repository')
+ end
+ end
def can_view_credentials
render_403 unless GitHostingHelper.can_view_deployment_keys(@project)
@@ -195,16 +198,16 @@ def set_user_variable
@user = User.current
end
- def set_project_variable
- @project = Project.find_by_identifier(params[:project_id])
- if !@project
+ def set_repository_variable
+ @repository = Repository.find_by_id(params[:repository_id])
+ if !@repository
render_404
end
end
- def set_repository_variable
- @repository = @project.repository
- if !@repository
+ def set_project_variable
+ @project = @repository.project
+ if !@project
render_404
end
end
diff --git a/app/controllers/repository_mirrors_controller.rb b/app/controllers/repository_mirrors_controller.rb
index 439bd79a3..31d0a612b 100644
--- a/app/controllers/repository_mirrors_controller.rb
+++ b/app/controllers/repository_mirrors_controller.rb
@@ -3,6 +3,7 @@ class RepositoryMirrorsController < ApplicationController
before_filter :require_login
before_filter :set_user_variable
+ before_filter :set_repository_variable
before_filter :set_project_variable
before_filter :check_required_permissions
before_filter :check_xhr_request
@@ -26,11 +27,8 @@ def create
if @mirror.save
flash[:notice] = l(:mirror_notice_created)
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @mirror.project.identifier,
- :tab => 'repository')
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -61,11 +59,8 @@ def edit
def update
if @mirror.update_attributes(params[:repository_mirrors])
flash[:notice] = l(:mirror_notice_updated)
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @mirror.project.identifier,
- :tab => 'repository')
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -94,16 +89,13 @@ def destroy
if request.get?
# display confirmation view
else
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @mirror.project.identifier,
- :tab => 'repository')
if params[:confirm]
@mirror.destroy
flash[:notice] = l(:mirror_notice_deleted)
end
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to(redirect_url)
@@ -125,13 +117,36 @@ def push
protected
+ # This is a success URL to return to basic listing
+ def success_url
+ if GitHosting.multi_repos?
+ url_for(:controller => 'repositories',
+ :action => 'edit',
+ :id => @repository.id)
+ else
+ url_for(:controller => 'projects',
+ :action => 'settings',
+ :id => @project.id,
+ :tab => 'repository')
+ end
+ end
def set_user_variable
@user = User.current
end
+ def set_repository_variable
+ @repository = Repository.find_by_id(params[:repository_id])
+ if !@repository
+ render_404
+ end
+ end
+
def set_project_variable
- @project = Project.find_by_identifier(params[:project_id])
+ @project = @repository.project
+ if !@project
+ render_404
+ end
end
def find_repository_mirror
diff --git a/app/controllers/repository_post_receive_urls_controller.rb b/app/controllers/repository_post_receive_urls_controller.rb
index 631d86085..8044855e5 100644
--- a/app/controllers/repository_post_receive_urls_controller.rb
+++ b/app/controllers/repository_post_receive_urls_controller.rb
@@ -3,6 +3,7 @@ class RepositoryPostReceiveUrlsController < ApplicationController
before_filter :require_login
before_filter :set_user_variable
+ before_filter :set_repository_variable
before_filter :set_project_variable
before_filter :check_required_permissions
before_filter :check_xhr_request
@@ -26,11 +27,8 @@ def create
if @prurl.save
flash[:notice] = l(:post_receive_url_notice_created)
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @prurl.project.identifier,
- :tab => 'repository')
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -61,11 +59,8 @@ def edit
def update
if @prurl.update_attributes(params[:repository_post_receive_urls])
flash[:notice] = l(:post_receive_url_notice_updated)
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @prurl.project.identifier,
- :tab => 'repository')
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to redirect_url
@@ -94,16 +89,13 @@ def destroy
if request.get?
# display confirmation view
else
- redirect_url = url_for(:controller => 'projects',
- :action => 'settings',
- :id => @prurl.project.identifier,
- :tab => 'repository')
if params[:confirm]
@prurl.destroy
flash[:notice] = l(:post_receive_url_notice_deleted)
end
+ redirect_url = success_url
respond_to do |format|
format.html {
redirect_to(redirect_url)
@@ -117,13 +109,36 @@ def settings
protected
+ # This is a success URL to return to basic listing
+ def success_url
+ if GitHosting.multi_repos?
+ url_for(:controller => 'repositories',
+ :action => 'edit',
+ :id => @repository.id)
+ else
+ url_for(:controller => 'projects',
+ :action => 'settings',
+ :id => @project.id,
+ :tab => 'repository')
+ end
+ end
def set_user_variable
@user = User.current
end
+ def set_repository_variable
+ @repository = Repository.find_by_id(params[:repository_id])
+ if !@repository
+ render_404
+ end
+ end
+
def set_project_variable
- @project = Project.find_by_identifier(params[:project_id])
+ @project = @repository.project
+ if !@project
+ render_404
+ end
end
def find_repository_post_receive_url
diff --git a/app/models/git_repository_extra.rb b/app/models/git_repository_extra.rb
index f9ebe12d5..1495d1926 100755
--- a/app/models/git_repository_extra.rb
+++ b/app/models/git_repository_extra.rb
@@ -33,7 +33,6 @@ def validate_encoded_time(clear_time, encoded_time)
def generate
if self.key.nil?
write_attribute(:key, (0...64+rand(64) ).map{65.+(rand(25)).chr}.join )
- self.save
end
end
@@ -41,7 +40,6 @@ def setup_defaults
write_attribute(:git_http,Setting.plugin_redmine_git_hosting['gitHttpDefault']) if Setting.plugin_redmine_git_hosting['gitHttpDefault']
write_attribute(:git_daemon,Setting.plugin_redmine_git_hosting['gitDaemonDefault']) if Setting.plugin_redmine_git_hosting['gitDaemonDefault']
write_attribute(:notify_cia,Setting.plugin_redmine_git_hosting['gitNotifyCIADefault']) if Setting.plugin_redmine_git_hosting['gitNotifyCIADefault']
- self.save
end
end
diff --git a/app/models/gitolite_public_key.rb b/app/models/gitolite_public_key.rb
index 1bcd286fd..557a7783d 100755
--- a/app/models/gitolite_public_key.rb
+++ b/app/models/gitolite_public_key.rb
@@ -77,7 +77,7 @@ def reset_identifier
# Need to override the "never change identifier" constraint
# Note that Rails 3 has a different calling convention...
- self.save((Rails::VERSION::STRING.split('.')[0].to_i > 2) ? { :validate => false } : false)
+ self.save(GitHosting.rails_3? ? { :validate => false } : false)
self.identifier
end
diff --git a/app/views/deployment_credentials/_view_list.html.erb b/app/views/deployment_credentials/_view_list.html.erb
new file mode 100644
index 000000000..651be9ab8
--- /dev/null
+++ b/app/views/deployment_credentials/_view_list.html.erb
@@ -0,0 +1,111 @@
+
+
+ <% if GitHostingHelper.can_create_deployment_keys(@repository.project) %>
+