fix: mock server token claims and omission data

This commit is contained in:
zypherift
2026-08-27 20:44:05 +02:00
parent fb8fad142a
commit 50274575f6
5 changed files with 250 additions and 44 deletions

View File

@@ -22,12 +22,14 @@ func base64URL(v any) string {
return base64.RawURLEncoding.EncodeToString(b)
}
func buildIdToken(instituteCode, userId, username string) string {
func buildIdToken(instituteCode, userId, username, studentName string) string {
header := map[string]string{"alg": "none", "typ": "JWT"}
payload := map[string]any{
"kreta:institute_code": instituteCode,
"kreta:institute_user_id": userId,
"kreta:user_name": username,
"name": studentName,
"role": "Tanulo",
"iat": time.Now().Unix(),
}
sig := make([]byte, 16)
@@ -186,7 +188,7 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
}
access, refresh := s.auth.issueTokens(info)
idToken := buildIdToken(info.instituteCode, info.userId, info.username)
idToken := buildIdToken(info.instituteCode, info.userId, info.username, student.Nev)
resp := map[string]any{
"id_token": idToken,

View File

@@ -19,6 +19,7 @@
"SzuletesiHonap": 9,
"SzuletesiNap": 1,
"EmailCim": "teszt.elek@example.com",
"Telefonszam": "+3612345678",
"TanevUid": "2025/2026",
"Gondviselok": [
{
@@ -75,7 +76,7 @@
"KeszitesDatuma": "2026-08-25T00:00:00",
"Tantargy": {
"Uid": "1,MATEK",
"Nev": "Matematika",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
@@ -83,29 +84,166 @@
},
"SortIndex": 1
},
"Tema": "Másodfokú egyenletek",
"Tema": "meoow",
"Tipus": {
"Uid": "1",
"Nev": "Írásbeli",
"Leiras": "Írásbeli felelet"
},
"Mod": {
"Uid": "",
"Nev": "",
"Leiras": ""
},
"ErtekFajta": {
"Uid": "1",
"Nev": "Osztályzat",
"Leiras": "Osztályzat"
},
"ErtekeloTanarNeve": "Kovács Béla",
"ErtekeloTanarNeve": "mrrp",
"Jelleg": "Ertekeles",
"SzamErtek": 5,
"SzovegesErtek": "Jeles",
"SulySzazalekErteke": 100,
"OsztalyCsoport": {
"Uid": "10,11.A"
},
"SortIndex": 1
},
{
"Uid": "",
"RogzitesDatuma": "2026-08-26T20:53:37.494Z",
"KeszitesDatuma": "2026-08-26T20:53:37.494Z",
"Tantargy": {
"Uid": "",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
"Leiras": ""
},
"SortIndex": 0
},
"Tema": "meoow",
"Tipus": {
"Uid": "1",
"Nev": "Írásbeli",
"Leiras": ""
},
"ErtekFajta": {
"Uid": "1",
"Nev": "Osztályzat",
"Leiras": ""
},
"ErtekeloTanarNeve": "meow",
"Jelleg": "Ertekeles",
"SzamErtek": 4,
"SzovegesErtek": "Jeles",
"SulySzazalekErteke": 100,
"OsztalyCsoport": {
"Uid": ""
},
"SortIndex": 0
},
{
"Uid": "",
"RogzitesDatuma": "2026-08-27T16:13:00.121Z",
"KeszitesDatuma": "2026-08-27T16:13:00.121Z",
"Tantargy": {
"Uid": "",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
"Leiras": ""
},
"SortIndex": 0
},
"Tema": "meoow",
"Tipus": {
"Uid": "1",
"Nev": "Írásbeli",
"Leiras": ""
},
"ErtekFajta": {
"Uid": "1",
"Nev": "Osztályzat",
"Leiras": ""
},
"ErtekeloTanarNeve": "meow",
"Jelleg": "Ertekeles",
"SzamErtek": 3,
"SzovegesErtek": "Jeles",
"SulySzazalekErteke": 100,
"OsztalyCsoport": {
"Uid": ""
},
"SortIndex": 0
},
{
"Uid": "",
"RogzitesDatuma": "2026-08-27T16:13:00.269Z",
"KeszitesDatuma": "2026-08-27T16:13:00.269Z",
"Tantargy": {
"Uid": "",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
"Leiras": ""
},
"SortIndex": 0
},
"Tema": "meoow",
"Tipus": {
"Uid": "1",
"Nev": "Írásbeli",
"Leiras": ""
},
"ErtekFajta": {
"Uid": "1",
"Nev": "Osztályzat",
"Leiras": ""
},
"ErtekeloTanarNeve": "meow",
"Jelleg": "Ertekeles",
"SzamErtek": 2,
"SzovegesErtek": "Jeles",
"SulySzazalekErteke": 100,
"OsztalyCsoport": {
"Uid": ""
},
"SortIndex": 0
},
{
"Uid": "",
"RogzitesDatuma": "2026-08-27T16:13:00.399Z",
"KeszitesDatuma": "2026-08-27T16:13:00.399Z",
"Tantargy": {
"Uid": "",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
"Leiras": ""
},
"SortIndex": 0
},
"Tema": "meoow",
"Tipus": {
"Uid": "1",
"Nev": "Írásbeli",
"Leiras": ""
},
"ErtekFajta": {
"Uid": "1",
"Nev": "Osztályzat",
"Leiras": ""
},
"ErtekeloTanarNeve": "meow",
"Jelleg": "Ertekeles",
"SzamErtek": 1,
"SzovegesErtek": "Jeles",
"SulySzazalekErteke": 100,
"OsztalyCsoport": {
"Uid": ""
},
"SortIndex": 0
}
],
"homework": [
@@ -178,6 +316,11 @@
},
"SortIndex": 1
},
"Ora": {
"KezdoDatum": "2026-08-24T00:00:00",
"VegDatum": "2026-08-24T00:00:00",
"Oraszam": 1
},
"Datum": "2026-08-24T00:00:00",
"RogzitoTanarNeve": "Kovács Béla",
"Tipus": {
@@ -213,6 +356,11 @@
},
"SortIndex": 0
},
"Ora": {
"KezdoDatum": "2026-08-26T20:00:26.713Z",
"VegDatum": "2026-08-26T20:00:26.713Z",
"Oraszam": 1
},
"Datum": "2026-08-26T20:00:26.713Z",
"RogzitoTanarNeve": "fasz",
"Tipus": {
@@ -283,6 +431,52 @@
"DigitalisTamogatoEszkozTipusList": [],
"Letrehozas": "2026-07-27T00:00:00",
"UtolsoModositas": "2026-07-27T00:00:00"
},
{
"Uid": "",
"Datum": "2026-08-26T20:15:10.348Z",
"KezdetIdopont": "2026-08-26T20:10:10.348Z",
"VegIdopont": "2026-08-26T20:50:10.348Z",
"Nev": "meow",
"Oraszam": 1,
"OsztalyCsoport": {
"Uid": "",
"Nev": ""
},
"TanarNeve": "meow",
"Tantargy": {
"Uid": "",
"Nev": "meow",
"Kategoria": {
"Uid": "1",
"Nev": "Kötelező",
"Leiras": ""
},
"SortIndex": 0
},
"TeremNeve": "meoow szoba",
"Tipus": {
"Uid": "1",
"Nev": "Tanóra",
"Leiras": ""
},
"TanuloJelenlet": {
"Uid": "",
"Nev": "",
"Leiras": ""
},
"Allapot": {
"Uid": "1",
"Nev": "Megtartott",
"Leiras": ""
},
"IsTanuloHaziFeladatEnabled": true,
"IsHaziFeladatMegoldva": false,
"Csatolmanyok": [],
"IsDigitalisOra": false,
"DigitalisTamogatoEszkozTipusList": [],
"Letrehozas": "2026-08-26T20:15:10.348Z",
"UtolsoModositas": "2026-08-26T20:15:10.348Z"
}
],
"notices": [

View File

@@ -84,18 +84,20 @@ func seedData() storeData {
},
Grades: []Grade{
{
Uid: "1000",
RogzitesDatuma: iso(today.Add(-24 * time.Hour)),
KeszitesDatuma: iso(today.Add(-24 * time.Hour)),
Tantargy: mathSubject,
Tema: "Másodfokú egyenletek",
Tipus: NameUidDesc{Uid: "1", Nev: "Írásbeli", Leiras: "Írásbeli felelet"},
ErtekFajta: NameUidDesc{Uid: "1", Nev: "Osztályzat", Leiras: "Osztályzat"},
ErtekeloTanarNeve: "Kovács Béla",
SzamErtek: 5,
SzovegesErtek: "Jeles",
OsztalyCsoport: classGroup,
SortIndex: 1,
Uid: "1000",
RogzitesDatuma: iso(today.Add(-24 * time.Hour)),
KeszitesDatuma: iso(today.Add(-24 * time.Hour)),
Tantargy: mathSubject,
Tema: "Másodfokú egyenletek",
Tipus: NameUidDesc{Uid: "1", Nev: "Írásbeli", Leiras: "Írásbeli felelet"},
ErtekFajta: NameUidDesc{Uid: "1", Nev: "Osztályzat", Leiras: "Osztályzat"},
ErtekeloTanarNeve: "Kovács Béla",
Jelleg: "Ertekeles",
SzamErtek: 5,
SzovegesErtek: "Jeles",
SulySzazalekErteke: 100,
OsztalyCsoport: classGroup,
SortIndex: 1,
},
},
Homework: []Homework{
@@ -128,8 +130,13 @@ func seedData() storeData {
},
Omissions: []Omission{
{
Uid: "4000",
Tantargy: mathSubject,
Uid: "4000",
Tantargy: mathSubject,
Ora: &OmittedLesson{
KezdoDatum: iso(today.Add(-48 * time.Hour)),
VegDatum: iso(today.Add(-48*time.Hour + 45*time.Minute)),
Oraszam: 1,
},
Datum: iso(today.Add(-48 * time.Hour)),
RogzitoTanarNeve: "Kovács Béla",
Tipus: NameUidDesc{Uid: "1", Nev: "Hiányzás", Leiras: "Hiányzás"},
@@ -201,4 +208,4 @@ func seedData() storeData {
}
}
//xdd mi a faszom ez kreta
//xdd mi a faszom ez kreta

View File

@@ -250,10 +250,10 @@ const entities = {
Tantargy: subjectTemplate(),
Tema: "",
Tipus: { Uid: "1", Nev: "Írásbeli", Leiras: "" },
Mod: nameUidDescTemplate(),
Mod: null,
ErtekFajta: { Uid: "1", Nev: "Osztályzat", Leiras: "" },
ErtekeloTanarNeve: "",
Kind: "",
Jelleg: "Ertekeles",
SzamErtek: 5,
SzovegesErtek: "Jeles",
SulySzazalekErteke: 100,
@@ -330,6 +330,7 @@ const entities = {
template: () => ({
Uid: "",
Tantargy: subjectTemplate(),
Ora: { KezdoDatum: nowIso(), VegDatum: nowIso(), Oraszam: 1 },
Datum: nowIso(),
RogzitoTanarNeve: "",
Tipus: { Uid: "1", Nev: "Hiányzás", Leiras: "" },
@@ -345,6 +346,8 @@ const entities = {
{ path: "Tipus.Nev", label: "Type", type: "text" },
{ path: "IgazolasAllapota", label: "State (Igazolt/Igazolatlan/Igazolando)", type: "text" },
{ path: "Datum", label: "Date", type: "text" },
{ path: "Ora.KezdoDatum", label: "Lesson start", type: "text" },
{ path: "Ora.VegDatum", label: "Lesson end", type: "text" },
],
},

View File

@@ -93,23 +93,23 @@ type ClassGroup struct {
}
type Grade struct {
Uid string `json:"Uid"`
RogzitesDatuma string `json:"RogzitesDatuma"`
KeszitesDatuma string `json:"KeszitesDatuma"`
LattamozasDatuma string `json:"LattamozasDatuma,omitempty"`
Tantargy Subject `json:"Tantargy"`
Tema string `json:"Tema,omitempty"`
Tipus NameUidDesc `json:"Tipus"`
Mod NameUidDesc `json:"Mod"`
ErtekFajta NameUidDesc `json:"ErtekFajta"`
ErtekeloTanarNeve string `json:"ErtekeloTanarNeve"`
Kind string `json:"Kind,omitempty"`
SzamErtek int `json:"SzamErtek,omitempty"`
SzovegesErtek string `json:"SzovegesErtek"`
SulySzazalekErteke int `json:"SulySzazalekErteke,omitempty"`
SzovegesErtekelesRovidNev string `json:"SzovegesErtekelesRovidNev,omitempty"`
OsztalyCsoport UidRef `json:"OsztalyCsoport"`
SortIndex int `json:"SortIndex"`
Uid string `json:"Uid"`
RogzitesDatuma string `json:"RogzitesDatuma"`
KeszitesDatuma string `json:"KeszitesDatuma"`
LattamozasDatuma string `json:"LattamozasDatuma,omitempty"`
Tantargy Subject `json:"Tantargy"`
Tema string `json:"Tema,omitempty"`
Tipus NameUidDesc `json:"Tipus"`
Mod *NameUidDesc `json:"Mod,omitempty"`
ErtekFajta NameUidDesc `json:"ErtekFajta"`
ErtekeloTanarNeve string `json:"ErtekeloTanarNeve"`
Jelleg string `json:"Jelleg,omitempty"`
SzamErtek int `json:"SzamErtek,omitempty"`
SzovegesErtek string `json:"SzovegesErtek"`
SulySzazalekErteke int `json:"SulySzazalekErteke,omitempty"`
SzovegesErtekelesRovidNev string `json:"SzovegesErtekelesRovidNev,omitempty"`
OsztalyCsoport UidRef `json:"OsztalyCsoport"`
SortIndex int `json:"SortIndex"`
}
type Homework struct {