Skip to content

Commit c2dd51b

Browse files
Varun-Choudharyhasura-bot
authored andcommitted
console: pass correct table name when cloning permission
Closes: hasura#6969 Description: To reproduce the issue please visit the issue link. This is happening because the request payload is using the current table name while cloning permission. This PR change makes the payload use the correct table name. - [ ] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label. ### Affected components - [x] Console - [x] CLI hasura/graphql-engine-mono#1505 GitOrigin-RevId: bfd8a67
1 parent 5099ef0 commit c2dd51b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • console/src/components/Services/Data/TablePermissions

‎console/src/components/Services/Data/TablePermissions/Actions.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ const permSetBulkSelect = (isChecked, selectedRole) => {
117117
};
118118
const permSetApplySamePerm = (index, key, value) => {
119119
const data = { index, key, value };
120-
121120
return dispatch => {
122121
dispatch({ type: PERM_SET_APPLY_SAME_PERM, data: data });
123122
};
@@ -439,12 +438,15 @@ const applySamePermissionsBulk = (tableSchema, arePermissionsModified) => {
439438

440439
const permissionsUpQueries = [];
441440
const permissionsDownQueries = [];
442-
443441
permApplyToList.map(applyTo => {
444442
const currTableSchema = findTable(
445443
allSchemas,
446444
generateTableDef(applyTo.table, currentSchema)
447445
);
446+
const permTableSchema = {
447+
name: currTableSchema.table_name,
448+
schema: currTableSchema.table_schema,
449+
};
448450

449451
const currentPermPermission = currTableSchema.permissions.find(
450452
el => el.role_name === applyTo.role
@@ -489,14 +491,14 @@ const applySamePermissionsBulk = (tableSchema, arePermissionsModified) => {
489491
// now add normal create and drop permissions
490492
const createQuery = getCreatePermissionQuery(
491493
applyTo.action,
492-
tableDef,
494+
permTableSchema,
493495
applyTo.role,
494496
sanitizedPermission,
495497
currentDataSource
496498
);
497499
const deleteQuery = getDropPermissionQuery(
498500
applyTo.action,
499-
tableDef,
501+
permTableSchema,
500502
applyTo.role,
501503
currentDataSource
502504
);

0 commit comments

Comments
 (0)