cf54502a10b16c985ea28db17885d377226b6145
bernd First draft of gitolite-mod...

bernd authored 12 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 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) 
bernd First draft of gitolite-mod...

bernd authored 12 years ago

17) require_role(ROLE_SYSTEMUSER);
18) 
19) include("git.php");
20) 
21) $section = 'git_git';
22) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

23) $repos = list_repos();
24) $users = list_users();
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

25) $foreign_users = list_foreign_users();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

26) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

27) $action = '';
28) $form = '';
29) 
bernd Bessere Handhabung öffentli...

bernd authored 12 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) 
bernd Fürs erste feature-complete

bernd authored 12 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']])) {
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

55)     $permissions = $repos[$_GET['repo']]['users'];
56)     if (isset($permissions[$user])) {
57)       switch ($permissions[$user]) {
bernd Fürs erste feature-complete

bernd authored 12 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)   }
bernd Setze Berechtigung für gitw...

bernd authored 12 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. &quot;rewind&quot;)</option></select></p>';
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 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. &quot;rewind&quot;)</option></select></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

85) }
bernd Setze Berechtigung für gitw...

bernd authored 12 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'] : '';
bernd Bessere Handhabung öffentli...

bernd authored 12 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>';
bernd Fürs erste feature-complete

bernd authored 12 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));