freeipa-webui icon indicating copy to clipboard operation
freeipa-webui copied to clipboard

[Redux] Refactor user slices to reduce the code

Open carma12 opened this issue 1 year ago • 1 comments

Currently, there are a lot of variables composing the User data type:

export interface User {
  // identity
  title: string;
  givenname: string;
  sn: string;
  displayname: string;
  initials: string;
  gecos: string;
  userclass: string;
  // account
  uid: string;
  has_password: boolean;
  krbpasswordexpiration: string;
  uidnumber: string;
  gidnumber: string;
  krbprincipalname: string;
  krbprincipalexpiration: string;
  loginshell: string;
  homedirectory: string;
  ipasshpubkey: string[]; // multivalue
  usercertificate: string[]; // multivalue
  ipacertmapdata: string[]; // multivalue
  ipauserauthtype: UserAuthTypes;
  ipatokenradiusconfiglink: string[];
  ipatokenradiususername: string;
  ipaidpconfiglink: string[];
  ipaidpsub: string;
  // pwpolicy
  krbmaxpwdlife: string;
  krbminpwdlife: string;
  krbpwdhistorylength: string;
  krbpwdmindiffchars: string;
  krbpwdminlength: string;
  krbpwdmaxfailure: string;
  krbpwdfailurecountinterval: string;
  krbpwdlockoutduration: string;
  passwordgracelimit: string;
  // krbtpolicy
  krbmaxrenewableage: string;
  krbmaxticketlife: string;
  // contact
  mail: string[]; // multivalue
  telephonenumber: string[]; // multivalue
  pager: string[]; // multivalue
  mobile: string[]; // multivalue
  facsimiletelephonenumber: string[]; // multivalue
  // mailing
  street: string;
  l: string;
  st: string;
  postalcode: string;
  // employee
  ou: string;
  manager: string[]; // multivalue
  departmentnumber: string[]; // multivalue
  employeenumber: string;
  employeetype: string;
  preferredlanguage: string;
  // misc
  carlicense: string[]; // multivalue
  // smb_attributes
  ipantlogonscript: string;
  ipantprofilepath: string;
  ipanthomedirectory: string;
  ipanthomedirectorydrive: string;
  // 'Member of' data
  memberof_group: string[]; // multivalue
  // 'Managed by' data
  mepmanagedentry: string[];
  // other
  cn: string;
  krbcanonicalname: string[];
  nsaccountlock: boolean; // status (Enable: False | Disabled: True)
  objectclass: any[];
  ipauniqueid: string;
  ipantsecurityidentifier: string;
  attributelevelrights: Record<string, unknown>; // Generic, any type of object
  has_keytab: boolean;
  preserved: boolean;
  dn: string;
}

This User data type is used in the user Redux slices (activeUsers-slice, stageUsers-slice, preservedUsers-slice) to manage the user data in the following components: ActiveUsers, StageUsers, and PreservedUsers. But this structure is used on each reducer to perform certain operations, replicating the same code over the functions.

RFE: Refactor the user slices to make the code more readable and maintainable.

carma12 avatar May 04 '23 11:05 carma12

This issue has not received any attention in 120 days.

github-actions[bot] avatar Dec 11 '23 12:12 github-actions[bot]