Introducing new PKI management
This commit is contained in:
parent
69640506d0
commit
0259ae8f94
19 changed files with 857 additions and 53 deletions
|
@ -143,15 +143,33 @@ func treat(raw_path string) {
|
|||
if len(spath) == 3 {
|
||||
if spath[1] == "_registration" {
|
||||
treatRegistration(raw_path, spath[2])
|
||||
} else if teamid, err := strconv.Atoi(spath[1]); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var team fic.Team
|
||||
|
||||
if strings.HasPrefix(spath[1], "_AUTH_ID_") {
|
||||
if serial, err := strconv.ParseInt(strings.TrimPrefix(spath[1], "_AUTH_ID_"), 16, 64); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
return
|
||||
} else if team, err = fic.GetTeamBySerial(serial); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
return
|
||||
}
|
||||
} else if teamid, err := strconv.ParseInt(spath[1], 10, 64); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
} else if team, err := fic.GetTeam(teamid); err != nil {
|
||||
return
|
||||
} else if team, err = fic.GetTeam(teamid); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
} else if spath[2] == "name" {
|
||||
return
|
||||
}
|
||||
|
||||
switch spath[2] {
|
||||
case "name":
|
||||
treatRename(raw_path, team)
|
||||
} else if spath[2] == "hint" {
|
||||
case "hint":
|
||||
treatOpeningHint(raw_path, team)
|
||||
} else {
|
||||
default:
|
||||
treatSubmission(raw_path, team, spath[2])
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -43,11 +43,21 @@ func treatRegistration(pathname string, team_id string) {
|
|||
log.Println("[WRN] Unable to create event:", err)
|
||||
}
|
||||
|
||||
teamDirPath := path.Join(TeamsDir, fmt.Sprintf("%d", team.Id))
|
||||
if err := os.MkdirAll(teamDirPath, 0777); err != nil {
|
||||
teamDirPath := fmt.Sprintf("%d", team.Id)
|
||||
|
||||
// Create team directories into TEAMS
|
||||
if err := os.MkdirAll(path.Join(TeamsDir, teamDirPath), 0777); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
}
|
||||
if err := os.Symlink(teamDirPath, path.Join(TeamsDir, fmt.Sprintf("_AUTH_ID_%s", team_id))); err != nil {
|
||||
if err := os.Symlink(teamDirPath, path.Join(TeamsDir, team_id)); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
}
|
||||
|
||||
// Create team directories into submissions
|
||||
if err := os.MkdirAll(path.Join(SubmissionDir, teamDirPath), 0777); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
}
|
||||
if err := os.Symlink(teamDirPath, path.Join(SubmissionDir, team_id)); err != nil {
|
||||
log.Println("[ERR]", err)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue