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

Adding check to show/hide Avatar form based on whether the user is a … #135743

Merged

Conversation

kc13greiner
Copy link
Contributor

@kc13greiner kc13greiner commented Jul 5, 2022

Summary

Removing the UI for Cloud Users to update their avatar (the backend already prohibited Profile updates)

Cloud User:
Screen Shot 2022-07-06 at 10 58 15 AM

Non-cloud User:
Screen Shot 2022-07-06 at 10 50 37 AM

@MichaelMarcialis I would like to include the changes to the Right Side Nav menu (last point described here.

We probably need to adjust references to the profile page in the Elastic Cloud context (we use Profile, User settings and Preferences words

What are your thoughts?

Resolves #132645

@kc13greiner
Copy link
Contributor Author

@elasticmachine merge upstream

@MichaelMarcialis
Copy link
Contributor

@MichaelMarcialis I would like to include the changes to the Right Side Nav menu (last point described here.

We probably need to adjust references to the profile page in the Elastic Cloud context (we use Profile, User settings and Preferences words

What are your thoughts?

Based on my initial wireframes (which included cloud flows for user profiles), the hope was that we would offer the following options for cloud users consistently across both the cloud portal and Kibana user menus:

  • Edit profile and settings
  • View profile
  • Organization
  • Billing
  • Log out

The hope was that Edit profile and settings would take cloud users directly to their cloud portal user profile page, rather than offering them two links to two different profile pages like we do currently (one for cloud, one for deployment). I don't see the value in taking cloud users to a deployment-level profile page that is empty or immutable. I'd much prefer to take them directly to their cloud portal user profile page if possible and simply not offer an unnecessary deployment-level offshoot.

Additionally, the Edit profile and settings option should likely be reworded to Edit profile for the time being, as the user settings portion is planned future addition. View profile is also a future consideration, so it can be omitted for the time being. Organization, Billing, and Log out are self-explanatory, so I'll skip talking about those.

image

For the sake of comparison, we would offer non-cloud users the following options in the Kibana user menu:

image

@kc13greiner
Copy link
Contributor Author

Non-Cloud:
Screen Shot 2022-07-07 at 3 35 51 PM

Cloud User:
Screen Shot 2022-07-07 at 3 35 38 PM

@MichaelMarcialis I removed the 'Preferences' item for cloud and kept the non-cloud as 'Profile' to match the cloud 'Profile' option for a more unified look since we don't have cloud profile editing yet (unless it's ready!)

What do you think?

@kc13greiner kc13greiner marked this pull request as ready for review July 7, 2022 19:45
@kc13greiner kc13greiner requested a review from a team as a code owner July 7, 2022 19:45
@kc13greiner kc13greiner added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.4.0 labels Jul 7, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@kc13greiner kc13greiner added the release_note:skip Skip the PR/issue when compiling release notes label Jul 7, 2022
@kc13greiner kc13greiner marked this pull request as draft July 8, 2022 12:03
@MichaelMarcialis
Copy link
Contributor

@MichaelMarcialis I removed the 'Preferences' item for cloud and kept the non-cloud as 'Profile' to match the cloud 'Profile' option for a more unified look since we don't have cloud profile editing yet (unless it's ready!)

What do you think?

Thanks, @kc13greiner! I have a couple of questions/comments:

  • Just to be sure I understand, does this mean the Profile button for the cloud user will continue to take them to their profile page on the cloud portal (i.e. https://cloud.elastic.co/user/settings), and there will be no link in the menu taking cloud users to an empty/immutable deployment profile page? If so, that's great; exactly what I was hoping for!

  • Assuming my understanding above is correct, can we change the Profile text for both cloud and non-cloud users to Edit profile?

  • Currently the Account & Billing link for cloud users is actually taking them to the organization page in the cloud portal. Can we 1) change the name of this link to Organization with an icon of users, and 2) add a new link for cloud users called Billing with icon payment that goes to https://cloud.elastic.co/billing? Doing so will make this menu's contents more consistent with the cloud portal user menu:

image

  • Regarding some of the additional enhancements I was proposing for the user menu in my wireframes, should that be considered a separate issue? In this case, I'm speaking of the inclusion of the user's avatar, display name, full name (if different than display name), and email address in the menu header. Or should it be part of this PR as well?

@kc13greiner
Copy link
Contributor Author

@MichaelMarcialis

Just to be sure I understand, does this mean the Profile button for the cloud user will continue to take them to their profile page on the cloud portal (i.e. https://cloud.elastic.co/user/settings), and there will be no link in the menu taking cloud users to an empty/immutable deployment profile page? If so, that's great; exactly what I was hoping for!

Exactly that!

Assuming my understanding above is correct, can we change the Profile text for both cloud and non-cloud users to Edit profile?

I will have to check with @azasypkin since the Cloud Profile menu item is in the Cloud directory (Im not sure what the protocol is for changing other teams files yet.)

Currently the Account & Billing link for cloud users is actually taking them to the organization page in the cloud portal. Can we 1) change the name of this link to Organization with an icon of users, and 2) add a new link for cloud users called Billing with icon payment that goes to https://cloud.elastic.co/billing? Doing so will make this menu's contents more consistent with the cloud portal user menu:

Regarding some of the additional enhancements I was proposing for the user menu in my wireframes, should that be considered a separate issue? In this case, I'm speaking of the inclusion of the user's avatar, display name, full name (if different than display name), and email address in the menu header. Or should it be part of this PR as well?

Would it be alright if I handle these in a separate PR?

@kc13greiner
Copy link
Contributor Author

@elasticmachine merge upstream

@azasypkin
Copy link
Member

Assuming my understanding above is correct, can we change the Profile text for both cloud and non-cloud users to Edit profile?

@MichaelMarcialis sorry for the confusion, we referred to the Profile in the Cloud Console user menu (our assumption was that the goal is to unify Kibana and Cloud Console user menus as much as possible for the Cloud managed users). That's why we kept Profile in Kibana since it's still Profile in the Cloud Console (these lead to the same page), or the Cloud team is planning to rename this menu to Edit profile on their end as well?

image

@MichaelMarcialis
Copy link
Contributor

Currently the Account & Billing link for cloud users is actually taking them to the organization page in the cloud portal. Can we 1) change the name of this link to Organization with an icon of users, and 2) add a new link for cloud users called Billing with icon payment that goes to https://cloud.elastic.co/billing? Doing so will make this menu's contents more consistent with the cloud portal user menu:

Regarding some of the additional enhancements I was proposing for the user menu in my wireframes, should that be considered a separate issue? In this case, I'm speaking of the inclusion of the user's avatar, display name, full name (if different than display name), and email address in the menu header. Or should it be part of this PR as well?

Would it be alright if I handle these in a separate PR?

@kc13greiner: Certainly. Separate PR would be great!

Assuming my understanding above is correct, can we change the Profile text for both cloud and non-cloud users to Edit profile?

@MichaelMarcialis sorry for the confusion, we referred to the Profile in the Cloud Console user menu (our assumption was that the goal is to unify Kibana and Cloud Console user menus as much as possible for the Cloud managed users). That's why we kept Profile in Kibana since it's still Profile in the Cloud Console (these lead to the same page), or the Cloud team is planning to rename this menu to Edit profile on their end as well?

@azasypkin: Regarding the suggestion to change the text of Profile to Edit profile, I was just thinking that it might be good to 1) align the text with what was being proposed in the wireframes and 2) prepare for the future distinction between editing and viewing a user's profile. I'm not aware of any plans on the cloud team's side to make these text changes. That said, given that we don't have to make the distinction between editing and viewing currently, we can always save that change for later if you'd prefer.

@azasypkin
Copy link
Member

@azasypkin: Regarding the suggestion to change the text of Profile to Edit profile, I was just thinking that it might be good to 1) align the text with what was being proposed in the wireframes and 2) prepare for the future distinction between editing and viewing a user's profile. I'm not aware of any plans on the cloud team's side to make these text changes. That said, given that we don't have to make the distinction between editing and viewing currently, we can always save that change for later if you'd prefer.

Got it, thanks. If we're not concerned about the Profile vs Edit profile difference between Cloud Console and Kibana user menus then it makes sense to stick to the wireframes as you suggested and rename Profile to Edit profile in Kibana in this PR.

@kc13greiner kc13greiner marked this pull request as ready for review July 11, 2022 17:15
const profileMenuItem: EuiContextMenuPanelItemDescriptor = {
name: (
<FormattedMessage
id="xpack.security.navControlComponent.editProfileLinkText"
defaultMessage="{profileOverridden, select, true{Preferences} other{Profile}}"
values={{ profileOverridden: hasCustomProfileLinks }}
defaultMessage="Edit Profile"
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think you also need to update text here

defaultMessage: 'Profile',
to have the same text for all users (either Cloud managed or not).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in latest commit!

@@ -24061,7 +24061,7 @@
"xpack.security.management.users.usersTitle": "Utilisateurs",
"xpack.security.management.usersTitle": "Utilisateurs",
"xpack.security.navControlComponent.accountMenuAriaLabel": "Menu Compte",
"xpack.security.navControlComponent.editProfileLinkText": "{profileOverridden, select, true{Préférences} other{Profil}}",
"xpack.security.navControlComponent.editProfileLinkText": "Profil",
Copy link
Member

Choose a reason for hiding this comment

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

nit: if you happened to update translation files manually then it'd make sense to revert these changes and run node scripts/i18n_check.js --fix to remove outdated translations instead. Updated translations will be eventually provided by our translators team.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The translation files have been changed back in the latest commit and re-ran the script

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which looks like it just removed the line entirely, is that correct?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, that's correct!

@kc13greiner kc13greiner requested a review from a team as a code owner July 12, 2022 11:21
Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together, @kc13greiner. The non-cloud user menu looks good. However, the cloud user menu appears to still show both profile links (first one leads to cloud profile page, second leads to deployment profile page). Can we remove the link to the deployment profile page for cloud users?

image

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for making that change, @kc13greiner. LGTM!

const isAnonymous = currentUser.value ? isUserAnonymous(currentUser.value) : false;
const hasCustomProfileLinks = userMenuLinks.some(({ setAsProfile }) => setAsProfile === true);

if (!isAnonymous && !hasCustomProfileLinks) {
Copy link
Member

Choose a reason for hiding this comment

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

issue: while testing this change I discovered that we rely on the user's roles (specifically superuser role) to determine whether we should show Cloud specific links or not (added in #97870). If we keep this Cloud plugin logic as is, after this PR non-Cloud managed superusers won't be able to edit their profiles in Kibana (we'll be rendering a single Edit profile link leading to Cloud UI instead of Profile and Preferences links we had previously).

@legrego do I understand correctly that we can now switch this code to rely on elastic_cloud_user user property instead or is there still a legitimate reason for non-Cloud managed superusers to see Cloud specific links?

Copy link
Member

Choose a reason for hiding this comment

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

@legrego do I understand correctly that we can now switch this code to rely on elastic_cloud_user user property instead or is there still a legitimate reason for non-Cloud managed superusers to see Cloud specific links?

That's correct, we should switch this code to rely on elastic_cloud_user instead of the role check. The superuser check was a hard-coded workaround because we didn't have a way to reliably determine which users were cloud users back then.

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks for confirming, Larry.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
security 504.4KB 504.5KB +30.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cloud 11.4KB 11.3KB -4.0B
security 51.1KB 51.0KB -103.0B
total -107.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

LGTM, great job!

@kc13greiner kc13greiner merged commit 2f732ae into elastic:main Jul 20, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 20, 2022
@kc13greiner kc13greiner deleted the feature/hide_avatar_form_for_cloud_user branch July 20, 2022 11:32
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Address review feedback for redesigned user profile page
9 participants