Skip to content
Snippets Groups Projects
Commit 4b977f50 authored by Omar Mohamad - El Hassan Lopesino's avatar Omar Mohamad - El Hassan Lopesino
Browse files

Merge remote-tracking branch 'original/5.0.x' into 3396890-allow-logging-push

parents e876ec23 75627c2b
No related branches found
No related tags found
1 merge request!63Draft: Resolve #3396890 "Allow logging push"
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"consolidation/output-formatters": "^3.2.0 || ^4.1", "consolidation/output-formatters": "^3.2.0 || ^4.1",
"lusitanian/oauth": "^0.8.11", "lusitanian/oauth": "^0.8.11",
"firebase/php-jwt": "^5.0 || ^6.0", "firebase/php-jwt": "^5.0 || ^6.0",
"drupal/address": "^1.8", "drupal/address": "^1.8 || ^2.0",
"drupal/key": "^1.14", "drupal/key": "^1.14",
"drupal/dynamic_entity_reference": "^1.9 || ^2.0 || ^3 || ^4", "drupal/dynamic_entity_reference": "^1.9 || ^2.0 || ^3 || ^4",
"drupal/typed_data": "^1.0-beta2", "drupal/typed_data": "^1.0-beta2",
......
...@@ -194,7 +194,7 @@ class SalesforceExampleSubscriber implements EventSubscriberInterface { ...@@ -194,7 +194,7 @@ class SalesforceExampleSubscriber implements EventSubscriberInterface {
// Attach the new file id to the user entity. // Attach the new file id to the user entity.
/* var \Drupal\file\FileInterface */ /* var \Drupal\file\FileInterface */
if ($file = file_save_data($file_data, $destination, FileSystemInterface::EXISTS_REPLACE)) { if ($file = \Drupal::service('file.repository')->writeData($file_data, $destination, FileSystemInterface::EXISTS_REPLACE)) {
$account->user_picture->target_id = $file->id(); $account->user_picture->target_id = $file->id();
} }
else { else {
......
...@@ -51,9 +51,9 @@ class SalesforceJWTPlugin extends SalesforceAuthProviderPluginBase { ...@@ -51,9 +51,9 @@ class SalesforceJWTPlugin extends SalesforceAuthProviderPluginBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(array $configuration, $plugin_id, $plugin_definition, ClientInterface $httpClient, SalesforceAuthTokenStorageInterface $storage, ConfigFactoryInterface $configFactory, KeyRepositoryInterface $keyRepository, TimeInterface $time) { public function __construct(array $configuration, $plugin_id, $plugin_definition, ClientInterface $httpClient, SalesforceAuthTokenStorageInterface $storage, ConfigFactoryInterface $configFactory, KeyRepositoryInterface $keyRepository, TimeInterface $time) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $httpClient, $storage, $configFactory);
$this->keyRepository = $keyRepository; $this->keyRepository = $keyRepository;
$this->time = $time; $this->time = $time;
parent::__construct($configuration, $plugin_id, $plugin_definition, $httpClient, $storage, $configFactory);
} }
/** /**
......
...@@ -87,30 +87,30 @@ salesforce_mapping.salesforce_mapping.*: ...@@ -87,30 +87,30 @@ salesforce_mapping.salesforce_mapping.*:
type: sequence type: sequence
label: 'Field Mappings' label: 'Field Mappings'
sequence: sequence:
- type: mapping type: mapping
label: 'Field Mapping' label: 'Field Mapping'
mapping: mapping:
drupal_field_type: drupal_field_type:
type: string type: string
label: 'Fieldmap Type' label: 'Fieldmap Type'
drupal_field_value: drupal_field_value:
type: string type: string
label: 'Fieldmap Value' label: 'Fieldmap Value'
direction: direction:
type: string type: string
label: 'Direction' label: 'Direction'
salesforce_field: salesforce_field:
type: string type: string
label: 'Salesforce Field Name' label: 'Salesforce Field Name'
id: id:
type: integer type: integer
label: 'Field Id' label: 'Field Id'
drupal_constant: drupal_constant:
type: string type: string
label: 'Drupal Constant' label: 'Drupal Constant'
description: description:
type: text type: text
label: 'Description' label: 'Description'
# Schema / Config API requires that we add these: # Schema / Config API requires that we add these:
status: status:
......
...@@ -79,9 +79,17 @@ function salesforce_mapping_ui_menu_local_actions_alter(&$local_actions) { ...@@ -79,9 +79,17 @@ function salesforce_mapping_ui_menu_local_actions_alter(&$local_actions) {
*/ */
function salesforce_mapping_ui_entity_operation(EntityInterface $entity) { function salesforce_mapping_ui_entity_operation(EntityInterface $entity) {
$operations = []; $operations = [];
if (\Drupal::entityTypeManager() $has_mapping_view_access = FALSE;
foreach (\Drupal::entityTypeManager()
->getStorage('salesforce_mapping') ->getStorage('salesforce_mapping')
->loadByEntity($entity)) { ->loadByEntity($entity) as $mapping) {
if ($mapping->access('view')) {
$has_mapping_view_access = TRUE;
}
}
if ($has_mapping_view_access) {
$operations['salesforce'] = [ $operations['salesforce'] = [
'title' => t('Salesforce'), 'title' => t('Salesforce'),
'weight' => 200, 'weight' => 200,
......
...@@ -17,16 +17,16 @@ class SalesforceAuthListBuilder extends ConfigEntityListBuilder { ...@@ -17,16 +17,16 @@ class SalesforceAuthListBuilder extends ConfigEntityListBuilder {
public function buildRow(EntityInterface $entity) { public function buildRow(EntityInterface $entity) {
/** @var \Drupal\salesforce\SalesforceAuthProviderInterface $plugin */ /** @var \Drupal\salesforce\SalesforceAuthProviderInterface $plugin */
$plugin = $entity->getPlugin(); $plugin = $entity->getPlugin();
$row['default'] = $entity->authManager() $row['default'] = $entity->authManager()->getConfig()?->id == $entity->id()
->getConfig() && $entity->authManager() ? $this->t('Default')
->getConfig() : '';
->id() == $entity->id()
? $this->t('Default') : '';
$row['label'] = $entity->label(); $row['label'] = $entity->label();
$row['url'] = $plugin->getCredentials()->getLoginUrl(); $row['url'] = $plugin?->getCredentials()?->getLoginUrl();
$row['key'] = substr($plugin->getCredentials()->getConsumerKey(), 0, 16) . '...'; $row['key'] = $plugin?->getCredentials()?->getConsumerKey()
$row['type'] = $plugin->label(); ? substr($plugin?->getCredentials()?->getConsumerKey(), 0, 16) . '...'
$row['status'] = $plugin->hasAccessToken() ? 'Authorized' : 'Missing'; : NULL;
$row['type'] = $plugin?->label();
$row['status'] = $plugin?->hasAccessToken() ? 'Authorized' : 'Missing';
return $row + parent::buildRow($entity); return $row + parent::buildRow($entity);
} }
...@@ -40,8 +40,8 @@ class SalesforceAuthListBuilder extends ConfigEntityListBuilder { ...@@ -40,8 +40,8 @@ class SalesforceAuthListBuilder extends ConfigEntityListBuilder {
// Add a "revoke" action if we have a token. // Add a "revoke" action if we have a token.
$operations['edit']['url'] = $entity->toUrl('edit-form'); $operations['edit']['url'] = $entity->toUrl('edit-form');
if (!$entity instanceof SalesforceAuthConfig if (!$entity instanceof SalesforceAuthConfig
|| !$entity->getPlugin()->hasAccessToken() || !$entity->getPlugin()?->hasAccessToken()
|| !$entity->hasLinkTemplate('revoke')) { || !$entity->hasLinkTemplate('revoke')) {
return $operations; return $operations;
} }
// Add a "revoke" action if we have a token. // Add a "revoke" action if we have a token.
......
...@@ -122,6 +122,12 @@ class RestResponseDescribe extends RestResponse { ...@@ -122,6 +122,12 @@ class RestResponseDescribe extends RestResponse {
protected array $urls; protected array $urls;
protected bool $hasSubtypes;
protected ?string $listviewable;
protected ?string $lookupLayoutable;
// phpcs:enable // phpcs:enable
/** /**
......
...@@ -44,6 +44,20 @@ class SelectQuery implements SelectQueryInterface { ...@@ -44,6 +44,20 @@ class SelectQuery implements SelectQueryInterface {
*/ */
public $conditions = []; public $conditions = [];
/**
* Starting elements number for query result.
*
* @var int
*/
public $offset;
/**
* The operator used to combine conditions, defaults to 'AND'.
*
* @var string
*/
public $conjunction;
/** /**
* SelectQuery constructor. * SelectQuery constructor.
* *
...@@ -52,11 +66,15 @@ class SelectQuery implements SelectQueryInterface { ...@@ -52,11 +66,15 @@ class SelectQuery implements SelectQueryInterface {
*/ */
public function __construct($object_type = '') { public function __construct($object_type = '') {
$this->objectType = $object_type; $this->objectType = $object_type;
$this->conjunction = 'AND';
} }
/** /**
* Add a condition to the query. * Add a condition to the query.
* *
* Conditions will be combined with the conjunction defined by
* $this->conjunction. Defaults to 'AND'.
*
* @param string $field * @param string $field
* Field name. * Field name.
* @param mixed $value * @param mixed $value
...@@ -93,6 +111,8 @@ class SelectQuery implements SelectQueryInterface { ...@@ -93,6 +111,8 @@ class SelectQuery implements SelectQueryInterface {
* Implements PHP's magic toString(). * Implements PHP's magic toString().
* *
* Function to convert the query to a string to pass to the SF API. * Function to convert the query to a string to pass to the SF API.
* Conditions will be combined with the conjunction defined by
* $this->conjunction. Defaults to 'AND'.
* *
* @return string * @return string
* SOQL query ready to be executed the SF API. * SOQL query ready to be executed the SF API.
...@@ -109,7 +129,7 @@ class SelectQuery implements SelectQueryInterface { ...@@ -109,7 +129,7 @@ class SelectQuery implements SelectQueryInterface {
foreach ($this->conditions as $condition) { foreach ($this->conditions as $condition) {
$where[] = implode('+', $condition); $where[] = implode('+', $condition);
} }
$query .= '+WHERE+' . implode('+AND+', $where); $query .= '+WHERE+' . implode('+' . $this->conjunction . '+', $where);
} }
if ($this->order) { if ($this->order) {
...@@ -125,6 +145,10 @@ class SelectQuery implements SelectQueryInterface { ...@@ -125,6 +145,10 @@ class SelectQuery implements SelectQueryInterface {
$query .= "+LIMIT+" . (int) $this->limit; $query .= "+LIMIT+" . (int) $this->limit;
} }
if ($this->offset) {
$query .= "+OFFSET+" . (int) $this->offset;
}
return $query; return $query;
} }
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment