diff --git a/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/model/User.scala b/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/model/User.scala index 8203ee4d28..07aa73bd60 100644 --- a/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/model/User.scala +++ b/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/model/User.scala @@ -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 + _) diff --git a/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/model/UserIriSpec.scala b/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/model/UserIriSpec.scala new file mode 100644 index 0000000000..b26c8264a0 --- /dev/null +++ b/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/model/UserIriSpec.scala @@ -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))) + }) +}