This commit is contained in:
Dennis Smink
2020-09-24 15:26:26 +02:00
parent 680d96882a
commit 5b48d204a0
17 changed files with 78 additions and 54 deletions

View File

@@ -80,6 +80,8 @@ class SiteController extends Controller
{
$site = auth()->user()->sites()->findOrFail($id);
$this->authorize('delete', $site);
dispatch(new DeleteSite($site->server->ploi_id, $site->ploi_id));
$site->delete();

View File

@@ -11,6 +11,8 @@ class SiteSettingController extends Controller
{
$site = auth()->user()->sites()->findOrFail($id);
$this->authorize('update', $site);
$availablePhpVersions = $site->server->available_php_versions;
return inertia('Sites/Settings', [
@@ -23,6 +25,8 @@ class SiteSettingController extends Controller
{
$site = $request->user()->sites()->findOrFail($id);
$this->authorize('update', $site);
$site->update($request->all());
return redirect()->route('sites.settings.show', $id)->with('success', __('Site settings have been updated'));
@@ -32,6 +36,8 @@ class SiteSettingController extends Controller
{
$site = $request->user()->sites()->findOrFail($id);
$this->authorize('update', $site);
dispatch(new ChangePhpVersion($site, $request->input('version')));
$request->user()->systemLogs()->create([

4
public/js/12.js vendored
View File

@@ -347,11 +347,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/17.js vendored
View File

@@ -340,11 +340,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/18.js vendored
View File

@@ -404,11 +404,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/19.js vendored
View File

@@ -338,11 +338,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

69
public/js/20.js vendored
View File

@@ -295,11 +295,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'
@@ -629,35 +629,44 @@ var render = function() {
])
}),
_vm._v(" "),
_c("SettingsSegment", {
scopedSlots: _vm._u([
{
key: "title",
fn: function() {
return [
_vm._v(_vm._s(_vm.__("Danger zone")))
]
},
proxy: true
},
{
key: "content",
fn: function() {
return [
_c(
"Button",
{
attrs: { variant: "danger" },
on: { click: _vm.confirmDelete }
_vm.can("sites", "delete")
? _c("SettingsSegment", {
scopedSlots: _vm._u(
[
{
key: "title",
fn: function() {
return [
_vm._v(
_vm._s(_vm.__("Danger zone"))
)
]
},
[_vm._v(_vm._s(_vm.__("Delete")))]
)
]
},
proxy: true
}
])
})
proxy: true
},
{
key: "content",
fn: function() {
return [
_c(
"Button",
{
attrs: { variant: "danger" },
on: { click: _vm.confirmDelete }
},
[_vm._v(_vm._s(_vm.__("Delete")))]
)
]
},
proxy: true
}
],
null,
false,
253833427
)
})
: _vm._e()
]
},
proxy: true

4
public/js/24.js vendored
View File

@@ -311,11 +311,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/33.js vendored
View File

@@ -288,11 +288,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/43.js vendored
View File

@@ -343,11 +343,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

4
public/js/45.js vendored
View File

@@ -444,7 +444,7 @@ var render = function() {
return _c(
"Page",
[
_vm.$page.auth.can.sites.create
_vm.can("sites", "create")
? _c(
"Portal",
{ attrs: { to: "modals" } },
@@ -583,7 +583,7 @@ var render = function() {
},
proxy: true
},
_vm.$page.auth.can.sites.create
_vm.can("sites", "create")
? {
key: "end",
fn: function() {

4
public/js/66.js vendored
View File

@@ -57,11 +57,11 @@ __webpack_require__.r(__webpack_exports__);
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
} : null, {
} : null, this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
}, {
} : null, {
title: this.__('View site'),
to: "http://".concat(this.site.domain),
type: 'a'

5
public/js/app.js vendored
View File

@@ -43,7 +43,7 @@
/******/
/******/ // script path function
/******/ function jsonpScriptSrc(chunkId) {
/******/ return __webpack_require__.p + "js/" + ({}[chunkId]||chunkId) + ".js?id=" + {"0":"0dcde053981f92959e59","1":"86db8ab9924d3be9307f","2":"e3b2b0aba5a1f9a18fe2","3":"7fdc1d14f65f44d0a5a3","4":"7fecf1f18f5ef974d222","5":"fbfbcf45610d060d921e","6":"ab69c8c404f9ccac65db","7":"140acb8c38018bb7c822","8":"2d3a3827a4fce6452a33","9":"c031adc013e72d8ca02e","10":"c99079a545f555af1d52","11":"9822093766328e344db8","12":"b3fc82c5505d1cfa7ddc","13":"82586eff842dd81a3514","14":"565bfaff62d8837441ea","15":"1145f698c07761ab21b9","16":"a71a4de4db813926d9fa","17":"8715d645a6960909b0be","18":"d57099401b23b45edcc8","19":"b8f90e39a34bc8b6f186","20":"c987356baaaceb82c365","21":"805ff5beffc848caac4e","22":"f77c6d6e204f3cb79333","23":"22dba52fed989ff789db","24":"39ab3d78672bb9a4dbbf","25":"3c868424322f0c4f4122","26":"f916f092e6e60b8d9892","27":"e5ac13ee4b4b7b6bd182","28":"f5669cef6146d069dd10","29":"7d89c6ed3820cf473a89","30":"af0a027b779bdad9adc4","31":"389c470db645e09d77fa","32":"955c99fe365280bd58a8","33":"3b12573698121b34d094","34":"5e120af5778f25fcb316","35":"44dfcd0fba07ec8e5547","36":"9d942601049dde1e2a2d","37":"bfed5c07e7ee3fc0b707","38":"16bb218999b061d4519f","39":"c589edfad2d14c661cb9","40":"445401b2a74ee2481c0c","41":"7eeb8744789f16540899","42":"48e7726657cdf11826c4","43":"47dcbade590b0ea66800","44":"ef5fc07ba97aa3e5f709","45":"ddcaf543cfe1b34d2154","46":"c999693fd1694c60295a","47":"affd17daf77561a07c7d","48":"e35f12fe5de48f8b0f28","49":"b502cb18b8d71e1baa5b","50":"9af9d482ea3ffa0c93b2","51":"07d6e2ad89db070a56a1","52":"e4e922eff257260d359c","53":"b30bfd568d33215522db","54":"3b2970d95700196e4ba7","55":"ab1a326cc947bf1bd794","56":"41cc9242493164547764","57":"e27a77c9376f068e9ed0","58":"352754e15a363a0d7a52","59":"e8ef223faaa64f938963","60":"1ee8c2d102b81a93f967","61":"23a0a707a4957c44012a","62":"73ef6e9e4624ea20ecf8","63":"79824fab0c635c0314d7","64":"6e8deaf9221575abd5c2","65":"b1ed2e2b326333a52ee5","66":"8adb116b3d8bcdcbb5aa","67":"a520d6a255c719de6184","68":"e997f3fa1d28a03c1a98","69":"c9af53d04391b191e7a0","70":"9f6377148a2b6a449eb1"}[chunkId] + ""
/******/ return __webpack_require__.p + "js/" + ({}[chunkId]||chunkId) + ".js?id=" + {"0":"0dcde053981f92959e59","1":"86db8ab9924d3be9307f","2":"e3b2b0aba5a1f9a18fe2","3":"7fdc1d14f65f44d0a5a3","4":"7fecf1f18f5ef974d222","5":"fbfbcf45610d060d921e","6":"ab69c8c404f9ccac65db","7":"140acb8c38018bb7c822","8":"2d3a3827a4fce6452a33","9":"c031adc013e72d8ca02e","10":"c99079a545f555af1d52","11":"9822093766328e344db8","12":"1e8381032277b3fa5765","13":"82586eff842dd81a3514","14":"565bfaff62d8837441ea","15":"1145f698c07761ab21b9","16":"a71a4de4db813926d9fa","17":"d32c99bbb58853d57645","18":"244a4db3b3442c941082","19":"7988878c243c587316bc","20":"6f7e1cd9737dd719ffb8","21":"805ff5beffc848caac4e","22":"f77c6d6e204f3cb79333","23":"22dba52fed989ff789db","24":"443e79d02bbb0daecd8c","25":"3c868424322f0c4f4122","26":"f916f092e6e60b8d9892","27":"e5ac13ee4b4b7b6bd182","28":"f5669cef6146d069dd10","29":"7d89c6ed3820cf473a89","30":"af0a027b779bdad9adc4","31":"389c470db645e09d77fa","32":"955c99fe365280bd58a8","33":"04c7cdf42dc5a6e9af1b","34":"5e120af5778f25fcb316","35":"44dfcd0fba07ec8e5547","36":"9d942601049dde1e2a2d","37":"bfed5c07e7ee3fc0b707","38":"16bb218999b061d4519f","39":"c589edfad2d14c661cb9","40":"445401b2a74ee2481c0c","41":"7eeb8744789f16540899","42":"48e7726657cdf11826c4","43":"6e07f2b7dbd39ef3b48d","44":"ef5fc07ba97aa3e5f709","45":"6fe09e0d9013679f4116","46":"c999693fd1694c60295a","47":"affd17daf77561a07c7d","48":"e35f12fe5de48f8b0f28","49":"b502cb18b8d71e1baa5b","50":"9af9d482ea3ffa0c93b2","51":"07d6e2ad89db070a56a1","52":"e4e922eff257260d359c","53":"b30bfd568d33215522db","54":"3b2970d95700196e4ba7","55":"ab1a326cc947bf1bd794","56":"41cc9242493164547764","57":"e27a77c9376f068e9ed0","58":"352754e15a363a0d7a52","59":"e8ef223faaa64f938963","60":"1ee8c2d102b81a93f967","61":"23a0a707a4957c44012a","62":"73ef6e9e4624ea20ecf8","63":"79824fab0c635c0314d7","64":"6e8deaf9221575abd5c2","65":"b1ed2e2b326333a52ee5","66":"b2e44d0a4afa96722ef4","67":"a520d6a255c719de6184","68":"e997f3fa1d28a03c1a98","69":"c9af53d04391b191e7a0","70":"9f6377148a2b6a449eb1"}[chunkId] + ""
/******/ }
/******/
/******/ // The require function
@@ -21570,6 +21570,9 @@ module.exports = {
}
return s;
},
can: function can(subject, permission) {
return this.$page.auth.can[subject][permission];
}
}
};

View File

@@ -1,6 +1,6 @@
<template>
<Page>
<Portal to="modals" v-if="$page.auth.can.sites.create">
<Portal to="modals" v-if="can('sites', 'create')">
<ModalContainer>
<Modal @close="closeModal" v-if="modalIsOpen" @submit="submit">
<template #title>{{ __('Create a site') }}</template>
@@ -29,7 +29,7 @@
<template #start>
<PageHeaderTitle>{{ __('Sites') }}</PageHeaderTitle>
</template>
<template v-if="$page.auth.can.sites.create" #end>
<template v-if="can('sites', 'create')" #end>
<Button @click="modalIsOpen = true">{{ __('Create site') }}</Button>
</template>
</PageHeader>

View File

@@ -68,7 +68,7 @@
<!-- </template>-->
<!-- </SettingsSegment>-->
<SettingsSegment>
<SettingsSegment v-if="can('sites', 'delete')">
<template #title>{{ __('Danger zone') }}</template>
<template #content>
<Button @click="confirmDelete" variant="danger">{{ __('Delete') }}</Button>

View File

@@ -56,11 +56,11 @@
to: this.route('sites.dns.index', this.site.id),
active: this.route().current('sites.dns.index')
}: null,
{
this.can('sites', 'update') ? {
title: this.__('Settings'),
to: this.route('sites.settings.show', this.site.id),
active: this.route().current('sites.settings.show')
},
} : null,
{
title: this.__('View site'),
to: `http://${this.site.domain}`,

View File

@@ -33,5 +33,9 @@ module.exports = {
}
return s;
},
can(subject, permission) {
return this.$page.auth.can[subject][permission];
}
}
};