Merged in feature/PMCORE-2860 (pull request #7882)
PMCORE-2860 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -12,6 +12,7 @@ use ProcessMaker\Model\Groupwf;
|
||||
*/
|
||||
class LdapAdvanced
|
||||
{
|
||||
|
||||
/**
|
||||
* The authsource id
|
||||
* @var String
|
||||
@@ -783,10 +784,18 @@ class LdapAdvanced
|
||||
$cookie = '';
|
||||
|
||||
do {
|
||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["limit" => $limit]);
|
||||
|
||||
$searchResult = @ldap_list($ldapcnn, $dn, $filter, $this->arrayAttributesForUser);
|
||||
$searchResult = @ldap_list(
|
||||
$ldapcnn,
|
||||
$dn,
|
||||
$filter,
|
||||
$this->arrayAttributesForUser,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
LDAP_DEREF_NEVER,
|
||||
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||
);
|
||||
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||
$this->stdLog($ldapcnn, "ldap_list", ["filter" => $filter, "attributes" => $this->arrayAttributesForUser]);
|
||||
|
||||
if ($error = ldap_errno($ldapcnn)) {
|
||||
@@ -805,10 +814,15 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
if (!$flagError) {
|
||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
|
||||
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||
// You need to pass the cookie from the last call to the next one
|
||||
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||
} else {
|
||||
$cookie = '';
|
||||
}
|
||||
}
|
||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
||||
// Empty cookie means last page
|
||||
} while (!empty($cookie) && !$flagError);
|
||||
|
||||
//Get Users //2
|
||||
if ($flagError) {
|
||||
@@ -1773,10 +1787,20 @@ class LdapAdvanced
|
||||
$cookie = '';
|
||||
|
||||
do {
|
||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
|
||||
$searchResult = @ldap_search(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||
$filter,
|
||||
['dn', 'ou'],
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
LDAP_DEREF_NEVER,
|
||||
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||
);
|
||||
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'ou']]);
|
||||
|
||||
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'ou']);
|
||||
$context = [
|
||||
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||
"filter" => $filter,
|
||||
@@ -1832,10 +1856,15 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
if (!$flagError) {
|
||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response", $context);
|
||||
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||
// You need to pass the cookie from the last call to the next one
|
||||
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||
} else {
|
||||
$cookie = '';
|
||||
}
|
||||
}
|
||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
||||
// Empty cookie means last page
|
||||
} while (!empty($cookie) && !$flagError);
|
||||
|
||||
$str = '';
|
||||
|
||||
@@ -1979,6 +2008,7 @@ class LdapAdvanced
|
||||
|
||||
return $terminated;
|
||||
}
|
||||
|
||||
/* activate an user previously deactivated
|
||||
if user is now in another department, we need the second parameter, the depUid
|
||||
|
||||
@@ -2418,10 +2448,20 @@ class LdapAdvanced
|
||||
$cookie = '';
|
||||
|
||||
do {
|
||||
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
|
||||
$searchResult = @ldap_search(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||
$filter,
|
||||
['dn', 'cn'],
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
LDAP_DEREF_NEVER,
|
||||
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
|
||||
);
|
||||
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
|
||||
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'cn']]);
|
||||
|
||||
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'cn']);
|
||||
$context = [
|
||||
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
|
||||
"filter" => $filter,
|
||||
@@ -2459,10 +2499,15 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
if (!$flagError) {
|
||||
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
|
||||
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
|
||||
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
|
||||
// You need to pass the cookie from the last call to the next one
|
||||
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
|
||||
} else {
|
||||
$cookie = '';
|
||||
}
|
||||
}
|
||||
} while (($cookie !== null && $cookie != '') && !$flagError);
|
||||
// Empty cookie means last page
|
||||
} while (!empty($cookie) && !$flagError);
|
||||
|
||||
$str = '';
|
||||
|
||||
@@ -3244,4 +3289,5 @@ class LdapAdvanced
|
||||
Log::channel(':ldapAdvanced')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,19 +168,19 @@ class PMmemcached
|
||||
echo "<tr><td>Cumulative number of retrieval requests </td><td>" . $status["cmd_get"] . "</td></tr>";
|
||||
echo "<tr><td> Cumulative number of storage requests </td><td>" . $status["cmd_set"] . "</td></tr>";
|
||||
|
||||
$percCacheHit = ((real) $status["get_hits"] / (real) $status["cmd_get"] * 100);
|
||||
$percCacheHit = ((float) $status["get_hits"] / (float) $status["cmd_get"] * 100);
|
||||
$percCacheHit = round( $percCacheHit, 3 );
|
||||
$percCacheMiss = 100 - $percCacheHit;
|
||||
|
||||
echo "<tr><td>Number of keys that have been requested and found present </td><td>" . $status["get_hits"] . " ($percCacheHit%)</td></tr>";
|
||||
echo "<tr><td>Number of items that have been requested and not found </td><td>" . $status["get_misses"] . "($percCacheMiss%)</td></tr>";
|
||||
|
||||
$MBRead = (real) $status["bytes_read"] / (1024 * 1024);
|
||||
$MBRead = (float) $status["bytes_read"] / (1024 * 1024);
|
||||
|
||||
echo "<tr><td>Total number of bytes read by this server from network </td><td>" . $MBRead . " Mega Bytes</td></tr>";
|
||||
$MBWrite = (real) $status["bytes_written"] / (1024 * 1024);
|
||||
$MBWrite = (float) $status["bytes_written"] / (1024 * 1024);
|
||||
echo "<tr><td>Total number of bytes sent by this server to network </td><td>" . $MBWrite . " Mega Bytes</td></tr>";
|
||||
$MBSize = (real) $status["limit_maxbytes"] / (1024 * 1024);
|
||||
$MBSize = (float) $status["limit_maxbytes"] / (1024 * 1024);
|
||||
echo "<tr><td>Number of bytes this server is allowed to use for storage.</td><td>" . $MBSize . " Mega Bytes</td></tr>";
|
||||
echo "<tr><td>Number of valid items removed from cache to free memory for new items.</td><td>" . $status["evictions"] . "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
@@ -504,7 +504,7 @@ class Padl
|
||||
mt_srand($seed);
|
||||
|
||||
for ($i = 0; $length > $i; $i++) {
|
||||
$str .= $seeds{mt_rand(0, $seeds_count - 1)};
|
||||
$str .= $seeds[mt_rand(0, $seeds_count - 1)];
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ class ReportTables
|
||||
}
|
||||
$string = $appData[$field['sFieldName']];
|
||||
if (is_array($string)) {
|
||||
$string = implode($string, ",");
|
||||
$string = implode(",", $string);
|
||||
}
|
||||
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? mysqli_real_escape_string($connection->getResource(), $string) : '') . "'";
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PHPMailer\PHPMailer\OAuth;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
@@ -519,18 +521,18 @@ class SpoolRun
|
||||
case 'PHPMAILER':
|
||||
case 'IMAP':
|
||||
case 'GMAILAPI':
|
||||
case 'OFFICE365API':
|
||||
$phpMailer = new PHPMailer();
|
||||
switch ($this->config['MESS_ENGINE']) {
|
||||
case 'MAIL':
|
||||
$phpMailer = new PHPMailer();
|
||||
$phpMailer->Mailer = 'mail';
|
||||
break;
|
||||
case 'IMAP':
|
||||
case 'PHPMAILER':
|
||||
$phpMailer = new PHPMailer(true);
|
||||
$phpMailer->Mailer = 'smtp';
|
||||
break;
|
||||
case 'GMAILAPI':
|
||||
$phpMailer = new PHPMailerOAuth();
|
||||
case 'OFFICE365API':
|
||||
$phpMailer->AuthType = 'XOAUTH2';
|
||||
$phpMailer->isSMTP();
|
||||
break;
|
||||
@@ -544,6 +546,7 @@ class SpoolRun
|
||||
case 'IMAP':
|
||||
case 'PHPMAILER':
|
||||
case 'GMAILAPI':
|
||||
case 'OFFICE365API':
|
||||
//Posible Options for SMTPSecure are: "", "ssl" or "tls"
|
||||
if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) {
|
||||
$phpMailer->SMTPSecure = $this->config['SMTPSecure'];
|
||||
@@ -558,14 +561,42 @@ class SpoolRun
|
||||
$phpMailer->Encoding = "8bit";
|
||||
$phpMailer->Host = $this->config['MESS_SERVER'];
|
||||
$phpMailer->Port = $this->config['MESS_PORT'];
|
||||
if ($this->config['MESS_ENGINE'] !== 'GMAILAPI') {
|
||||
if (!in_array($this->config['MESS_ENGINE'], ['GMAILAPI', 'OFFICE365API'])) {
|
||||
$phpMailer->Username = $this->config['MESS_ACCOUNT'];
|
||||
$phpMailer->Password = $this->config['MESS_PASSWORD'];
|
||||
} else {
|
||||
$phpMailer->oauthUserEmail = $this->config['MESS_ACCOUNT'];
|
||||
$phpMailer->oauthClientId = $this->config['OAUTH_CLIENT_ID'];
|
||||
$phpMailer->oauthClientSecret = $this->config['OAUTH_CLIENT_SECRET'];
|
||||
$phpMailer->oauthRefreshToken = $this->config['OAUTH_REFRESH_TOKEN'];
|
||||
// Get provider
|
||||
switch ($this->config['MESS_ENGINE']) {
|
||||
case 'GMAILAPI':
|
||||
$providerClass = '\League\OAuth2\Client\Provider\Google';
|
||||
break;
|
||||
case 'OFFICE365API':
|
||||
$providerClass = '\Stevenmaguire\OAuth2\Client\Provider\Microsoft';
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Only Google and Microsoft OAuth2 providers are currently supported.');
|
||||
break;
|
||||
}
|
||||
$provider = new $providerClass(
|
||||
[
|
||||
'clientId' => $this->config['OAUTH_CLIENT_ID'],
|
||||
'clientSecret' => $this->config['OAUTH_CLIENT_SECRET'],
|
||||
'accessType' => 'offline'
|
||||
]
|
||||
);
|
||||
|
||||
// Set OAuth to use
|
||||
$phpMailer->setOAuth(
|
||||
new OAuth(
|
||||
[
|
||||
'provider' => $provider,
|
||||
'clientId' => $this->config['OAUTH_CLIENT_ID'],
|
||||
'clientSecret' => $this->config['OAUTH_CLIENT_SECRET'],
|
||||
'refreshToken' => $this->config['OAUTH_REFRESH_TOKEN'],
|
||||
'userName' => $this->config['MESS_ACCOUNT']
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//From
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use App\Jobs\EmailEvent;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
use ProcessMaker\BusinessModel\Cases\Unassigned;
|
||||
use ProcessMaker\BusinessModel\EmailServer;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\ChangeLog\ChangeLog;
|
||||
@@ -541,41 +542,33 @@ class WsBase
|
||||
/**
|
||||
* Get unassigned case list
|
||||
*
|
||||
* @param string $userId
|
||||
* @param string $userUid
|
||||
*
|
||||
* @return $result will return an object
|
||||
*/
|
||||
public function unassignedCaseList($userId)
|
||||
public function unassignedCaseList($userUid)
|
||||
{
|
||||
try {
|
||||
$result = [];
|
||||
$oAppCache = new AppCacheView();
|
||||
$Criteria = $oAppCache->getUnassignedListCriteria($userId);
|
||||
$oDataset = AppCacheViewPeer::doSelectRS($Criteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$result[] = array(
|
||||
'guid' => $aRow['APP_UID'],
|
||||
'name' => $aRow['APP_NUMBER'],
|
||||
'delIndex' => $aRow['DEL_INDEX'],
|
||||
'processId' => $aRow['PRO_UID']
|
||||
);
|
||||
|
||||
$oDataset->next();
|
||||
$unassigned = new Unassigned();
|
||||
$unassigned->setUserUid($userUid);
|
||||
$data = $unassigned->getData();
|
||||
foreach ($data as $var) {
|
||||
array_push($result, [
|
||||
'guid' => $var['APP_UID'],
|
||||
'name' => $var['APP_NUMBER'],
|
||||
'delIndex' => $var['DEL_INDEX'],
|
||||
'processId' => $var['PRO_UID']
|
||||
]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
$result[] = array(
|
||||
$result[] = [
|
||||
'guid' => $e->getMessage(),
|
||||
'name' => $e->getMessage(),
|
||||
'status' => $e->getMessage(),
|
||||
'status' => $e->getMessage(),
|
||||
'processId' => $e->getMessage()
|
||||
);
|
||||
|
||||
];
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,19 +270,19 @@ class PMScript
|
||||
{
|
||||
switch ($stepType) {
|
||||
case 'DYNAFORM':
|
||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_DYNAFORM : $triggerType === 'AFTER' ?
|
||||
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_DYNAFORM : $triggerType === 'AFTER') ?
|
||||
self::AFTER_DYNAFORM : self::UNDEFINED_ORIGIN;
|
||||
break;
|
||||
case 'INPUT_DOCUMENT':
|
||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_INPUT_DOCUMENT : $triggerType === 'AFTER' ?
|
||||
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_INPUT_DOCUMENT : $triggerType === 'AFTER') ?
|
||||
self::AFTER_INPUT_DOCUMENT : self::UNDEFINED_ORIGIN;
|
||||
break;
|
||||
case 'OUTPUT_DOCUMENT':
|
||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_OUTPUT_DOCUMENT : $triggerType === 'AFTER' ?
|
||||
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_OUTPUT_DOCUMENT : $triggerType === 'AFTER') ?
|
||||
self::AFTER_OUTPUT_DOCUMENT : self::UNDEFINED_ORIGIN;
|
||||
break;
|
||||
case 'EXTERNAL':
|
||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_EXTERNAL_STEP : $triggerType === 'AFTER' ?
|
||||
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_EXTERNAL_STEP : $triggerType === 'AFTER') ?
|
||||
self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN;
|
||||
break;
|
||||
case 'ASSIGN_TASK':
|
||||
|
||||
@@ -817,7 +817,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
if ($options["overwrite"]) {
|
||||
$stat = $this->DELETE(array("path" => $options["dest"]
|
||||
));
|
||||
if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
|
||||
if (($stat[0] != "2") && (substr($stat, 0, 3) != "404")) {
|
||||
return $stat;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -99,7 +99,7 @@ class EmailServerMapBuilder
|
||||
|
||||
$tMap->addColumn('OAUTH_CLIENT_SECRET', 'OauthClientSecret', 'string', CreoleTypes::VARCHAR, true, 512);
|
||||
|
||||
$tMap->addColumn('OAUTH_REFRESH_TOKEN', 'OauthRefreshToken', 'string', CreoleTypes::VARCHAR, true, 512);
|
||||
$tMap->addColumn('OAUTH_REFRESH_TOKEN', 'OauthRefreshToken', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
|
||||
* The value for the oauth_refresh_token field.
|
||||
* @var string
|
||||
*/
|
||||
protected $oauth_refresh_token = '';
|
||||
protected $oauth_refresh_token;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -736,7 +736,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->oauth_refresh_token !== $v || $v === '') {
|
||||
if ($this->oauth_refresh_token !== $v) {
|
||||
$this->oauth_refresh_token = $v;
|
||||
$this->modifiedColumns[] = EmailServerPeer::OAUTH_REFRESH_TOKEN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user