fix: Fix automatic credential selection when credentials are shared (#5020)

* fix: fix default credentials when inserting nodes

* fix: update default without sharing

* fix: fix clearing credential bug, automatically selecting shared cred bug

* fix: include sharable creds in automatic selections

* fix: update getter

* fix: refactor subscribe logic, fix update bug

* fix: remove unnessary import

* format: prettier
This commit is contained in:
Mutasem Aldmour
2022-12-23 16:32:06 +01:00
committed by GitHub
parent 4651147096
commit 6a8448da5f
4 changed files with 94 additions and 44 deletions

View File

@@ -18,14 +18,16 @@ import {
validatePasswordToken,
validateSignupToken,
} from '@/api/users';
import { PERSONALIZATION_MODAL_KEY, STORES } from '@/constants';
import { EnterpriseEditionFeature, PERSONALIZATION_MODAL_KEY, STORES } from '@/constants';
import {
ICredentialsResponse,
IInviteResponse,
IPersonalizationLatestVersion,
IUser,
IUserResponse,
IUsersState,
} from '@/Interface';
import { getCredentialPermissions } from '@/permissions';
import { getPersonalizedNodeTypes, isAuthorized, PERMISSIONS, ROLE } from '@/utils';
import { defineStore } from 'pinia';
import Vue from 'vue';
@@ -90,6 +92,13 @@ export const useUsersStore = defineStore(STORES.USERS, {
}
return getPersonalizedNodeTypes(answers);
},
isResourceAccessible() {
return (resource: ICredentialsResponse): boolean => {
const permissions = getCredentialPermissions(this.currentUser, resource);
return permissions.use;
};
},
},
actions: {
addUsers(users: IUserResponse[]) {