diff --git a/website/models/user.py b/website/models/user.py index 48bbc45..de18eeb 100644 --- a/website/models/user.py +++ b/website/models/user.py @@ -93,9 +93,7 @@ def generate_apikey(self) -> str: return self.apikey def __str__(self) -> str: - return "Login: {}\nLast seen: {}\nIs active: {}\nIs admin: {}".format( - self.login, self.last_seen, self.is_active, self.is_admin - ) + return str(self.uuid) @validates("login") def validates_login(self, key: str, value: str) -> str: diff --git a/website/web/api/v1/bundle.py b/website/web/api/v1/bundle.py index eeb85bc..1430a3f 100644 --- a/website/web/api/v1/bundle.py +++ b/website/web/api/v1/bundle.py @@ -21,7 +21,7 @@ from website.validators import validate_json from website.web.api.v1.common import auth_func from website.web.api.v1.common import metada_params_model -from website.web.api.v1.common import user_light_params_model +from website.web.api.v1.common import user_params_model from website.web.api.v1.common import uuid_type from website.web.api.v1.types import ResultType from website.models import Bundle @@ -84,7 +84,7 @@ metadata = bundle_ns.model("metadata", metada_params_model) bundle["author"] = fields.Nested( - bundle_ns.model("User", user_light_params_model), readonly=True + bundle_ns.model("User", user_params_model), readonly=True ) bundle_list_fields = bundle_ns.model( diff --git a/website/web/api/v1/comment.py b/website/web/api/v1/comment.py index cb54095..6e823af 100644 --- a/website/web/api/v1/comment.py +++ b/website/web/api/v1/comment.py @@ -23,7 +23,7 @@ from website.validators import validate_json from website.web.api.v1.common import auth_func from website.web.api.v1.common import metada_params_model -from website.web.api.v1.common import user_light_params_model +from website.web.api.v1.common import user_params_model from website.web.api.v1.common import uuid_type from website.web.api.v1.types import ResultType from website.models import Comment @@ -90,7 +90,7 @@ metadata = comment_ns.model("metadata", metada_params_model) comment["author"] = fields.Nested( - comment_ns.model("User", user_light_params_model), readonly=True + comment_ns.model("User", user_params_model), readonly=True ) comment_list_fields = comment_ns.model( diff --git a/website/web/api/v1/common.py b/website/web/api/v1/common.py index b9cb196..bbb975d 100644 --- a/website/web/api/v1/common.py +++ b/website/web/api/v1/common.py @@ -62,8 +62,12 @@ def uuid_type(value: str) -> uuid.UUID: "limit": fields.Integer(readonly=True, description="Requested limit data."), } -user_light_params_model = { +user_params_model = { "login": fields.String(readonly=True, description="Login of the user."), "name": fields.String(readonly=True, description="Name of the user."), "uuid": fields.String(readonly=True, description="UUID of the user."), } + +user_light_params_model = { + "uuid": fields.String(readonly=True, description="UUID of the user."), +} diff --git a/website/web/api/v1/sighting.py b/website/web/api/v1/sighting.py index de246d2..bc23026 100644 --- a/website/web/api/v1/sighting.py +++ b/website/web/api/v1/sighting.py @@ -84,11 +84,12 @@ # Response marshalling sighting_params_model = { "uuid": fields.String(description="Sighting UUID.", readonly=True), - "vulnerability_lookup_origin": fields.String( - description="UUID of the Vulnerability Lookup origin instance.", - readonly=True, - default=local_instance_uuid, - ), + # "vulnerability_lookup_origin": fields.String( + # description="UUID of the Vulnerability Lookup origin instance.", + # readonly=True, + # default=local_instance_uuid, + # ), + # "author": fields.String(description="Author of the sighting."), "creation_timestamp": fields.DateTime( description="Creation time of the sighting.", readonly=True ), @@ -101,10 +102,6 @@ sighting = sighting_ns.model("Sighting", sighting_params_model) metadata = sighting_ns.model("metadata", metada_params_model) -sighting["author"] = fields.Nested( - sighting_ns.model("User", user_light_params_model), readonly=True -) - sighting_list_fields = sighting_ns.model( "SightingsList", {