File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
packages/models-library/src/models_library Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 11from enum import auto
22from pathlib import Path
3- from typing import Final , Literal , TypeAlias
3+ from typing import Final , Literal , Self , TypeAlias
44
55from pydantic import (
66 AnyUrl ,
@@ -222,13 +222,12 @@ class Cluster(BaseCluster):
222222 )
223223
224224 @model_validator (mode = "after" )
225- @classmethod
226- def _check_owner_has_access_rights (cls , values ):
227- is_default_cluster = bool (values .id == DEFAULT_CLUSTER_ID )
228- owner_gid = values .owner
225+ def _check_owner_has_access_rights (self ) -> Self :
226+ is_default_cluster = bool (self .id == DEFAULT_CLUSTER_ID )
227+ owner_gid = self .owner
229228
230229 # check owner is in the access rights, if not add it
231- access_rights = values .access_rights or {}
230+ access_rights = self .access_rights or {}
232231 if owner_gid not in access_rights :
233232 access_rights [owner_gid ] = (
234233 CLUSTER_USER_RIGHTS if is_default_cluster else CLUSTER_ADMIN_RIGHTS
@@ -239,5 +238,5 @@ def _check_owner_has_access_rights(cls, values):
239238 ):
240239 msg = f"the cluster owner access rights are incorrectly set: { access_rights [owner_gid ]} "
241240 raise ValueError (msg )
242- values .access_rights = access_rights
243- return values
241+ self .access_rights = access_rights
242+ return self
You can’t perform that action at this time.
0 commit comments