Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

SCIM: Add "is SCIM controlled" flag to site user, and "SCIM" badge on UI#48727

Merged
vdavid merged 9 commits into
mainfrom
dv/scim-add-scim-badge-to-users
Mar 7, 2023
Merged

SCIM: Add "is SCIM controlled" flag to site user, and "SCIM" badge on UI#48727
vdavid merged 9 commits into
mainfrom
dv/scim-add-scim-badge-to-users

Conversation

@vdavid

@vdavid vdavid commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

Adds a "SCIMControlled" flag to SiteUser, and fetches that via GraphQL, then displays a small "SCIM" badge if the user is SCIM-enabled. It looks like this:

(To the design reviewer: check out the blue "SCIM" badges next to some users. It's new. It indicates that the user is created/modified through SCIM, from an external system. My question is whether this looks good or I should indicate this differently.)

CleanShot 2023-03-06 at 14 49 52@2x

And with the tooltip over the new badge:
CleanShot 2023-03-06 at 16 33 04@2x

This is a small PR because I want to get early feedback to make sure no one in IAM has problems with extending SiteUser for this purpose.
Note: I may want to add the same field to User later today, depending on UI requirements. Feedback is welcome on that thought as well! (I don't know if it's too dirty to mention "SCIM" in our general User model to the extent of an added boolean. It'd make things very easy, though!)

Test plan

  • Tested that the badges appear for the right users. They do.
  • Needs design review, so notifying design

@cla-bot cla-bot Bot added the cla-signed label Mar 6, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for live users

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for deleted users

Comment thread internal/users/stats.go Outdated

@vdavid vdavid Mar 6, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It cannot be >1 (a unique index below prevents that), but using >= rather than = here adds an extra layer of security in case we add multiple SCIM accounts later.

@vdavid vdavid Mar 6, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We had no index on user_id and service_type, so this could be slow. I've added an index—see below.

@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Mar 6, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.00% (+0.47 kb) 0.00% (+0.47 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 7ec15a5 and eccbef8 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need this to ensure performance, but it has the additional benefit of making SCIM accounts unique.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh lol I think it requires ON to be on the same line. If you'd like to fix up the regex (read.go L232) so that it accepts newlines as the space charset you should be able to pass the migration as-is (unless I'm completely off base).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think \s matches the newline in the Go implementation of regexp (I'm pretty sure it usually matches newlines), so it should work, but I'll try.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can slam a newline in one of the test cases and see if it still passes - if not you have the first 1/3d of TDD done!

@vdavid vdavid requested review from a team and chwarwick March 6, 2023 14:31
@vdavid vdavid marked this pull request as ready for review March 6, 2023 14:31
@vdavid vdavid marked this pull request as draft March 6, 2023 14:39
@vdavid vdavid force-pushed the dv/scim-add-scim-badge-to-users branch from 85faae3 to 8152bd4 Compare March 6, 2023 15:31
@vdavid vdavid marked this pull request as ready for review March 6, 2023 15:32
@vdavid vdavid requested a review from a team March 6, 2023 15:33
"""
Whether the user is SCIM enabled.
"""
scimEnabled: Boolean!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the SCIMControlled naming you used in the PR description a little better, but thats about as minor as it gets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've changed the naming to "controlled" everywhere, thanks!

{scimEnabled && (
<Tooltip content="This user is SCIM-enabled—an external system controls some of its attributes.">
<Badge variant="primary" className="mr-1">
SCIM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit/question - Is it expected that users will know what SCIM means? I hadn't heard of it until recently. Not what would be a better replacement that is short enough to not take over that space.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point! Added a link to explain it. Thanks!

@kopancek kopancek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm approving to unblock.

But I'm not completely sure adding a one-off for SCIM is the best way to go. Maybe we can instead show a column for externalAccounts in the users list? 🤔

@chwarwick

Copy link
Copy Markdown
Contributor

But I'm not completely sure adding a one-off for SCIM is the best way to go. Maybe we can instead show a column for externalAccounts in the users list? 🤔

I was thinking in a similar way about it being tied to SCIM, but generally I think we can say it will always be True/False if the user account is controlled by some external system (in this case scim) and that is an indication of what can or can't be done with the sg ui.

@vdavid vdavid changed the title SCIM: Add "is SCIM enabled" flag to site user SCIM: Add "is SCIM enabled" flag to site user, and "SCIM" badge on UI Mar 6, 2023
@vdavid vdavid force-pushed the dv/scim-add-scim-badge-to-users branch from 8f432b4 to 9e34fd8 Compare March 7, 2023 12:22
@vdavid vdavid changed the title SCIM: Add "is SCIM enabled" flag to site user, and "SCIM" badge on UI SCIM: Add "is SCIM controlled" flag to site user, and "SCIM" badge on UI Mar 7, 2023
@vdavid vdavid force-pushed the dv/scim-add-scim-badge-to-users branch from 9e34fd8 to be2af57 Compare March 7, 2023 12:54
@vdavid vdavid force-pushed the dv/scim-add-scim-badge-to-users branch from 4ee585b to 4b18e75 Compare March 7, 2023 13:45
@vdavid vdavid enabled auto-merge (squash) March 7, 2023 13:58
@vdavid vdavid merged commit 012d347 into main Mar 7, 2023
@vdavid vdavid deleted the dv/scim-add-scim-badge-to-users branch March 7, 2023 14:15
@rrhyne

rrhyne commented Mar 9, 2023

Copy link
Copy Markdown

Sorry I'm late to this @vdavid. There are some issues with the design:

  • By placing the badge first, we are harming the scan ability of the list.
  • By using a colored badge, we are bringing outsized importance to the item

Can we move the badge to the end of the name, right aligned to the table row and use the secondary or info badge instead?

image

@vdavid

vdavid commented Mar 9, 2023

Copy link
Copy Markdown
Contributor Author

Absolutely, @rrhyne, will do, and ping you with a screenshot.

@danielmarquespt

Copy link
Copy Markdown
Contributor

Ideally this should be a collumn, but the layout is too narrow for that. I also agree that the badge works after the name

@rrhyne

rrhyne commented Mar 10, 2023

Copy link
Copy Markdown

Agree with @danielmarquespt but didn't want to make that change last minute. @vdavid DM me when complete!!!

@vdavid

vdavid commented Mar 10, 2023

Copy link
Copy Markdown
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants