mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
This commit is contained in:
parent
500a9b2582
commit
e375c61e4a
@ -99,6 +99,7 @@ const defaultModifyState = {
|
||||
},
|
||||
},
|
||||
permissionsState: { ...defaultPermissionsState },
|
||||
prevPermissionState: { ...defaultPermissionsState },
|
||||
ongoingRequest: false,
|
||||
lastError: null,
|
||||
lastSuccess: null,
|
||||
|
@ -274,17 +274,21 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
|
||||
};
|
||||
|
||||
case PERM_OPEN_EDIT:
|
||||
const permState = getBasePermissionsState(
|
||||
action.tableSchema,
|
||||
action.role,
|
||||
action.query,
|
||||
action.insertPermColumnRestriction
|
||||
);
|
||||
return {
|
||||
...modifyState,
|
||||
permissionsState: {
|
||||
...getBasePermissionsState(
|
||||
action.tableSchema,
|
||||
action.role,
|
||||
action.query,
|
||||
action.insertPermColumnRestriction
|
||||
),
|
||||
...permState,
|
||||
tableSchemas: schemas,
|
||||
},
|
||||
prevPermissionState: {
|
||||
...permState,
|
||||
},
|
||||
};
|
||||
|
||||
case PERM_ADD_TABLE_SCHEMAS:
|
||||
|
@ -549,6 +549,9 @@ const permChangePermissions = changeType => {
|
||||
const permissionsState = {
|
||||
...getState().tables.modify.permissionsState,
|
||||
};
|
||||
const prevPermissionsState = {
|
||||
...getState().tables.modify.prevPermissionState,
|
||||
};
|
||||
const limitEnabled = permissionsState.limitEnabled;
|
||||
|
||||
const table = permissionsState.table;
|
||||
@ -579,7 +582,7 @@ const permChangePermissions = changeType => {
|
||||
args: {
|
||||
table: { name: table, schema: currentSchema },
|
||||
role: role,
|
||||
permission: permissionsState[query],
|
||||
permission: prevPermissionsState[query],
|
||||
},
|
||||
};
|
||||
permissionsUpQueries.push(deleteQuery);
|
||||
@ -614,7 +617,6 @@ const permChangePermissions = changeType => {
|
||||
delete permissionsState[query].localSet;
|
||||
}
|
||||
|
||||
//
|
||||
const deleteQuery = {
|
||||
type: 'drop_' + query + '_permission',
|
||||
args: {
|
||||
@ -627,6 +629,9 @@ const permChangePermissions = changeType => {
|
||||
permissionsDownQueries.push(deleteQuery);
|
||||
}
|
||||
|
||||
// Reverse order of down migration
|
||||
permissionsDownQueries.reverse();
|
||||
|
||||
// Apply migration
|
||||
const migrationName =
|
||||
changeType +
|
||||
|
Loading…
Reference in New Issue
Block a user