Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/aah 329 disable self delete #300

Merged

Conversation

newswangerd
Copy link
Member

Fixes: https://issues.redhat.com/browse/AAH-329

  • Fixes bug where failing to delete a user would display a failure and a success message.
  • Gray out the delete button on the delete user modal if the user is themself or the admin.

Screen Shot 2021-02-09 at 3 10 41 PM
Screen Shot 2021-02-09 at 3 12 11 PM

@newswangerd newswangerd added the backport-4.2 This PR should be backported to stable-4.2 (1.2) label Feb 9, 2021
}

private isUserSelfOrAdmin = (user: UserType): boolean => {
if (user.is_superuser || user.id === this.context.user.id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking but return user.is_superuser || user.id === this.context.user.id looks better.

Copy link
Member

@ZitaNemeckova ZitaNemeckova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in UI. LGTM 👍

@newswangerd newswangerd merged commit 33d40b7 into ansible:master Feb 11, 2021
patchback bot pushed a commit that referenced this pull request Feb 11, 2021
* Fix error where failing to delete a user throws a failed and a success message.

* Prevent users from deleting themselves or admins.

* Fix isUserSelfOrAdmin function.

(cherry picked from commit 33d40b7)
newswangerd added a commit to newswangerd/ansible-hub-ui that referenced this pull request Feb 11, 2021
* Fix error where failing to delete a user throws a failed and a success message.

* Prevent users from deleting themselves or admins.

* Fix isUserSelfOrAdmin function.

(cherry picked from commit 33d40b7)
(cherry picked from commit eec6455)
newswangerd added a commit that referenced this pull request Feb 11, 2021
* Fix error where failing to delete a user throws a failed and a success message.

* Prevent users from deleting themselves or admins.

* Fix isUserSelfOrAdmin function.

(cherry picked from commit 33d40b7)
@ZitaNemeckova ZitaNemeckova added the backported-4.2 This PR has been backported to stable-4.2 (1.2) label Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.2 This PR should be backported to stable-4.2 (1.2) backported-4.2 This PR has been backported to stable-4.2 (1.2)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants