| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
- namespace ModulesGarden\ProxmoxAddon\App\Services\Cloud;
- use ModulesGarden\ProxmoxAddon\Core\UI\Traits\WhmcsParams;
- use function ModulesGarden\Servers\ProxmoxCloudVps\Core\Helper\sl;
- class AclService
- {
- use ProductService;
- use WhmcsParams;
- public function backup()
- {
- if (!$this->configuration()->isPermissionBackup() && !$this->configuration()->isPermissionBackupJob())
- {
- throw new \Exception(sl("lang")->tr("No access to backup"));
- }
- }
- public function backupJob()
- {
- if (!$this->configuration()->isPermissionBackupJob())
- {
- throw new \Exception(sl("lang")->tr("No access to backup job"));
- }
- }
- public function novnc()
- {
- if (!$this->configuration()->isPermissionNovnc())
- {
- throw new \Exception(sl("lang")->tr("No access to noVNC console"));
- }
- }
- public function xtermjs()
- {
- if (!$this->configuration()->isPermissionXtermjs())
- {
- throw new \Exception(sl("lang")->tr("No access to Xterm.js console"));
- }
- }
- public function spice()
- {
- if (!$this->configuration()->isPermissionSpice())
- {
- throw new \Exception(sl("lang")->tr("No access to spice console"));
- }
- }
- public function disk()
- {
- if (!$this->configuration()->isPermissionDisk())
- {
- throw new \Exception(sl("lang")->tr("No access to disk"));
- }
- }
- public function firewall()
- {
- if (!$this->configuration()->isPermissionFirewall())
- {
- throw new \Exception(sl("lang")->tr("No access to firewall"));
- }
- }
- public function firewallOption()
- {
- if (!$this->configuration()->isPermissionFirewallOption())
- {
- throw new \Exception(sl("lang")->tr("No access to firewall option"));
- }
- }
- public function graph()
- {
- if (!$this->configuration()->isPermissionGraph())
- {
- throw new \Exception(sl("lang")->tr("No access to graph"));
- }
- }
- public function network()
- {
- if (!$this->configuration()->isPermissionNetwork())
- {
- throw new \Exception(sl("lang")->tr("No access to network"));
- }
- }
- public function reinstall()
- {
- if (!$this->configuration()->isPermissionReinstall())
- {
- throw new \Exception(sl("lang")->tr("No access to reinstall"));
- }
- }
- public function snapshot()
- {
- if (!$this->configuration()->isPermissionSnapshot())
- {
- throw new \Exception(sl("lang")->tr("No access to snapshot"));
- }
- }
- public function taskHistory()
- {
- if (!$this->configuration()->isPermissionTaskHistory())
- {
- throw new \Exception(sl("lang")->tr("No access to task history"));
- }
- }
- public function additionalDiskBackup()
- {
- if (!$this->configuration()->isPermissionAdditionalDiskBackup())
- {
- throw new \Exception(sl("lang")->tr("No access to additional disk backup"));
- }
- }
- public function hasFirewallOption($option)
- {
- return in_array( $option, $this->configuration()->getPermissionFirewalOptions());
- }
- public function customTemplate()
- {
- if (!$this->configuration()->isPermissionCustomTemplates())
- {
- throw new \Exception(sl("lang")->tr("No access to Custom Templates"));
- }
- }
- }
|