mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: do not allow deleting system domain
This commit is contained in:
1 parent
148dbffa7a
commit
8144e85c14
2 files changed
+5
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.3.7",
|
||||
"version": "3.3.8",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -99,10 +99,11 @@ class DomainEditHandler extends ManageHandler {
|
||||
this.response.redirect = this.url('domain_dashboard');
|
||||
}
|
||||
|
||||
async postDelete({ password }) {
|
||||
async postDelete({ domainId, password }) {
|
||||
this.user.checkPassword(password);
|
||||
if (this.domain.owner === this.user._id) throw new ForbiddenError('You are not the owner of this domain.');
|
||||
await domain.del(this.domainId);
|
||||
if (domainId === 'system') throw new ForbiddenError('You are not allowed to delete system domain');
|
||||
if (this.domain.owner !== this.user._id) throw new ForbiddenError('You are not the owner of this domain.');
|
||||
await domain.del(domainId);
|
||||
this.response.redirect = this.url('home_domain', { domainId: 'system' });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user