Allow users with 'view-users' permission to see the 'credentials' tab (#19587)

Closes #17174
This commit is contained in:
eatikrh 2023-04-07 07:13:43 -05:00 committed by GitHub
parent 2c663c2fcc
commit 396e2ba931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -233,7 +233,7 @@ const EditUserForm = ({ user, bruteForced, refresh }: EditUserFormProps) => {
</Tab>
<Tab
data-testid="credentials"
isHidden={!user.access?.manage}
isHidden={!user.access?.view}
title={<TabTitleText>{t("common:credentials")}</TabTitleText>}
{...credentialsTab}
>

View file

@ -651,7 +651,7 @@ public class UserResource {
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<CredentialRepresentation> credentials(){
auth.users().requireManage(user);
auth.users().requireView(user);
return user.credentialManager().getStoredCredentialsStream()
.map(ModelToRepresentation::toRepresentation)
.peek(credentialRepresentation -> credentialRepresentation.setSecretData(null));