/**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Adding the 'support_ticket_access' tag is sadly insufficient for support
     // tickets: core requires us to also know about the concept of 'published' and
     // 'unpublished'.
     $query->condition('status', SUPPORT_TICKET_PUBLISHED);
     return $query;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Allow referencing :
     // - files with status "permanent"
     // - or files uploaded by the current user (since newly uploaded files only
     //   become "permanent" after the containing entity gets validated and
     //   saved.)
     $query->condition($query->orConditionGroup()->condition('status', FILE_STATUS_PERMANENT)->condition('uid', $this->currentUser->id()));
     return $query;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Adding the 'comment_access' tag is sadly insufficient for comments:
     // core requires us to also know about the concept of 'published' and
     // 'unpublished'.
     if (!$this->currentUser->hasPermission('administer comments')) {
         $query->condition('status', CommentInterface::PUBLISHED);
     }
     return $query;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // The 'zone' zone member needs to be able to exclude the parent zone
     // from selection. It does this by passing a custom skip_id parameter
     // to the entity_autocomplete form element via #handler_settings.
     $handler_settings = $this->configuration['handler_settings'];
     if (!empty($handler_settings['skip_id'])) {
         $query->condition('id', $handler_settings['skip_id'], '<>');
     }
     return $query;
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Adding the 'node_access' tag is sadly insufficient for nodes: core
     // requires us to also know about the concept of 'published' and
     // 'unpublished'. We need to do that as long as there are no access control
     // modules in use on the site. As long as one access control module is there,
     // it is supposed to handle this check.
     if (!$this->currentUser->hasPermission('bypass node access') && !count($this->moduleHandler->getImplementations('node_grants'))) {
         $query->condition('status', NODE_PUBLISHED);
     }
     return $query;
 }
Exemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     // Let administrators do anything.
     if ($this->currentUser->hasPermission('administer domains')) {
         return $query;
     }
     // Can this user access inactive domains?
     if (!$this->currentUser->hasPermission('access inactive domains')) {
         $query->condition('status', 1);
     }
     // Filter domains by the user's assignments, which are controlled by other
     // modules. Those modules must know what type of entity they are dealing
     // with, so look up the entity type and bundle.
     $info = $query->getMetadata('entity_reference_selection_handler');
     $context['entity_type'] = $info->configuration['entity']->getEntityTypeId();
     $context['bundle'] = $info->configuration['entity']->bundle();
     // Load the current user.
     $account = User::load($this->currentUser->id());
     // Run the alter hook.
     $this->moduleHandler->alter('domain_references', $query, $account, $context);
     return $query;
 }
Exemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     $handler_settings = $this->configuration['handler_settings'];
     // Filter out the Anonymous user if the selection handler is configured to
     // exclude it.
     if (isset($handler_settings['include_anonymous']) && !$handler_settings['include_anonymous']) {
         $query->condition('uid', 0, '<>');
     }
     // The user entity doesn't have a label column.
     if (isset($match)) {
         $query->condition('name', $match, $match_operator);
     }
     // Filter by role.
     if (!empty($handler_settings['filter']['role'])) {
         $query->condition('roles', $handler_settings['filter']['role'], 'IN');
     }
     // Adding the permission check is sadly insufficient for users: core
     // requires us to also know about the concept of 'blocked' and 'active'.
     if (!$this->currentUser->hasPermission('administer users')) {
         $query->condition('status', 1);
     }
     return $query;
 }
Exemplo n.º 8
0
 /**
  * {@inheritdoc}
  */
 protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')
 {
     $query = parent::buildEntityQuery($match, $match_operator);
     $query->condition('status', FILE_STATUS_PERMANENT);
     return $query;
 }