Do not hide create participant button as admin
This commit is contained in:
parent
92a1f141a0
commit
39dfbad706
3 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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"}}
|
||||
|
|
Loading…
Reference in a new issue