mirror of
https://github.com/fleetdm/fleet
synced 2026-05-18 06:28:40 +00:00
Closes #1502. This PR adds support for SSO to the new user creation process. An admin now has the option to select SSO when creating a new user. When the confirmation form is submitted, the user is automatically authenticated with the IDP, and if successful, is redirected to the Kolide home page. Password authentication, password change and password reset are not allowed for an SSO user.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const userActionOptions = (isCurrentUser, user, invite) => {
|
|
const inviteActions = [
|
|
{ disabled: false, label: 'Revoke Invitation', value: 'revert_invitation' },
|
|
];
|
|
const userEnableAction = user.enabled
|
|
? { disabled: isCurrentUser, label: 'Disable Account', value: 'disable_account' }
|
|
: { disabled: false, label: 'Enable Account', value: 'enable_account' };
|
|
const userPromotionAction = user.admin
|
|
? { disabled: isCurrentUser, label: 'Demote User', value: 'demote_user' }
|
|
: { disabled: false, label: 'Promote User', value: 'promote_user' };
|
|
|
|
if (invite) return inviteActions;
|
|
|
|
const result = [
|
|
userEnableAction,
|
|
userPromotionAction,
|
|
];
|
|
if (!user.sso_enabled) {
|
|
result.push({ disabled: false, label: 'Require Password Reset', value: 'reset_password' });
|
|
}
|
|
result.push({ disabled: false, label: 'Modify Details', value: 'modify_details' });
|
|
return result;
|
|
};
|
|
|
|
const userStatusLabel = (user, invite) => {
|
|
if (invite) {
|
|
return 'Invited';
|
|
}
|
|
|
|
return user.enabled ? 'Active' : 'Disabled';
|
|
};
|
|
|
|
export default { userActionOptions, userStatusLabel };
|