From 2ed83e77d41c4c01ad74c1b53ed9c556f97123ef Mon Sep 17 00:00:00 2001 From: smartcat999 <49057502+smartcat999@users.noreply.github.com> Date: Mon, 3 Mar 2025 16:11:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20During=20the=20creation=20of=20a=20works?= =?UTF-8?q?pace,=20it=20will=20be=20determined=20whethe=E2=80=A6=20(#6385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: During the creation of a workspace, it will be determined whethe… (#2147) * fix: During the creation of a workspace, it will be determined whether the user has the authority to designate other users as administrators. * fix: code update * fix: Determine whether the user is a workspace administrator based on whether the user has the permission to delete the workspace --------- Signed-off-by: peng wu <2030047311@qq.com> --- pkg/models/tenant/tenant.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/models/tenant/tenant.go b/pkg/models/tenant/tenant.go index 34c44ae0b..75784460d 100644 --- a/pkg/models/tenant/tenant.go +++ b/pkg/models/tenant/tenant.go @@ -437,6 +437,12 @@ func (t *tenantOperator) CreateWorkspaceTemplate(user user.Info, workspace *tena } } + + if workspace.Spec.Template.Spec.Manager != user.GetName() { + if err := t.checkWorkspaceTemplatePermission(user, workspace.Name); err != nil { + return nil, err + } + } return workspace, t.client.Create(context.Background(), workspace) }