Return created_in_version property in users.get_current_user

This commit is contained in:
clearml 2024-12-05 22:32:28 +02:00
parent ed60a27d1a
commit 97b9bbc4a9
3 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,7 @@ from datetime import datetime
from apiserver.apierrors import errors
from apiserver.apimodels.users import CreateRequest
from apiserver.config.info import get_version
from apiserver.database.errors import translate_errors_context
from apiserver.database.model.user import User
@ -14,7 +15,11 @@ class UserBLL:
if user_id and User.objects(id=user_id).only("id"):
raise errors.bad_request.UserIdExists(id=user_id)
user = User(**request.to_struct(), created=datetime.utcnow())
user = User(
**request.to_struct(),
created=datetime.utcnow(),
created_in_version=get_version(),
)
user.save(force_insert=True)
@staticmethod

View File

@ -20,4 +20,5 @@ class User(DbModelMixin, Document):
given_name = StringField(user_set_allowed=True)
avatar = StringField()
preferences = DynamicField(default="", exclude_by_default=True)
created_in_version = StringField()
created = DateTimeField()

View File

@ -166,6 +166,14 @@ get_current_user {
}
}
}
"2.31": ${get_current_user."2.26"} {
response.properties {
user.properties.created_in_version {
type: string
description: Server version at user creation time
}
}
}
}
get_all_ex {