Skip to content

Commit

Permalink
fix(model-server): RestWebModelClient couldn't request a clientId
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Dec 11, 2024
1 parent 693f3bd commit ff08972
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ class KeyValueLikeModelServer(
serverId = {
throw NoPermissionException("'$key' is read-only.")
},
legacyClientId = {
throw NoPermissionException("Directly writing to 'clientId' is not allowed")
},
unknown = {
userDefinedEntries[key] = value
},
Expand Down Expand Up @@ -335,6 +338,7 @@ class KeyValueLikeModelServer(
serverId = {
if (isWrite) throw NoPermissionException("'$key' is read-only.")
},
legacyClientId = {},
unknown = {
call.checkPermission(ModelServerPermissionSchema.legacyUserDefinedObjects.run { if (isWrite) write else read })
},
Expand All @@ -346,6 +350,7 @@ class KeyValueLikeModelServer(
immutableObject: () -> R,
branch: (branch: BranchReference) -> R,
serverId: () -> R,
legacyClientId: () -> R,
unknown: () -> R,
): R {
return when {
Expand All @@ -354,6 +359,7 @@ class KeyValueLikeModelServer(
key.startsWith(PROTECTED_PREFIX) -> throw NoPermissionException("Access to keys starting with '$PROTECTED_PREFIX' is only permitted to the model server itself.")
key.startsWith(RepositoriesManager.KEY_PREFIX) -> throw NoPermissionException("Access to keys starting with '${RepositoriesManager.KEY_PREFIX}' is only permitted to the model server itself.")
key == RepositoriesManager.LEGACY_SERVER_ID_KEY || key == RepositoriesManager.LEGACY_SERVER_ID_KEY2 -> serverId()
key == "clientId" -> legacyClientId()
else -> unknown()
}
}
Expand Down

0 comments on commit ff08972

Please sign in to comment.