/** * Overrides \RestfulEntityBase::getQueryForList(). */ public function getQueryForList() { $query = parent::getQueryForList(); // Get the configured roles. if (!$options = $this->getPluginKey('options')) { return $query; } // Get a list of role ids for the configured roles. $roles_list = user_roles(); $selected_rids = array(); foreach ($roles_list as $rid => $role) { if (in_array($role, $options['roles'])) { $selected_rids[] = $rid; } } if (empty($selected_rids)) { return $query; } // Get the list of user ids belonging to the selected roles. $uids = db_query('SELECT uid FROM {users_roles} WHERE rid IN (:rids)', array( ':rids' => $selected_rids, ))->fetchAllAssoc('uid'); // Restrict the list of entities to the nodes authored by any user on the // list of users with the administrator role. if (!empty($uids)) { $query->propertyCondition('uid', array_keys($uids), 'IN'); } return $query; }
/** * Overrides RestfulEntityBase::getQueryForList(). * * Expose only published nodes. */ public function getQueryForList() { $query = parent::getQueryForList(); $query->propertyCondition('status', NODE_PUBLISHED); return $query; }
/** * Overrides \RestfulEntityBase::getQueryForList(). * * Skip the anonymous user in listing. */ public function getQueryForList() { $query = parent::getQueryForList(); $query->entityCondition('entity_id', 0, '>'); return $query; }
/** * Overrides RestfulEntityBase::getQueryForList(). */ public function getQueryForList() { $query = parent::getQueryForList(); $query->entityCondition('bundle', array_keys($this->getBundles()), 'IN'); return $query; }