Skip to content

Commit

Permalink
fix(editor): Show credential share info only to appropriate users (#8020
Browse files Browse the repository at this point in the history
)

## Summary
The credential owner should not see the sharing info box


![image](https://github.com/n8n-io/n8n/assets/5410822/d85b47f8-f4cf-4009-beaf-03bc62008feb)
  • Loading branch information
cstuncsik authored and ivov committed Dec 15, 2023
1 parent d661861 commit 9933fce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cypress/e2e/17-sharing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('Sharing', { disableAutoLogin: true }, () => {
credentialsModal.getters.testSuccessTag().should('be.visible');
});

it.only('should work for admin role on credentials created by others (also can share it with themselves)', () => {
it('should work for admin role on credentials created by others (also can share it with themselves)', () => {
cy.signin(INSTANCE_MEMBERS[0]);

cy.visit(credentialsPage.url);
Expand All @@ -150,6 +150,9 @@ describe('Sharing', { disableAutoLogin: true }, () => {
credentialsModal.getters.testSuccessTag().should('be.visible');
cy.get('input').should('not.have.length');
credentialsModal.actions.changeTab('Sharing');
cy.contains(
'You can view this credential because you have permission to read and share',
).should('be.visible');

credentialsModal.getters.usersSelect().click();
cy.getByTestId('user-email')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@
})
}}
</n8n-info-tip>
<n8n-info-tip v-if="credentialPermissions.read" class="mb-s" :bold="false">
<n8n-info-tip
v-if="
credentialPermissions.read &&
credentialPermissions.share &&
!credentialPermissions.isOwner
"
class="mb-s"
:bold="false"
>
<i18n-t keypath="credentialEdit.credentialSharing.info.reader">
<template v-if="!isCredentialSharedWithCurrentUser" #notShared>
{{ $locale.baseText('credentialEdit.credentialSharing.info.notShared') }}
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
"credentialEdit.oAuthButton.signInWithGoogle": "Sign in with Google",
"credentialEdit.credentialSharing.info.owner": "Sharing a credential allows people to use it in their workflows. They cannot access credential details.",
"credentialEdit.credentialSharing.info.reader": "You can view this credential because you have permission to read and share (and rename or delete it too).{notShared}",
"credentialEdit.credentialSharing.info.notShared": "To use it in a workflow, ask the credential owner to share it with you.",
"credentialEdit.credentialSharing.info.notShared": "To use it in a workflow you need to share it with yourself.",
"credentialEdit.credentialSharing.info.sharee": "Only {credentialOwnerName} can change who this credential is shared with",
"credentialEdit.credentialSharing.info.sharee.fallback": "the owner",
"credentialEdit.credentialSharing.select.placeholder": "Add users...",
Expand Down

0 comments on commit 9933fce

Please sign in to comment.