- Se adiciona la validación con licencia Drive.
- Se elemina codigo que ya no se utiliza.
This commit is contained in:
Marco A. Nina Mena
2016-01-06 09:10:38 -04:00
parent fc9da96341
commit 8d817ce692
3 changed files with 34 additions and 79 deletions

View File

@@ -21,13 +21,7 @@ class PMGoogleApi
private $scope = array(); private $scope = array();
private $serviceAccountEmail; private $serviceAccountEmail;
private $serviceAccountCertificate; private $serviceAccountCertificate;
private $statusService;
private $domain;
private $user; private $user;
private $typeAuthentication;
private $accountJson;
private $serviceGmailStatus = false; private $serviceGmailStatus = false;
private $serviceDriveStatus = false; private $serviceDriveStatus = false;
private $configuration; private $configuration;
@@ -63,30 +57,21 @@ class PMGoogleApi
return $this->user; return $this->user;
} }
public function setStatusService($status)
{
$this->configuration->aConfig['statusService'] = $status;
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->statusService = $status;
}
public function getStatusService()
{
return $this->statusService;
}
public function getConfigGmail() public function getConfigGmail()
{ {
$this->configuration = new Configurations(); $this->configuration = new Configurations();
$this->configuration->loadConfig($gmail, 'GOOGLE_API_SETTINGS', ''); $this->configuration->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
} }
public function setConfigGmail ($id, $value)
{
$this->configuration->aConfig[$id] = $value;
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
}
public function setServiceAccountEmail($serviceAccountEmail) public function setServiceAccountEmail($serviceAccountEmail)
{ {
$this->configuration->aConfig['serviceAccountEmail'] = $serviceAccountEmail; $this->setConfigGmail('serviceAccountEmail', $serviceAccountEmail);
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->serviceAccountEmail = $serviceAccountEmail; $this->serviceAccountEmail = $serviceAccountEmail;
} }
@@ -97,9 +82,7 @@ class PMGoogleApi
public function setServiceAccountCertificate ($serviceAccountCertificate) public function setServiceAccountCertificate ($serviceAccountCertificate)
{ {
$this->configuration->aConfig['serviceAccountCertificate'] = $serviceAccountCertificate; $this->setConfigGmail('serviceAccountCertificate', $serviceAccountCertificate);
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->serviceAccountCertificate = $serviceAccountCertificate; $this->serviceAccountCertificate = $serviceAccountCertificate;
} }
@@ -108,50 +91,13 @@ class PMGoogleApi
return $this->serviceAccountCertificate; return $this->serviceAccountCertificate;
} }
public function setDomain($domain)
{
$this->configuration->aConfig['domain'] = $domain;
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->domain = $domain;
}
public function getDomain()
{
return $this->domain;
}
public function setTypeAuthentication($type)
{
$this->configuration->aConfig['typeAuthentication'] = $type;
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->typeAuthentication = $type;
}
public function getTypeAuthentication()
{
return $this->typeAuthentication;
}
public function setAccountJson($accountJson)
{
$this->configuration->aConfig['accountJson'] = $accountJson;
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->accountJson = $accountJson;
}
public function getAccountJson()
{
return $this->accountJson;
}
public function setServiceGmailStatus($status) public function setServiceGmailStatus($status)
{ {
$this->configuration->aConfig['serviceGmailStatus'] = $status; $licensedFeatures = &PMLicensedFeatures::getSingleton();
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', ''); if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$status = false;
}
$this->setConfigGmail('serviceGmailStatus', $status);
$this->serviceGmailStatus = $status; $this->serviceGmailStatus = $status;
} }
@@ -162,9 +108,11 @@ class PMGoogleApi
public function setServiceDriveStatus($status) public function setServiceDriveStatus($status)
{ {
$this->configuration->aConfig['serviceDriveStatus'] = $status; $licensedFeatures = &PMLicensedFeatures::getSingleton();
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', ''); if (!$licensedFeatures->verifyfeature('AhKNjBEVXZlWUFpWE8wVTREQ0FObmo0aTdhVzhvalFic1M=')) {
$status = false;
}
$this->setConfigGmail('serviceDriveStatus', $status);
$this->serviceDriveStatus = $status; $this->serviceDriveStatus = $status;
} }
@@ -181,23 +129,15 @@ class PMGoogleApi
{ {
$this->getConfigGmail(); $this->getConfigGmail();
$typeAuthentication = empty($this->configuration->aConfig['typeAuthentication']) ? '' : $this->configuration->aConfig['typeAuthentication'];
$accountJson = empty($this->configuration->aConfig['accountJson']) ? '' : $this->configuration->aConfig['accountJson'];
$serviceAccountCertificate = empty($this->configuration->aConfig['serviceAccountCertificate']) ? '' : $this->configuration->aConfig['serviceAccountCertificate']; $serviceAccountCertificate = empty($this->configuration->aConfig['serviceAccountCertificate']) ? '' : $this->configuration->aConfig['serviceAccountCertificate'];
$serviceAccountEmail = empty($this->configuration->aConfig['serviceAccountEmail']) ? '' : $this->configuration->aConfig['serviceAccountEmail']; $serviceAccountEmail = empty($this->configuration->aConfig['serviceAccountEmail']) ? '' : $this->configuration->aConfig['serviceAccountEmail'];
$statusService = empty($this->configuration->aConfig['statusService']) ? '' : $this->configuration->aConfig['statusService'];
$serviceGmailStatus = empty($this->configuration->aConfig['serviceGmailStatus']) ? false : $this->configuration->aConfig['serviceGmailStatus']; $serviceGmailStatus = empty($this->configuration->aConfig['serviceGmailStatus']) ? false : $this->configuration->aConfig['serviceGmailStatus'];
$serviceDriveStatus = empty($this->configuration->aConfig['serviceDriveStatus']) ? false : $this->configuration->aConfig['serviceDriveStatus']; $serviceDriveStatus = empty($this->configuration->aConfig['serviceDriveStatus']) ? false : $this->configuration->aConfig['serviceDriveStatus'];
$this->scope = array(); $this->scope = array();
$this->typeAuthentication = $typeAuthentication;
$this->accountJson = $accountJson;
$this->serviceAccountEmail = $serviceAccountEmail; $this->serviceAccountEmail = $serviceAccountEmail;
$this->serviceAccountCertificate = $serviceAccountCertificate; $this->serviceAccountCertificate = $serviceAccountCertificate;
$this->statusService = $statusService;
$this->serviceGmailStatus = $serviceGmailStatus; $this->serviceGmailStatus = $serviceGmailStatus;
$this->serviceDriveStatus = $serviceDriveStatus; $this->serviceDriveStatus = $serviceDriveStatus;
} }

View File

@@ -45,7 +45,8 @@ class pmGmail extends Controller
} }
} }
} else { } else {
$pmGoogle->setStatusService(false); $pmGoogle->setServiceGmailStatus(false);
$pmGoogle->setServiceDriveStatus(false);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE'); $message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
} }
G::auditLog("Update Settings Gmail", $message); G::auditLog("Update Settings Gmail", $message);
@@ -67,11 +68,23 @@ class pmGmail extends Controller
$googleCertificate = $pmGoogle->getServiceAccountCertificate(); $googleCertificate = $pmGoogle->getServiceAccountCertificate();
$statusGmail = $pmGoogle->getServiceGmailStatus(); $statusGmail = $pmGoogle->getServiceGmailStatus();
$statusDrive = $pmGoogle->getServiceDriveStatus(); $statusDrive = $pmGoogle->getServiceDriveStatus();
$disableGmail = true;
$disableDrive = true;
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$disableGmail = false;
}
if ($licensedFeatures->verifyfeature('AhKNjBEVXZlWUFpWE8wVTREQ0FObmo0aTdhVzhvalFic1M=')) {
$disableDrive = false;
}
$this->setJSVar('accountEmail', $accountEmail); $this->setJSVar('accountEmail', $accountEmail);
$this->setJSVar('googleCertificate', $googleCertificate); $this->setJSVar('googleCertificate', $googleCertificate);
$this->setJSVar('statusGmail', $statusGmail); $this->setJSVar('statusGmail', $statusGmail);
$this->setJSVar('statusDrive', $statusDrive); $this->setJSVar('statusDrive', $statusDrive);
$this->setJSVar('disableGmail', $disableGmail);
$this->setJSVar('disableDrive', $disableDrive);
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');

View File

@@ -56,6 +56,7 @@ Ext.onReady(function() {
value: 0, value: 0,
inputValue: 1, inputValue: 1,
uncheckedValue: 0, uncheckedValue: 0,
disabled: disableGmail,
listeners : { listeners : {
check : function(that, checked) { check : function(that, checked) {
disableAll(); disableAll();
@@ -96,6 +97,7 @@ Ext.onReady(function() {
value: 0, value: 0,
inputValue: 1, inputValue: 1,
uncheckedValue: 0, uncheckedValue: 0,
disabled: disableDrive,
listeners : { listeners : {
check : function(that, checked) { check : function(that, checked) {
disableAll(); disableAll();