Commit 559fe83b authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes #3669 Removing services action when there is no argonaut client

Showing with 16 additions and 6 deletions
+16 -6
...@@ -46,7 +46,8 @@ class simpleService extends simplePlugin { ...@@ -46,7 +46,8 @@ class simpleService extends simplePlugin {
{ {
parent::__construct($config, $dn, $object, $attributesInfo); parent::__construct($config, $dn, $object, $attributesInfo);
$plInfos = pluglist::pluginInfos(get_class($this)); $plInfos = pluglist::pluginInfos(get_class($this));
$this->DisplayName = $plInfos['plShortName']; $this->DisplayName = $plInfos['plShortName'];
$this->parent = $object; /* $object is the instance of serverService in this case */
} }
/*! \brief This function display the service and return the html code /*! \brief This function display the service and return the html code
...@@ -84,11 +85,20 @@ class simpleService extends simplePlugin { ...@@ -84,11 +85,20 @@ class simpleService extends simplePlugin {
/* Name displayed in service overview */ /* Name displayed in service overview */
$fields['Message'] = $this->DisplayName; $fields['Message'] = $this->DisplayName;
/* Allow/disallow some functions */ if ($this->showActions && is_object($this->parent->parent) && $this->parent->parent->by_object['argonautClient']->is_account) {
$fields['AllowStatus'] = ($this->status == "") && $this->showActions && $this->acl_is_writeable("start"); /* Allow/disallow some functions */
$fields['AllowStart'] = ($this->status == "stopped") && $this->showActions && $this->acl_is_writeable("start"); $fields['AllowStatus'] = ($this->status == "") && $this->acl_is_writeable("start");
$fields['AllowStop'] = ($this->status == "running") && $this->showActions && $this->acl_is_writeable("stop"); $fields['AllowStart'] = ($this->status == "stopped") && $this->acl_is_writeable("start");
$fields['AllowRestart'] = ($this->status == "running") && $this->showActions && $this->acl_is_writeable("restart"); $fields['AllowStop'] = ($this->status == "running") && $this->acl_is_writeable("stop");
$fields['AllowRestart'] = ($this->status == "running") && $this->acl_is_writeable("restart");
} else {
/* Disable some functions */
$fields['AllowStatus'] = FALSE;
$fields['AllowStart'] = FALSE;
$fields['AllowStop'] = FALSE;
$fields['AllowRestart'] = FALSE;
}
$fields['AllowRemove'] = $this->acl_is_removeable(); $fields['AllowRemove'] = $this->acl_is_removeable();
$fields['AllowEdit'] = $this->acl_is_readable(""); $fields['AllowEdit'] = $this->acl_is_readable("");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment