mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
## For #25032 <img width="1792" alt="Screenshot 2025-01-07 at 6 50 39 PM" src="https://github.com/user-attachments/assets/17a63b3d-a983-433a-a3c4-6c66dbb08fce" /> - Add new `include_ui_settings` query param to `GET` `/me` calls - Use new `settings` in response to set settings into UI context - On hosts page, use that context, if present, to set which columns are hidden. Fallback to a default set of hidden columns. - When updating visible columns, persist preference via `PATCH` to `/users/:id` with a new `settings` payload - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
123 lines
2.6 KiB
TypeScript
123 lines
2.6 KiB
TypeScript
import PropTypes from "prop-types";
|
|
import teamInterface, { ITeam } from "./team";
|
|
import { IUserSettings } from "./config";
|
|
|
|
export default PropTypes.shape({
|
|
created_at: PropTypes.string,
|
|
updated_at: PropTypes.string,
|
|
id: PropTypes.number,
|
|
name: PropTypes.string,
|
|
email: PropTypes.string,
|
|
role: PropTypes.string,
|
|
force_password_reset: PropTypes.bool,
|
|
gravatar_url: PropTypes.string,
|
|
sso_enabled: PropTypes.bool,
|
|
mfa_enabled: PropTypes.bool,
|
|
global_role: PropTypes.string,
|
|
api_only: PropTypes.bool,
|
|
teams: PropTypes.arrayOf(teamInterface),
|
|
});
|
|
|
|
export const USERS_ROLES = [
|
|
"admin",
|
|
"maintainer",
|
|
"observer",
|
|
"observer_plus",
|
|
] as const;
|
|
export type IUserRole = typeof USERS_ROLES[number];
|
|
export type UserRole =
|
|
| "admin"
|
|
| "maintainer"
|
|
| "observer"
|
|
| "observer_plus"
|
|
| "gitops"
|
|
| "Admin"
|
|
| "Maintainer"
|
|
| "Observer"
|
|
| "Observer+"
|
|
| "GitOps"
|
|
| "Unassigned"
|
|
| ""
|
|
| "Various";
|
|
|
|
export interface IUser {
|
|
created_at?: string;
|
|
updated_at?: string;
|
|
id: number;
|
|
name: string;
|
|
email: string;
|
|
role: UserRole;
|
|
force_password_reset: boolean;
|
|
gravatar_url?: string;
|
|
gravatar_url_dark?: string;
|
|
sso_enabled: boolean;
|
|
mfa_enabled?: boolean;
|
|
global_role: UserRole | null;
|
|
api_only: boolean;
|
|
teams: ITeam[];
|
|
}
|
|
|
|
/**
|
|
* The shape of the request body when updating a user.
|
|
*/
|
|
export interface IUserUpdateBody {
|
|
global_role?: UserRole | null;
|
|
teams?: ITeam[];
|
|
name: string;
|
|
email?: string;
|
|
sso_enabled?: boolean;
|
|
mfa_enabled?: boolean;
|
|
role?: UserRole;
|
|
id: number;
|
|
}
|
|
|
|
export interface IUserFormErrors {
|
|
email?: string | null;
|
|
name?: string | null;
|
|
password?: string | null;
|
|
sso_enabled?: boolean | null;
|
|
}
|
|
export interface IResetPasswordFormErrors {
|
|
new_password?: string | null;
|
|
new_password_confirmation?: string | null;
|
|
}
|
|
|
|
export interface IResetPasswordForm {
|
|
new_password: string;
|
|
new_password_confirmation: string;
|
|
}
|
|
|
|
export interface ILoginUserData {
|
|
email: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface ICreateUserFormData {
|
|
email: string;
|
|
global_role: UserRole | null;
|
|
name: string;
|
|
password?: string | null;
|
|
sso_enabled?: boolean;
|
|
mfa_enabled?: boolean;
|
|
teams: ITeam[];
|
|
}
|
|
|
|
export interface IUpdateUserFormData {
|
|
currentUserId?: number;
|
|
email?: string;
|
|
global_role?: UserRole | null;
|
|
name?: string;
|
|
password?: string | null;
|
|
sso_enabled?: boolean;
|
|
mfa_enabled?: boolean;
|
|
teams?: ITeam[];
|
|
settings?: IUserSettings;
|
|
}
|
|
|
|
export interface ICreateUserWithInvitationFormData {
|
|
email: string;
|
|
invite_token: string;
|
|
name: string;
|
|
password: string;
|
|
password_confirmation: string;
|
|
}
|