web/satellite: prevent access grant creation
In case user requests account deletion access grant is being created when user visits buckets screen. With this fix access grant won't be created if user deletes all the buckets first and then deletes all the access grants. Change-Id: I9a348bcf35a050838dbf6e1e7c682499d2f0a278
This commit is contained in:
parent
af1f0aa943
commit
640c74a5e0
@ -141,6 +141,12 @@ export default class BucketsView extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.bucketsList.length && wasDemoBucketCreated) {
|
||||
await this.removeTemporaryAccessGrant();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wasDemoBucketCreated) await this.createDemoBucket();
|
||||
} catch (error) {
|
||||
await this.$notify.error(`Failed to setup Buckets view. ${error.message}`);
|
||||
@ -229,6 +235,9 @@ export default class BucketsView extends Vue {
|
||||
this.isRequestProcessing = true;
|
||||
|
||||
try {
|
||||
if (!this.edgeCredentials.accessKeyId) {
|
||||
await this.setAccess();
|
||||
}
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.CREATE_BUCKET, this.createBucketName);
|
||||
if (this.isNewObjectsFlow) {
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.FETCH_BUCKETS);
|
||||
@ -301,6 +310,9 @@ export default class BucketsView extends Vue {
|
||||
this.isRequestProcessing = true;
|
||||
|
||||
try {
|
||||
if (!this.edgeCredentials.accessKeyId) {
|
||||
await this.setAccess();
|
||||
}
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.DELETE_BUCKET, this.deleteBucketName);
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.FETCH_BUCKETS);
|
||||
} catch (error) {
|
||||
@ -383,6 +395,7 @@ export default class BucketsView extends Vue {
|
||||
public async removeTemporaryAccessGrant(): Promise<void> {
|
||||
try {
|
||||
await this.$store.dispatch(ACCESS_GRANTS_ACTIONS.DELETE_BY_NAME_AND_PROJECT_ID, this.FILE_BROWSER_AG_NAME);
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.CLEAR);
|
||||
} catch (error) {
|
||||
await this.$notify.error(error.message);
|
||||
}
|
||||
@ -431,6 +444,13 @@ export default class BucketsView extends Vue {
|
||||
return this.$store.getters.selectedProject.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns edge credentials from store.
|
||||
*/
|
||||
private get edgeCredentials(): EdgeCredentials {
|
||||
return this.$store.state.objectsModule.gatewayCredentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns validation status of a bucket name.
|
||||
*/
|
||||
|
@ -64,7 +64,7 @@ interface ObjectsContext {
|
||||
state: ObjectsState
|
||||
commit: (string, ...unknown) => void
|
||||
dispatch: (string, ...unknown) => Promise<any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
rootState: {
|
||||
rootState: {
|
||||
files: FilesState
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user