First draft of gitolite-mod...
bernd authored 13 years ago
|
1) <?php
|
Added license tags for CC0,...
Bernd Wurst authored 13 years ago
|
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4)
|
Lizenzinfos in eigenes Modu...
Bernd Wurst authored 11 years ago
|
5) Written 2008-2014 by schokokeks.org Hosting, namely
|
Added license tags for CC0,...
Bernd Wurst authored 13 years ago
|
6) Bernd Wurst <bernd@schokokeks.org>
7) Hanno Böck <hanno@schokokeks.org>
8)
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10)
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12) http://creativecommons.org/publicdomain/zero/1.0/
13)
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
16)
|
First draft of gitolite-mod...
bernd authored 13 years ago
|
17) require_role(ROLE_SYSTEMUSER);
18)
19) include("git.php");
20)
21) $section = 'git_git';
22)
|
Fürs erste feature-complete
bernd authored 13 years ago
|
23) $repos = list_repos();
24) $users = list_users();
|
add foreign git users and g...
Bernd Wurst authored 13 years ago
|
25) $foreign_users = list_foreign_users();
|
First draft of gitolite-mod...
bernd authored 13 years ago
|
26)
|
Fürs erste feature-complete
bernd authored 13 years ago
|
27) $action = '';
28) $form = '';
29)
|
Bessere Handhabung öffentli...
bernd authored 13 years ago
|
30) html_header("<script type=\"text/javascript\">
31) function showDescription( ) {
32) var do_it = (document.getElementById('gitweb').checked == false);
33) var inputfield = document.getElementById('description');
34) inputfield.disabled = do_it;
35) }
36) </script>
37) ");
38)
|
Fürs erste feature-complete
bernd authored 13 years ago
|
39) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
40) $action = 'editrepo';
41) title("Zugriff auf GIT-Repository ändern");
42) output("<p>Legen Sie hier fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
43) $form .= '<table><tr><td>Name des Repository</td><td><input type="hidden" name="repo" value="'.filter_input_general($_GET['repo']).'" />'.filter_input_general($_GET['repo']).'</td></tr>';
44) } else {
45) $action = 'newrepo';
46) title("Neues GIT-Repository anlegen");
47) output("<p>Geben Sie einen Namen für das neue Repository an und legen Sie fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
48) $form .= '<table><tr><td><label for="repo">Name des Repository</label></td><td><input type="text" id="repo" name="repo" /></td></tr>';
49) }
50)
51) $form .= '<tr><td>Berechtigungen</td><td>';
52) foreach ($users as $user) {
53) $r = $rw = $rwplus = '';
54) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
|
Setze Berechtigung für gitw...
bernd authored 13 years ago
|
55) $permissions = $repos[$_GET['repo']]['users'];
56) if (isset($permissions[$user])) {
57) switch ($permissions[$user]) {
|
Fürs erste feature-complete
bernd authored 13 years ago
|
58) case 'RW+': $rwplus = ' selected="selected"';
59) break;
60) case 'RW': $rw = ' selected="selected"';
61) break;
62) case 'R': $r = ' selected="selected"';
63) break;
64) }
65) }
66) }
|
Setze Berechtigung für gitw...
bernd authored 13 years ago
|
67) $form .= '<p>'.$user.': <select name="'.$user.'"><option value="-">Zugriff verweigern</option><option value="r"'.$r.'>Lesezugriff erlauben</option><option value="rw"'.$rw.'>Lese- und Schreibzugriff</option><option value="rwplus"'.$rwplus.'>erweiterter Lese- und Schreibzugriff (inkl. "rewind")</option></select></p>';
|
add foreign git users and g...
Bernd Wurst authored 13 years ago
|
68) }
69) foreach ($foreign_users as $user) {
70) $r = $rw = $rwplus = '';
71) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
72) $permissions = $repos[$_GET['repo']]['users'];
73) if (isset($permissions[$user])) {
74) switch ($permissions[$user]) {
75) case 'RW+': $rwplus = ' selected="selected"';
76) break;
77) case 'RW': $rw = ' selected="selected"';
78) break;
79) case 'R': $r = ' selected="selected"';
80) break;
81) }
82) }
83) }
84) $form .= '<p>'.$user.': <select name="'.$user.'"><option value="-">Zugriff verweigern</option><option value="r"'.$r.'>Lesezugriff erlauben</option><option value="rw"'.$rw.'>Lese- und Schreibzugriff</option><option value="rwplus"'.$rwplus.'>erweiterter Lese- und Schreibzugriff (inkl. "rewind")</option></select></p>';
|
Fürs erste feature-complete
bernd authored 13 years ago
|
85) }
|
Setze Berechtigung für gitw...
bernd authored 13 years ago
|
86) $checked = (isset($_GET['repo']) && isset($repos[$_GET['repo']]) && isset($repos[$_GET['repo']]['users']['gitweb']) && $repos[$_GET['repo']]['users']['gitweb'] == 'R') ? ' checked="checked"' : '';
87) $description = (isset($_GET['repo']) && isset($repos[$_GET['repo']])) ? $repos[$_GET['repo']]['description'] : '';
|
Bessere Handhabung öffentli...
bernd authored 13 years ago
|
88) $disabled = $checked ? '' : ' disabled="disabled"';
89) $form .= '<p><input type="checkbox" name="gitweb" id="gitweb" value="r"'.$checked.' onclick="showDescription()" /> <label for="gitweb">Öffentlicher Lesezugriff via gitweb</label><br />
90) <label for="description">Beschreibung des Repository:</label> <input type="text" name="description" id="description" value="'.$description.'"'.$disabled.' /></p>';
|
Fürs erste feature-complete
bernd authored 13 years ago
|
91) $form .= '</td></tr></table>';
92) $form .= '<p><input type="submit" value="Speichern" /></p>';
93)
94) output(html_form('git_edit', 'save', 'action='.$action, $form));
|