File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/models-library/src/models_library Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 22from pathlib import Path
33from typing import Final , Literal , TypeAlias
44
5+ from models_library .utils ._original_fastapi_encoders import jsonable_encoder
56from pydantic import (
67 AnyUrl ,
78 BaseModel ,
@@ -224,18 +225,24 @@ class Cluster(BaseCluster):
224225 @model_validator (mode = "before" )
225226 @classmethod
226227 def check_owner_has_access_rights (cls , values ):
228+ values = jsonable_encoder (values )
229+
227230 is_default_cluster = bool (values ["id" ] == DEFAULT_CLUSTER_ID )
228231 owner_gid = values ["owner" ]
229232
230233 # check owner is in the access rights, if not add it
231234 access_rights = values .get ("access_rights" , values .get ("accessRights" , {}))
232235 if owner_gid not in access_rights :
233236 access_rights [owner_gid ] = (
234- CLUSTER_USER_RIGHTS if is_default_cluster else CLUSTER_ADMIN_RIGHTS
237+ CLUSTER_USER_RIGHTS .model_dump ()
238+ if is_default_cluster
239+ else CLUSTER_ADMIN_RIGHTS .model_dump ()
235240 )
236241 # check owner has the expected access
237242 if access_rights [owner_gid ] != (
238- CLUSTER_USER_RIGHTS if is_default_cluster else CLUSTER_ADMIN_RIGHTS
243+ CLUSTER_USER_RIGHTS .model_dump ()
244+ if is_default_cluster
245+ else CLUSTER_ADMIN_RIGHTS .model_dump ()
239246 ):
240247 msg = f"the cluster owner access rights are incorrectly set: { access_rights [owner_gid ]} "
241248 raise ValueError (msg )
You can’t perform that action at this time.
0 commit comments