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

BREAKING: Partial fix for #12356: Make 2FA sortable in user list #12364

Merged
merged 5 commits into from
Jan 18, 2023

Conversation

snipe
Copy link
Owner

@snipe snipe commented Jan 18, 2023

The original request wants sorting on 2FA and groups. Groups is a little harder here, since we have a many to many relationship between users and groups, so I'm not sure how we'd figure out which group out of many that we'd be sorting on. But this at least lets us properly sort on the 2FA fields.

This is, however a BREAKING change for API users. I suspect this field isn't being used a lot in most integrations, but the field name in the API response is NOW two_factor_optin versus two_factor_activated. Functionality and logic is the same, but the name is different. I don't imagine this will affect many people, but it is a breaking change.

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
@what-the-diff
Copy link

what-the-diff bot commented Jan 18, 2023

  • Added two_factor_optin and two_factor_enrolled to the UsersController.php
  • Changed the order of fields in UserTransformer from:
    'two-factor-activated' => ($user->twoFactorActive()) ? true : false,
    'two-factor-enrolled' => ($user->twoFactorEnrolled()) ? true : false,

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

I won't go so far as to force 'request changes' on this, but I can't see the benefit in changing the name of this field. The potential damage just outweighs so much the increased clarity. But if you want to merge this, I won't complain. Or you can try and sell me and I can give a formal approval, if you want.

'two_factor_enrolled', 'two_factor_optin', 'last_login', 'assets_count', 'licenses_count',
'consumables_count', 'accessories_count', 'phone', 'address', 'city', 'state',
'country', 'zip', 'id', 'ldap_import', 'remote', 'start_date', 'end_date',
'last_name',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is great! I understand your 'logical' grouping here, but I still would prefer you just alphabetize these. So much easier to "visually-grep".

Copy link
Owner Author

Choose a reason for hiding this comment

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

I do get that, but this is more of a logical grep. We basically present these fields in order of learned priority. I tend to prefer alphabetical myself, but in the case of our index pages (and also because English isn't the only language in the world), we try to correspond these pretty tightly to the Presenters that result in which columns are shown by default.

TLDR; I get it, but I'm not changing it. It's dumb, but everything else is dumber.

'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false,
'two_factor_optin' => ($user->two_factor_active()) ? true : false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I get that this is a little clearer, but IMHO it's not worth the back-compatibility break, and I would prefer we not do it.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I really do get this argument. I have seen no evidence of anyone using this field in the API.

Copy link
Owner Author

Choose a reason for hiding this comment

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

(And it was wrongly-worded to start with :( )

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

Solid fix, and your explanation is completely fair.

@snipe snipe merged commit 956bd38 into develop Jan 18, 2023
@snipe snipe deleted the features/make_2fa_sortable branch January 18, 2023 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants