HTML · 4646 bytes Raw Blame History
1 {{ define "page" -}}
2 <div class="shithub-settings-page">
3 {{ template "repo-settings-nav" . }}
4 <div class="shithub-settings-content">
5 <h1>Access</h1>
6 {{ with .Notice }}<p class="shithub-flash shithub-flash-notice" role="status">{{ . }}</p>{{ end }}
7
8 <section class="shithub-settings-section">
9 <h2>Direct collaborators</h2>
10 <p class="shithub-hint">Users granted explicit access to this repository, in addition to the owner.</p>
11 {{ if .Collaborators }}
12 <table class="shithub-branches-table">
13 <thead>
14 <tr><th>User</th><th>Role</th><th>Added</th><th></th></tr>
15 </thead>
16 <tbody>
17 {{ range .Collaborators }}
18 <tr>
19 <td><a href="/{{ .Username }}">{{ .Username }}</a>{{ if .DisplayName }} <span class="shithub-fg-muted">{{ .DisplayName }}</span>{{ end }}</td>
20 <td>{{ .Role }}</td>
21 <td>{{ relativeTime .AddedAt.Time }}</td>
22 <td>
23 <form method="POST" action="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/access/collaborators/remove" style="display:inline">
24 <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
25 <input type="hidden" name="user_id" value="{{ .UserID }}">
26 <button type="submit" class="shithub-button shithub-button-danger">Remove</button>
27 </form>
28 </td>
29 </tr>
30 {{ end }}
31 </tbody>
32 </table>
33 {{ else }}
34 <p class="shithub-empty-note">No direct collaborators yet.</p>
35 {{ end }}
36
37 <h3>Add a collaborator</h3>
38 <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/access/collaborators">
39 <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
40 <label>Username <input type="text" name="username" required></label>
41 <label>Role
42 <select name="role">
43 <option value="read">Read</option>
44 <option value="triage">Triage</option>
45 <option value="write" selected>Write</option>
46 <option value="maintain">Maintain</option>
47 <option value="admin">Admin</option>
48 </select>
49 </label>
50 <button type="submit" class="shithub-button shithub-button-primary">Add</button>
51 </form>
52 </section>
53
54 {{ if .OwnerKindOrg }}
55 <section class="shithub-settings-section">
56 <h2>Team grants</h2>
57 <p class="shithub-hint">Teams from <a href="/{{ .Owner }}/teams">{{ .Owner }}</a> with access to this repo.</p>
58 {{ if .TeamGrants }}
59 <table class="shithub-branches-table">
60 <thead>
61 <tr><th>Team</th><th>Role</th><th>Granted</th><th></th></tr>
62 </thead>
63 <tbody>
64 {{ range .TeamGrants }}
65 <tr>
66 <td><a href="/{{ $.Owner }}/teams/{{ .TeamSlug }}">{{ .TeamDisplayName }}</a> <span class="shithub-fg-muted">@{{ .TeamSlug }}</span></td>
67 <td>{{ .Role }}</td>
68 <td>{{ relativeTime .AddedAt.Time }}</td>
69 <td>
70 <form method="POST" action="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/access/teams/revoke" style="display:inline">
71 <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
72 <input type="hidden" name="team_id" value="{{ .TeamID }}">
73 <button type="submit" class="shithub-button shithub-button-danger">Revoke</button>
74 </form>
75 </td>
76 </tr>
77 {{ end }}
78 </tbody>
79 </table>
80 {{ else }}
81 <p class="shithub-empty-note">No teams have been granted access yet.</p>
82 {{ end }}
83
84 {{ if .OrgTeams }}
85 <h3>Grant team access</h3>
86 <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/access/teams">
87 <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
88 <label>Team
89 <select name="team_id" required>
90 <option value="">— select a team —</option>
91 {{ range .OrgTeams }}<option value="{{ .ID }}">{{ .DisplayName }} (@{{ .Slug }})</option>{{ end }}
92 </select>
93 </label>
94 <label>Role
95 <select name="role">
96 <option value="read">Read</option>
97 <option value="triage">Triage</option>
98 <option value="write" selected>Write</option>
99 <option value="maintain">Maintain</option>
100 <option value="admin">Admin</option>
101 </select>
102 </label>
103 <button type="submit" class="shithub-button shithub-button-primary">Grant</button>
104 </form>
105 {{ end }}
106 </section>
107 {{ end }}
108 </div>
109 </div>
110 {{- end }}