From 82bcc726a86f4ce322cfea19d9cd681aef16fa21 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 12 Jan 2023 16:12:10 +0100 Subject: [PATCH] fix(project): don't allow un-archiving a project when its parent project is archived --- pkg/models/project_rights.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/models/project_rights.go b/pkg/models/project_rights.go index 2e147b1cc..c9b9d1066 100644 --- a/pkg/models/project_rights.go +++ b/pkg/models/project_rights.go @@ -147,7 +147,8 @@ func (p *Project) CanUpdate(s *xorm.Session, a web.Auth) (canUpdate bool, err er canUpdate, err = p.CanWrite(s, a) // If the project is archived and the user tries to un-archive it, let the request through - if IsErrProjectIsArchived(err) && !p.IsArchived { + archivedErr, is := err.(ErrProjectIsArchived) + if is && !p.IsArchived && archivedErr.ProjectID == p.ID { err = nil } return canUpdate, err