GI-237 Añadir propiedades en clase GoogleApi que indiquen estado habilitación Gmail y Drive
- Se añadio 2 propiedades $serviceDriveStatus, $serviceGmailStatus
This commit is contained in:
@@ -28,6 +28,10 @@ class PMGoogleApi
|
|||||||
private $typeAuthentication;
|
private $typeAuthentication;
|
||||||
private $accountJson;
|
private $accountJson;
|
||||||
|
|
||||||
|
private $serviceGmailStatus = false;
|
||||||
|
private $serviceDriveStatus = false;
|
||||||
|
private $configuration;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||||
@@ -61,10 +65,8 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function setStatusService($status)
|
public function setStatusService($status)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['statusService'] = $status;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['statusService'] = $status;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->statusService = $status;
|
$this->statusService = $status;
|
||||||
}
|
}
|
||||||
@@ -76,17 +78,14 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function getConfigGmail()
|
public function getConfigGmail()
|
||||||
{
|
{
|
||||||
$conf = new Configurations();
|
$this->configuration = new Configurations();
|
||||||
$conf->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
|
$this->configuration->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
|
||||||
return $conf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setServiceAccountEmail($serviceAccountEmail)
|
public function setServiceAccountEmail($serviceAccountEmail)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['serviceAccountEmail'] = $serviceAccountEmail;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['serviceAccountEmail'] = $serviceAccountEmail;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->serviceAccountEmail = $serviceAccountEmail;
|
$this->serviceAccountEmail = $serviceAccountEmail;
|
||||||
}
|
}
|
||||||
@@ -98,10 +97,8 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function setServiceAccountP12($serviceAccountP12)
|
public function setServiceAccountP12($serviceAccountP12)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['serviceAccountP12'] = $serviceAccountP12;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['serviceAccountP12'] = $serviceAccountP12;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->serviceAccountP12 = $serviceAccountP12;
|
$this->serviceAccountP12 = $serviceAccountP12;
|
||||||
}
|
}
|
||||||
@@ -113,10 +110,8 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function setDomain($domain)
|
public function setDomain($domain)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['domain'] = $domain;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['domain'] = $domain;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->domain = $domain;
|
$this->domain = $domain;
|
||||||
}
|
}
|
||||||
@@ -128,10 +123,8 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function setTypeAuthentication($type)
|
public function setTypeAuthentication($type)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['typeAuthentication'] = $type;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['typeAuthentication'] = $type;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->typeAuthentication = $type;
|
$this->typeAuthentication = $type;
|
||||||
}
|
}
|
||||||
@@ -143,10 +136,8 @@ class PMGoogleApi
|
|||||||
|
|
||||||
public function setAccountJson($accountJson)
|
public function setAccountJson($accountJson)
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->configuration->aConfig['accountJson'] = $accountJson;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
$conf->aConfig['accountJson'] = $accountJson;
|
|
||||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
|
||||||
|
|
||||||
$this->accountJson = $accountJson;
|
$this->accountJson = $accountJson;
|
||||||
}
|
}
|
||||||
@@ -156,29 +147,59 @@ class PMGoogleApi
|
|||||||
return $this->accountJson;
|
return $this->accountJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setServiceGmailStatus($status)
|
||||||
|
{
|
||||||
|
$this->configuration->aConfig['serviceGmailStatus'] = $status;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
|
|
||||||
|
$this->serviceGmailStatus = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServiceGmailStatus()
|
||||||
|
{
|
||||||
|
return $this->serviceGmailStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setServiceDriveStatus($status)
|
||||||
|
{
|
||||||
|
$this->configuration->aConfig['serviceDriveStatus'] = $status;
|
||||||
|
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||||
|
|
||||||
|
$this->serviceDriveStatus = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServiceDriveStatus()
|
||||||
|
{
|
||||||
|
return $this->serviceDriveStatus;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load configuration gmail service account
|
* load configuration gmail service account
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function loadSettings()
|
public function loadSettings()
|
||||||
{
|
{
|
||||||
$conf = $this->getConfigGmail();
|
$this->getConfigGmail();
|
||||||
|
|
||||||
$typeAuthentication = empty($conf->aConfig['typeAuthentication']) ? '' : $conf->aConfig['typeAuthentication'];
|
$typeAuthentication = empty($this->configuration->aConfig['typeAuthentication']) ? '' : $this->configuration->aConfig['typeAuthentication'];
|
||||||
$accountJson = empty($conf->aConfig['accountJson']) ? '' : $conf->aConfig['accountJson'];
|
$accountJson = empty($this->configuration->aConfig['accountJson']) ? '' : $this->configuration->aConfig['accountJson'];
|
||||||
|
|
||||||
$serviceAccountP12 = empty($conf->aConfig['serviceAccountP12']) ? '' : $conf->aConfig['serviceAccountP12'];
|
$serviceAccountP12 = empty($this->configuration->aConfig['serviceAccountP12']) ? '' : $this->configuration->aConfig['serviceAccountP12'];
|
||||||
$serviceAccountEmail = empty($conf->aConfig['serviceAccountEmail']) ? '' : $conf->aConfig['serviceAccountEmail'];
|
$serviceAccountEmail = empty($this->configuration->aConfig['serviceAccountEmail']) ? '' : $this->configuration->aConfig['serviceAccountEmail'];
|
||||||
$statusService = empty($conf->aConfig['statusService']) ? '' : $conf->aConfig['statusService'];
|
$statusService = empty($this->configuration->aConfig['statusService']) ? '' : $this->configuration->aConfig['statusService'];
|
||||||
|
|
||||||
|
$serviceGmailStatus = empty($this->configuration->aConfig['serviceGmailStatus']) ? '' : $this->configuration->aConfig['serviceGmailStatus'];
|
||||||
|
$serviceDriveStatus = empty($this->configuration->aConfig['serviceDriveStatus']) ? '' : $this->configuration->aConfig['serviceDriveStatus'];
|
||||||
|
|
||||||
$this->scope = array();
|
$this->scope = array();
|
||||||
|
|
||||||
$this->setTypeAuthentication($typeAuthentication);
|
$this->typeAuthentication = $typeAuthentication;
|
||||||
$this->setAccountJson($accountJson);
|
$this->accountJson = $accountJson;
|
||||||
|
$this->serviceAccountEmail = $serviceAccountEmail;
|
||||||
$this->setServiceAccountEmail($serviceAccountEmail);
|
$this->serviceAccountP12 = $serviceAccountP12;
|
||||||
$this->setServiceAccountP12($serviceAccountP12);
|
$this->statusService = $statusService;
|
||||||
$this->setStatusService($statusService);
|
$this->serviceGmailStatus = $serviceGmailStatus;
|
||||||
|
$this->serviceDriveStatus = $serviceDriveStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ class pmGmail extends Controller
|
|||||||
|
|
||||||
if (!empty($httpData->status_pmgmail)) {
|
if (!empty($httpData->status_pmgmail)) {
|
||||||
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
|
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
|
||||||
|
//$httpData->seriveGmailStatus = $httpData->seriveGmailStatus == 1 ? true : false;
|
||||||
|
//$httpData->seriveDriveStatus = $httpData->seriveDriveStatus == 1 ? true : false;
|
||||||
$pmGoogle->setStatusService($httpData->status_pmgmail);
|
$pmGoogle->setStatusService($httpData->status_pmgmail);
|
||||||
|
//$pmGoogle->setServiceGmailStatus($httpData->seriveGmailStatus);
|
||||||
|
//$pmGoogle->setServiceDriveStatus($httpData->seriveDriveStatus);
|
||||||
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
|
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
|
||||||
|
|
||||||
$pmGoogle->setTypeAuthentication($httpData->typeAuth);
|
$pmGoogle->setTypeAuthentication($httpData->typeAuth);
|
||||||
|
|||||||
Reference in New Issue
Block a user