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 Nov 25, 2024
1 parent 5b647b4 commit 47a12bf
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,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 @@ -349,6 +352,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 @@ -360,6 +364,7 @@ class KeyValueLikeModelServer(
immutableObject: () -> R,
branch: (branch: BranchReference) -> R,
serverId: () -> R,
legacyClientId: () -> R,
unknown: () -> R,
): R {
return when {
Expand All @@ -368,6 +373,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 47a12bf

Please sign in to comment.