Skip to content

Commit

Permalink
Merge pull request #1375 from Evarisk/8.5.2
Browse files Browse the repository at this point in the history
8.5.2
  • Loading branch information
nicolas-eoxia authored Dec 14, 2021
2 parents 7b6146e + dd7a913 commit 19f473b
Show file tree
Hide file tree
Showing 2 changed files with 1,286 additions and 51 deletions.
34 changes: 4 additions & 30 deletions class/api_digiriskdolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DigiriskDolibarr extends DolibarrApi
*/
public function __construct()
{
global $db, $langs;
global $db;
$this->db = $db;
$this->mod = new modDigiriskdolibarr($this->db);

Expand All @@ -58,7 +58,7 @@ public function __construct()
*/
public function enableModule()
{
global $langs, $user;
global $langs;

require_once DOL_DOCUMENT_ROOT .'/core/modules/modECM.class.php';
require_once DOL_DOCUMENT_ROOT .'/core/modules/modProjet.class.php';
Expand Down Expand Up @@ -102,12 +102,6 @@ public function enableModule()
*/
public function disableModule()
{
global $user;

if (!$user->rights->digiriskdolibarr->api->read) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

return $this->mod->remove();
}

Expand All @@ -124,12 +118,6 @@ public function disableModule()
*/
public function getFilesVersion()
{
global $user;

if (!$user->rights->digiriskdolibarr->api->read) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

return $this->mod->version;
}

Expand All @@ -146,11 +134,7 @@ public function getFilesVersion()
*/
public function getActiveVersion()
{
global $conf, $user;

if (!$user->rights->digiriskdolibarr->api->read) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
global $conf;

return $conf->global->DIGIRISKDOLIBARR_VERSION;
}
Expand All @@ -168,11 +152,7 @@ public function getActiveVersion()
*/
public function getLatestVersion()
{
global $conf, $user;

if (!$user->rights->digiriskdolibarr->api->read) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
global $conf;

return $conf->global->DIGIRISKDOLIBARR_VERSION;
}
Expand All @@ -190,12 +170,6 @@ public function getLatestVersion()
*/
public function uploadNewModule()
{
global $user;

if (!$user->rights->digiriskdolibarr->api->write) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

return exec('cd ../custom/digiriskdolibarr/shell/pull && bash update_version.sh');
}
}
Loading

0 comments on commit 19f473b

Please sign in to comment.