mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
f1b6a82387
commit
004ac04de6
@ -47,11 +47,6 @@ class SetupCommand extends Command
|
|||||||
*/
|
*/
|
||||||
public function generateTokenAction()
|
public function generateTokenAction()
|
||||||
{
|
{
|
||||||
if (false === $this->isSuperUser()) {
|
|
||||||
$this->fail($this->translate('This action needs to be run as super user in order to work properly!'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$token = bin2hex(openssl_random_pseudo_bytes(8));
|
$token = bin2hex(openssl_random_pseudo_bytes(8));
|
||||||
$filepath = $this->app->getConfigDir() . '/setup.token';
|
$filepath = $this->app->getConfigDir() . '/setup.token';
|
||||||
|
|
||||||
@ -89,11 +84,6 @@ class SetupCommand extends Command
|
|||||||
*/
|
*/
|
||||||
public function createConfigDirectoryAction()
|
public function createConfigDirectoryAction()
|
||||||
{
|
{
|
||||||
if (false === $this->isSuperUser()) {
|
|
||||||
$this->fail($this->translate('This action needs to be run as super user in order to work properly!'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$group = $this->params->getStandalone();
|
$group = $this->params->getStandalone();
|
||||||
if ($group === null) {
|
if ($group === null) {
|
||||||
$this->fail($this->translate('The `group\' argument is mandatory.'));
|
$this->fail($this->translate('The `group\' argument is mandatory.'));
|
||||||
@ -119,14 +109,4 @@ class SetupCommand extends Command
|
|||||||
|
|
||||||
printf($this->translate("Successfully created configuration directory at: %s\n"), $path);
|
printf($this->translate("Successfully created configuration directory at: %s\n"), $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether the current user is a super user
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function isSuperUser()
|
|
||||||
{
|
|
||||||
return intval(shell_exec('echo $EUID')) === 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user