Skip to content

Commit

Permalink
Merge pull request #3162 from Opetushallitus/tor-2210-client-names
Browse files Browse the repository at this point in the history
TOR-2210 lokalisoidut OAuth2 client nimet
  • Loading branch information
a544jh authored Oct 16, 2024
2 parents 5055c4b + b2d76ad commit da76f5f
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"koodistoUri": "omadataoauth2client",
"resourceUri": "https://virkailija.opintopolku.fi/koodisto-service/rest/codes/omadataoauth2scopes",
"omistaja": null,
"organisaatioOid": "1.2.246.562.10.00000000001",
"lukittu": null,
"withinCodes": [],
"includesCodes": [],
"levelsWithCodes": [],
"codesGroupUri": "koski",
"version": 0,
"versio": 1,
"paivitysPvm": "2023-03-13",
"paivittajaOid": "1.2.246.562.24.98063222086",
"voimassaAlkuPvm": "2023-01-01",
"voimassaLoppuPvm": null,
"tila": "LUONNOS",
"metadata": [
{
"kieli": "SV",
"nimi": "omadataoauth2 client",
"kuvaus": "omadataoauth2 client",
"kayttoohje": null,
"kasite": null,
"kohdealue": null,
"sitovuustaso": null,
"kohdealueenOsaAlue": null,
"toimintaymparisto": null,
"tarkentaaKoodistoa": null,
"huomioitavaKoodisto": null,
"koodistonLahde": null
},
{
"kieli": "EN",
"nimi": "omadataoauth2 client",
"kuvaus": "omadataoauth2 client",
"kayttoohje": null,
"kasite": null,
"kohdealue": null,
"sitovuustaso": null,
"kohdealueenOsaAlue": null,
"toimintaymparisto": null,
"tarkentaaKoodistoa": null,
"huomioitavaKoodisto": null,
"koodistonLahde": null
},
{
"kieli": "FI",
"nimi": "omadataoauth2 client",
"kuvaus": "omadataoauth2 client",
"kayttoohje": null,
"kasite": null,
"kohdealue": null,
"sitovuustaso": null,
"kohdealueenOsaAlue": null,
"toimintaymparisto": null,
"tarkentaaKoodistoa": null,
"huomioitavaKoodisto": null,
"koodistonLahde": null
}
],
"codesVersions": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"metadata": [
{
"nimi": "OAuth2 sample client (fi)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "FI"
},
{
"nimi": "OAuth2 sample client (sv)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "SV"
},
{
"nimi": "OAuth2 sample client (en)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "EN"
}
],
"withinCodeElements": [],
"includesCodeElements": [],
"levelsWithCodeElements": [],
"koodiUri": "omadataoauth2client_oauth2sample",
"versio": 1,
"koodiArvo": "oauth2sample"
},
{
"metadata": [
{
"nimi": "OAuth2 debug client (fi)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "FI"
},
{
"nimi": "OAuth2 debug client (sv)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "SV"
},
{
"nimi": "OAuth2 debug client (en)",
"kuvaus": "",
"lyhytNimi": "",
"kieli": "EN"
}
],
"withinCodeElements": [],
"includesCodeElements": [],
"levelsWithCodeElements": [],
"koodiUri": "omadataoauth2client_oauth2client",
"versio": 1,
"koodiArvo": "oauth2client"
}
]
1 change: 1 addition & 0 deletions src/main/scala/fi/oph/koski/koodisto/Koodistot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ object Koodistot {
KoodistoAsetus("ytrtutkintokokonaisuudentyyppi"),
KoodistoAsetus("ammatillisensuorituksenkorotus"),
KoodistoAsetus("omadataoauth2scope"),
KoodistoAsetus("omadataoauth2client"),
)
val koskiKoodistot = koskiKoodistoAsetukset.map(_.toString)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package fi.oph.koski.omadataoauth2

import fi.oph.koski.config.KoskiApplication
import fi.oph.koski.koodisto.KoodistoViite
import fi.oph.koski.koskiuser.{KoskiSpecificAuthenticationSupport, RequiresKansalainen}
import fi.oph.koski.log.Logging
import fi.oph.koski.schema.LocalizedString
import fi.oph.koski.servlet.{KoskiSpecificApiServlet, LanguageSupport, NoCache}
import org.scalatra.ContentEncodingSupport

Expand All @@ -11,8 +13,13 @@ class OmaDataOAuth2ResourceOwnerServlet(implicit val application: KoskiApplicati
extends KoskiSpecificApiServlet with KoskiSpecificAuthenticationSupport with Logging with ContentEncodingSupport with NoCache with LanguageSupport with OmaDataOAuth2Support with RequiresKansalainen {

get("/client-details/:client_id") {
// TODO: TOR-2210: oikea toteutus
renderObject(ClientDetails(params("client_id"), "Clientin selväkielinen nimi (TODO)"))
val clientId = params("client_id")
renderObject(ClientDetails(clientId,
application.koodistoPalvelu.getKoodistoKoodit(application.koodistoPalvelu.getLatestVersionRequired("omadataoauth2client"))
.find(_.koodiArvo == clientId)
.flatMap(_.nimi)
.getOrElse(LocalizedString.unlocalized(clientId))
))
}

get("/authorize") {
Expand Down Expand Up @@ -85,5 +92,5 @@ class OmaDataOAuth2ResourceOwnerServlet(implicit val application: KoskiApplicati

case class ClientDetails(
id: String,
name: String // TODO: TOR-2210 lokalisoitu merkkijono, josta frontti päättää minkä kielen rendaa?
name: LocalizedString
)
2 changes: 1 addition & 1 deletion web/app/omadata/OmaDataOAuth2AnnaHyvaksynta.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default ({ clientName, onAcceptClick, onDeclineClick, scope }) => {
<Text name="Antamalla suostumuksesi sallit, että Opetushallitus luovuttaa sinua koskevia henkilötietoja seuraavalle palveluntarjoajalle" />
</div>
<div className="acceptance-member-name">
<Text name={clientName} />
<Text name={t(clientName)} />
</div>
<div className="acceptance-share-info">
<Text name="Palveluntarjoajalle luovutetaan seuraavat henkilötiedot" />
Expand Down

0 comments on commit da76f5f

Please sign in to comment.