Skip to content

Commit

Permalink
fix: Allow for longer user IRIs (DEV-3759)
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Jun 24, 2024
1 parent bc07d66 commit 5ca0042
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ object UserIri extends StringValueCompanion[UserIri] {
*
* `$`: Asserts the end of the string.
*/
private val userIriRegEx = """^http://rdfh\.ch/users/[a-zA-Z0-9_-]{4,36}$""".r
private val userIriRegEx = """^http://rdfh\.ch/users/[a-zA-Z0-9_-]{4,64}$""".r

private val builtInIris = Seq("SystemUser", "AnonymousUser").map(KnoraAdminPrefixExpansion + _)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Copyright © 2021 - 2024 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors.
* SPDX-License-Identifier: Apache-2.0
*/

package org.knora.webapi.slice.admin.domain.model

import zio.test.*

object UserIriSpec extends ZIOSpecDefault {

private val testIris = Seq(
"http://rdfh.ch/users/reforme-geneve-test1",
"http://www.knora.org/ontology/knora-admin#SystemUser",
"http://rdfh.ch/users/mRivoal",
"http://rdfh.ch/users/dW2W_HTTT8mQXUbwAEEFTQ",
"http://rdfh.ch/users/N9JPt7k5Rm69fY5_T4fUGA",
"http://rdfh.ch/users/root",
"http://rdfh.ch/users/l-leforestier",
"http://rdfh.ch/users/3PQ24IUlTUyRyJJTg91eFA",
"http://rdfh.ch/users/a-morerod",
"http://rdfh.ch/users/n-isoz",
"http://rdfh.ch/users/stardom-dchedaleux",
"http://rdfh.ch/users/stardom-jrohner",
"http://rdfh.ch/users/stardom-aboillat",
"http://rdfh.ch/users/stardom-test-snf",
"http://rdfh.ch/users/stardom-import-snf",
"http://rdfh.ch/users/stardom-lcordonier",
"http://rdfh.ch/users/xAE3cYaHSaSsj7VlFbk0tQ",
"http://rdfh.ch/users/stardom-cacourcoux",
"http://rdfh.ch/users/vLy3AVTASEa4fDQ1TjYVYA",
"http://rdfh.ch/users/3bCTZSx2RgGCpYNlF0gXhg",
"http://rdfh.ch/users/9CzAcnT0So-k10CTySHnQA",
"http://rdfh.ch/users/A6AZpISxSm65bBHZ_G5Z4w",
"http://rdfh.ch/users/UjFoKzKVTF2JRYZj7eK0ng",
"http://rdfh.ch/users/parole-religieuse-phGonzalez",
"http://rdfh.ch/users/parole-religieuse-sBenAmor",
"http://rdfh.ch/users/parole-religieuse-jStavo",
"http://rdfh.ch/users/parole-religieuse-test-user1",
"http://rdfh.ch/users/parole-religieuse-yEvequoz",
"http://rdfh.ch/users/user-unil-valentina-ponzetto",
"http://rdfh.ch/users/user-unil-jennifer-ruimi",
"http://rdfh.ch/users/user-unil-aline-hodroge",
"http://rdfh.ch/users/user-unil-fiona-baumann",
"http://rdfh.ch/users/user-unil-paul-fievre",
"http://rdfh.ch/users/YL-iX1d8RzmlcQSdXaUO8w",
"http://rdfh.ch/users/cND_x4iCTbWdzJNtn3is9g",
"http://rdfh.ch/users/t0WFSUu4RMePc_iKIsKZnA",
"http://rdfh.ch/users/lJaouen",
"http://rdfh.ch/users/RMXvXcKjS1u4haOcuqrynQ",
"http://rdfh.ch/users/9XBCrDV3SRa7kS1WwynB4Q",
"http://rdfh.ch/users/BhkfBc3hTeS_IDo-JgXRbQ",
"http://rdfh.ch/users/multiuser",
"http://rdfh.ch/users/AnythingAdminUser",
"http://rdfh.ch/users/drawings-gods-test-ddd1",
"http://rdfh.ch/users/drawings-gods-test-ddd2",
"http://rdfh.ch/users/drawings-gods-ccocco",
"http://rdfh.ch/users/drawings-gods-klaubscher",
"http://rdfh.ch/users/drawings-gods-oserbaeva",
"http://rdfh.ch/users/dDHtpuC2RsmqUY1BSKWc8g",
"http://rdfh.ch/users/iVT51oUVRGqnOntM2w00vw",
"http://rdfh.ch/users/KjlWBFqZSgWBaaDSmXS6FA",
"http://rdfh.ch/users/7hJImNIfTay-aouX3N03vQ",
"http://rdfh.ch/users/DHMUkZErSm-2S2vJ5iLe9Q",
"http://rdfh.ch/users/NJeWbm9_Ra-OVZ8cFWpcaw",
"http://rdfh.ch/users/OxRjdZl8TGWhM-L77hsDfw",
"http://rdfh.ch/users/T0x_LOB5SIySW8PgDPVzSQ",
"http://rdfh.ch/users/aChristen",
"http://rdfh.ch/users/bPellegrino",
"http://rdfh.ch/users/dMaggetti",
"http://rdfh.ch/users/drawings-gods-gdessart",
"http://rdfh.ch/users/drawings-gods-pybrandt",
"http://rdfh.ch/users/drawings-gods-test-user-metaannotator",
"http://rdfh.ch/users/drawings-gods-user-adddrawings",
"http://rdfh.ch/users/drawings-gods-zastaneh",
"http://rdfh.ch/users/drawings-gods-zdandarova",
"http://rdfh.ch/users/eSpadini",
"http://rdfh.ch/users/gFaucherand",
"http://rdfh.ch/users/inactiveuser",
"http://rdfh.ch/users/jBurri",
"http://rdfh.ch/users/l-acosta",
"http://rdfh.ch/users/l-terrier-aliferis",
"http://rdfh.ch/users/l8w3g_jjTK68XgOND84kQg",
"http://rdfh.ch/users/nN4u3vC0Tu2cJWTxpkgEpA",
"http://rdfh.ch/users/normaluser",
"http://rdfh.ch/users/nweqwVnxTQm4sB7-hBl8xg",
"http://rdfh.ch/users/parole-religieuse-mRoca",
"http://rdfh.ch/users/rLacord",
"http://rdfh.ch/users/reforme-geneve-test2",
"http://rdfh.ch/users/roud-oeuvres-test-user1",
"http://rdfh.ch/users/s-ciardo",
"http://rdfh.ch/users/stardom-agaillard",
"http://rdfh.ch/users/stardom-archivist-cneeser",
"http://rdfh.ch/users/stardom-archivist-ctourn",
"http://rdfh.ch/users/stardom-archivist-nroch",
"http://rdfh.ch/users/stardom-archivist-swinzeler",
"http://rdfh.ch/users/stardom-archivist-tberset",
"http://rdfh.ch/users/stardom-archivist-tbissegger",
"http://rdfh.ch/users/superuser",
"http://rdfh.ch/users/theatre-societe-test-user",
"http://rdfh.ch/users/user-unil-christophe-schuwey",
"http://rdfh.ch/users/z1u6qKC5RWitd1DW75YuuQ",
"http://rdfh.ch/users/J3qQSt8QQSeWQqMCh3WdBA",
"http://rdfh.ch/users/activites-cs-test-user1",
"http://rdfh.ch/users/Mk2paWqaRWiJZgsD8T8Z4Q",
"http://rdfh.ch/users/jgP5hxAhSJuN0OhQXim-Fw",
"http://rdfh.ch/users/XfZo65lKTLW98dYpy2ouWg",
"http://rdfh.ch/users/h-steiner-test-user1",
"http://rdfh.ch/users/V69brrczSLauq8C3055CHw",
"http://rdfh.ch/users/vfYo2cDaTx669feCRDRwKA",
"http://rdfh.ch/users/FjsyS6K_TfSQ5Tlw3HuBaA",
"http://rdfh.ch/users/Gb5Xoj-9TASyDrkKd0r4UA",
"http://rdfh.ch/users/0_TQsygdQtWIi6bz03-jtQ",
"http://rdfh.ch/users/tbk47a26SeOvVCfYnioORQ",
"http://www.knora.org/ontology/knora-admin#AnonymousUser",
"http://rdfh.ch/users/wwKNrDRcT4q8Mzard4rRtQ",
"http://rdfh.ch/users/nlwMXAE2Ql2IrFPnZ3An4A",
"http://rdfh.ch/users/aaUezknaQUywqNhYmjno6g",
"http://rdfh.ch/users/mldau5cER62sqPR9o62EPw",
"http://rdfh.ch/users/aJ0tocfSTp633Ku0e7pEqg",
)

val spec = suite("UserIriSpec")(test("") {
check(Gen.fromIterable(testIris))(iri => assertTrue(UserIri.from(iri).map(_.value) == Right(iri)))
})
}

0 comments on commit 5ca0042

Please sign in to comment.