Skip to content
Snippets Groups Projects
Commit 743b610c authored by baldwinlouie's avatar baldwinlouie
Browse files

Issue #3003145 by baldwinlouie: SQL error after any server template launch

parent 7100732c
No related branches found
No related tags found
No related merge requests found
...@@ -213,16 +213,16 @@ function aws_cloud_entity_operation(EntityInterface $entity) { ...@@ -213,16 +213,16 @@ function aws_cloud_entity_operation(EntityInterface $entity) {
* *
* Alter the query for users that can only view their own instances. * Alter the query for users that can only view their own instances.
*/ */
function aws_cloud_query_aws_cloud_instance_access_alter(AlterableInterface $query) { function aws_cloud_query_aws_cloud_instance_views_access_alter(AlterableInterface $query) {
if (!$account = $query->getMetaData('account')) { if (!$account = $query->getMetaData('account')) {
$account = \Drupal::currentUser(); $account = \Drupal::currentUser();
} }
if ($account->hasPermission('view any aws cloud instance')) { if ($account->hasPermission('view any aws cloud instance')) {
return; return;
} }
if ($account->hasPermission('view own aws cloud instance')) { else {
// add a user_id condition // add a user_id condition
$query->condition('user_id', $account->id()); $query->condition('aws_cloud_instance.user_id', $account->id());
} }
} }
\ No newline at end of file
...@@ -32,13 +32,8 @@ class InstanceViewsData extends Ec2BaseViewsData { ...@@ -32,13 +32,8 @@ class InstanceViewsData extends Ec2BaseViewsData {
'image_id', 'image_id',
]; ];
$data[$table_name]['table']['base'] = [
'field' => 'id',
'title' => t('AWS Cloud Instance'),
'help' => t('The AWC Cloud Instance entity ID.'),
];
// add an access query tag // add an access query tag
$data[$table_name]['table']['base']['access query tag'] = 'aws_cloud_instance_access'; $data[$table_name]['table']['base']['access query tag'] = 'aws_cloud_instance_views_access';
$this->addDropdownSelector($data, $table_name, $fields, $selectable); $this->addDropdownSelector($data, $table_name, $fields, $selectable);
return $data; return $data;
......
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