Reputation: 671
I have multiple tables within the same dataset inside my Big Query resource, what I want is to give a specific email access to table1
but I couldn't make it work after looking at the docs here: https://cloud.google.com/bigquery/docs/access-control#permissions-predefined-roles and trying to figure out by plug and play method.
I want to give it programmatically so far trying the below configuration
// tableName will be replaced by table1
const policy = {
bindings: [
{
members: [`user:${userEmail}`],
role: 'roles/bigquery.dataViewer',
condition: {
title: 'Limited_BQ_Access',
description: 'Access limited to specific dataset and table',
expression: `resource.type == 'bigquery.googleapis.com/Table' && resource.name.startsWith('projects/${projectId}/datasets/${datasetName}/tables/${tableName}')`,
},
},
{
members: [`user:${userEmail}`],
role: 'roles/bigquery.jobUser',
condition: {
title: 'Limited_Job_Access',
description: 'Allow running queries',
expression: `resource.type == 'bigquery.googleapis.com/Project' && resource.name == 'projects/${projectId}'`,
},
},
{
members: [`user:${userEmail}`],
role: 'roles/bigquery.metadataViewer',
},
],
version: 3,
};
I tried to give roles/bigquery.dataOwner
permission as well but it also didn't work the only permission that worked was to add roles/bigquery.admin
but I don't want to do that since it's too much risk and user will also be able to see other tables and even modify stuff, only that user should allow to do is whatever but with only table1
.
How can I configure it in that way? Has anyone come across the same problem?
Upvotes: 0
Views: 34