mirror of https://github.com/1Panel-dev/1Panel
fix: 解决已经关联网站的分组删除没有校验的BUG
parent
6209472fb2
commit
11b40b8cf9
|
@ -53,5 +53,9 @@ func (w WebsiteGroupService) UpdateGroup(update request.WebsiteGroupUpdate) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WebsiteGroupService) DeleteGroup(id uint) error {
|
func (w WebsiteGroupService) DeleteGroup(id uint) error {
|
||||||
|
websites, _ := websiteRepo.GetBy(websiteRepo.WithGroupID(id))
|
||||||
|
if len(websites) > 0 {
|
||||||
|
return buserr.New(constant.ErrGroupIsUsed)
|
||||||
|
}
|
||||||
return websiteGroupRepo.DeleteBy(commonRepo.WithByID(id))
|
return websiteGroupRepo.DeleteBy(commonRepo.WithByID(id))
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ var (
|
||||||
ErrDomainIsExist = "ErrDomainIsExist"
|
ErrDomainIsExist = "ErrDomainIsExist"
|
||||||
ErrAliasIsExist = "ErrAliasIsExist"
|
ErrAliasIsExist = "ErrAliasIsExist"
|
||||||
ErrAppDelete = "ErrAppDelete"
|
ErrAppDelete = "ErrAppDelete"
|
||||||
|
ErrGroupIsUsed = "ErrGroupIsUsed"
|
||||||
)
|
)
|
||||||
|
|
||||||
//ssl
|
//ssl
|
||||||
|
|
|
@ -33,6 +33,7 @@ ErrPathNotFound: "Path is not found"
|
||||||
ErrDomainIsExist: "Domain is already exist"
|
ErrDomainIsExist: "Domain is already exist"
|
||||||
ErrAliasIsExist: "Alias is already exist"
|
ErrAliasIsExist: "Alias is already exist"
|
||||||
ErrAppDelete: 'Other Website use this App'
|
ErrAppDelete: 'Other Website use this App'
|
||||||
|
ErrGroupIsUsed: 'The group has been associated with a website and cannot be deleted'
|
||||||
|
|
||||||
#ssl
|
#ssl
|
||||||
ErrSSLCannotDelete: "The certificate is being used by the website and cannot be removed"
|
ErrSSLCannotDelete: "The certificate is being used by the website and cannot be removed"
|
||||||
|
|
|
@ -32,7 +32,8 @@ ErrPathNotFound: "目录不存在"
|
||||||
#website
|
#website
|
||||||
ErrDomainIsExist: "域名已存在"
|
ErrDomainIsExist: "域名已存在"
|
||||||
ErrAliasIsExist: "代号已存在"
|
ErrAliasIsExist: "代号已存在"
|
||||||
ErrAppDelete: '其他网站使用此应用,不能删除'
|
ErrAppDelete: '其他网站使用此应用,无法删除'
|
||||||
|
ErrGroupIsUsed: '分组已经关联网站,无法删除'
|
||||||
|
|
||||||
#ssl
|
#ssl
|
||||||
ErrSSLCannotDelete: "证书正在被网站使用,无法删除"
|
ErrSSLCannotDelete: "证书正在被网站使用,无法删除"
|
||||||
|
|
Loading…
Reference in New Issue