backend: check the team has access to the exercice/flag before doing the action
This commit is contained in:
parent
ff7c89af9f
commit
15d108497e
4 changed files with 29 additions and 5 deletions
|
|
@ -25,6 +25,12 @@ func treatWantChoices(pathname string, team fic.Team) {
|
|||
os.Remove(pathname)
|
||||
} else if flag, err := fic.GetFlagKey(ask.FlagId); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
} else if !team.CanSeeFlag(flag) {
|
||||
log.Println("[!!!] The team asks to display choices whereas it doesn't have access to the flag")
|
||||
} else if exercice, err := flag.GetExercice(); err != nil {
|
||||
log.Println("[ERR] Unable to retrieve the flag's underlying exercice:", err)
|
||||
} else if !team.HasAccess(exercice) {
|
||||
log.Println("[!!!] The team asks to display choices whereas it doesn't have access to the exercice")
|
||||
} else if err = team.DisplayChoices(flag); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
} else {
|
||||
|
|
|
|||
Reference in a new issue