Do not hide create participant button as admin

This commit is contained in:
Andrea Fazzi 2019-12-09 15:43:54 +01:00
parent 92a1f141a0
commit 39dfbad706
3 changed files with 8 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package orm
import (
"fmt"
"log"
"strconv"
"net/http"
@ -325,7 +326,7 @@ func (model *Participant) Update(args map[string]string, w http.ResponseWriter,
}
participant.(*Participant).UserModifierUpdate = NewUserModifierUpdate(r)
log.Println("Updater ID", participant.(*Participant).UpdaterID)
_, err = SaveParticipant(participant)
if err != nil {
return nil, err

View file

@ -1,7 +1,6 @@
package orm
import (
"log"
"net/http"
"github.com/dgrijalva/jwt-go"
@ -66,8 +65,6 @@ func NewUserModifierUpdate(r *http.Request) *UserModifierUpdate {
claims = r.Context().Value("user").(*jwt.Token).Claims.(jwt.MapClaims)
}
log.Println("Claims", claims)
return &UserModifierUpdate{
UpdaterID: claims["user_id"].(string),
UpdaterRole: claims["role"].(string),

View file

@ -11,9 +11,15 @@
{{$modelPath := ""}}
{{if $isAdmin}}
{{$modelPath = (create "Participant")}}
{{else}}
{{if $isSchool}}
{{if lt (len .Data) 2}}
{{$modelPath = (create "Participant")}}
{{end}}
{{end}}
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" $modelPath}}
{{template "search_input"}}