1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 03:36:16 +00:00

add 'reader' group

it is essentially the same as 'anon' but 'reader' is allowed to log in
if wiki is locked down.
This commit is contained in:
la-ninpre 2022-09-14 23:35:43 +03:00 committed by Timur Ismagilov
parent 97df77d158
commit fd6889cea3
3 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@
<div class="form-field">
<select id="group" name="group" aria-label="{{block "group" .}}Group{{end}}">
<option {{if .Form.Get "group" | eq "anon" }}selected{{end}}>anon</option>
<option {{if .Form.Get "group" | eq "reader" }}selected{{end}}>reader</option>
<option {{if .Form.Get "group" | eq "editor" }}selected{{end}}>editor</option>
<option {{if .Form.Get "group" | eq "trusted" }}selected{{end}}>trusted</option>
<option {{if .Form.Get "group" | eq "moderator" }}selected{{end}}>moderator</option>
@ -36,4 +37,4 @@
<p>{{block "delete user tip" .}}Remove the user from the database. Changes made by the user will be preserved. It will be possible to take this username later.{{end}}</p>
<a class="btn btn_destructive" href="/admin/users/{{.U.Name}}/delete">{{template "delete"}}</a>
</main>
{{end}}
{{end}}

View File

@ -25,6 +25,7 @@
<label for="group">{{block "group" .}}Group{{end}}:</label>
<select id="group" name="group">
<option {{if .Form.Get "group" | eq "anon" }}selected{{end}}>anon</option>
<option {{if .Form.Get "group" | eq "reader" }}selected{{end}}>reader</option>
<option {{if .Form.Get "group" | eq "editor" }}selected{{end}}>editor</option>
<option {{if .Form.Get "group" | eq "trusted" }}selected{{end}}>trusted</option>
<option {{if .Form.Get "group" | eq "moderator" }}selected{{end}}>moderator</option>
@ -40,4 +41,4 @@
</div>
</form>
</main>
{{end}}
{{end}}

View File

@ -48,6 +48,7 @@ var minimalRights = map[string]int{
var groups = []string{
"anon",
"reader",
"editor",
"trusted",
"moderator",
@ -57,6 +58,7 @@ var groups = []string{
// Group — Right level
var groupRight = map[string]int{
"anon": 0,
"reader": 0,
"editor": 1,
"trusted": 2,
"moderator": 3,