editUserUtils.js 919 B

12345678910111213141516171819202122232425262728
  1. // ---------------------------------------------------------------------------
  2. // Ordner: components/admin/users/edit-user
  3. // Datei: editUserUtils.js
  4. // Relativer Pfad: components/admin/users/edit-user/editUserUtils.js
  5. // ---------------------------------------------------------------------------
  6. import { ROLE_LABELS_DE } from "@/components/admin/users/usersUi";
  7. export const EDIT_ROLE_OPTIONS = Object.freeze([
  8. { value: "branch", label: ROLE_LABELS_DE.branch },
  9. { value: "admin", label: ROLE_LABELS_DE.admin },
  10. { value: "superadmin", label: ROLE_LABELS_DE.superadmin },
  11. { value: "dev", label: ROLE_LABELS_DE.dev },
  12. ]);
  13. export const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  14. export const BRANCH_RE = /^NL\d+$/;
  15. export function normalizeUsername(value) {
  16. return String(value || "")
  17. .trim()
  18. .toLowerCase();
  19. }
  20. export function normalizeEmail(value) {
  21. return String(value || "")
  22. .trim()
  23. .toLowerCase();
  24. }