From afd29380cf1e04d0919c35fe18bff3e8cdce3d1e Mon Sep 17 00:00:00 2001 From: ImMin5 Date: Thu, 28 Dec 2023 20:55:07 +0900 Subject: [PATCH 1/2] fix: fix public and private dashboard name check role --- src/spaceone/dashboard/model/private_dashboard_model.py | 6 +++++- src/spaceone/dashboard/model/public_dashboard_model.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spaceone/dashboard/model/private_dashboard_model.py b/src/spaceone/dashboard/model/private_dashboard_model.py index 8ce28bd..fba0ce8 100644 --- a/src/spaceone/dashboard/model/private_dashboard_model.py +++ b/src/spaceone/dashboard/model/private_dashboard_model.py @@ -53,7 +53,11 @@ class PrivateDashboard(MongoModel): @classmethod def create(cls, data): dashboard_vos = cls.filter( - name=data["name"], user_id=data["user_id"], domain_id=data["domain_id"] + name=data["name"], + user_id=data["user_id"], + project_id=data["project_id"], + workspace_id=data["workspace_id"], + domain_id=data["domain_id"], ) if dashboard_vos.count() > 0: diff --git a/src/spaceone/dashboard/model/public_dashboard_model.py b/src/spaceone/dashboard/model/public_dashboard_model.py index a546e50..7244128 100644 --- a/src/spaceone/dashboard/model/public_dashboard_model.py +++ b/src/spaceone/dashboard/model/public_dashboard_model.py @@ -58,7 +58,7 @@ class PublicDashboard(MongoModel): @classmethod def create(cls, data): - dashboard_vos = cls.filter(name=data["name"], domain_id=data["domain_id"]) + dashboard_vos = cls.filter(name=data["name"], project_id=["project_id"], workspace_id=["workspace_id"], domain_id=data["domain_id"]) if dashboard_vos.count() > 0: raise ERROR_NOT_UNIQUE(key="name", value=data["name"]) From 5ff15fe90a0a9c816d8c0f428d711f9cc3a30ba5 Mon Sep 17 00:00:00 2001 From: ImMin5 Date: Wed, 3 Jan 2024 14:28:11 +0900 Subject: [PATCH 2/2] fix: fix typo when create dashboard --- src/spaceone/dashboard/model/public_dashboard_model.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/spaceone/dashboard/model/public_dashboard_model.py b/src/spaceone/dashboard/model/public_dashboard_model.py index 7244128..8b3caaf 100644 --- a/src/spaceone/dashboard/model/public_dashboard_model.py +++ b/src/spaceone/dashboard/model/public_dashboard_model.py @@ -58,7 +58,12 @@ class PublicDashboard(MongoModel): @classmethod def create(cls, data): - dashboard_vos = cls.filter(name=data["name"], project_id=["project_id"], workspace_id=["workspace_id"], domain_id=data["domain_id"]) + dashboard_vos = cls.filter( + name=data["name"], + project_id=data["project_id"], + workspace_id=data["workspace_id"], + domain_id=data["domain_id"], + ) if dashboard_vos.count() > 0: raise ERROR_NOT_UNIQUE(key="name", value=data["name"])