ff794853e40a108bce1c456e2f6ad0702b3fb655
bernd First draft of gitolite-mod...

bernd authored 12 years ago

1) <?php
2) require_role(ROLE_SYSTEMUSER);
3) 
4) include("git.php");
5) 
6) $section = 'git_git';
7) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

8) $repos = list_repos();
9) $users = list_users();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

10) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

11) $action = '';
12) $form = '';
13) 
14) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
15)   $action = 'editrepo';
16)   title("Zugriff auf GIT-Repository ändern");
17)   output("<p>Legen Sie hier fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
18)   $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>';
19) } else {
20)   $action = 'newrepo';
21)   title("Neues GIT-Repository anlegen");
22)   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>");
23)   $form .= '<table><tr><td><label for="repo">Name des Repository</label></td><td><input type="text" id="repo" name="repo" /></td></tr>';
24) }
25) 
26) $form .= '<tr><td>Berechtigungen</td><td>';
27) foreach ($users as $user) {
28)   $r = $rw = $rwplus = '';
29)   if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

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

bernd authored 12 years ago

33)         case 'RW+': $rwplus = ' selected="selected"';
34)                     break;
35)         case 'RW': $rw = ' selected="selected"';
36)                    break;
37)         case 'R': $r = ' selected="selected"';
38)                   break;
39)       }
40)     }
41)   }
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

42)   $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

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

bernd authored 12 years ago

44) $checked = (isset($_GET['repo']) && isset($repos[$_GET['repo']]) && isset($repos[$_GET['repo']]['users']['gitweb']) && $repos[$_GET['repo']]['users']['gitweb'] == 'R') ? ' checked="checked"' : '';
45) $description = (isset($_GET['repo']) && isset($repos[$_GET['repo']])) ? $repos[$_GET['repo']]['description'] : '';
46) $form .= '<p><input type="checkbox" name="gitweb" id="gitweb" value="r"'.$checked.' /> <label for="gitweb">Öffentlicher Lesezugriff via gitweb</label><br />
47) <label for="description">Beschreibung des Repository:</label> <input type="text" name="description" id="description" value="'.$description.'" /></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

48) $form .= '</td></tr></table>';
49) $form .= '<p><input type="submit" value="Speichern" /></p>';
50) 
51) output(html_form('git_edit', 'save', 'action='.$action, $form));