Users.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import { BaseEntity } from './BaseEntity';
  17. export class Users extends BaseEntity {
  18. username!: String;
  19. password!: String;
  20. decipherable!: String;
  21. sharedSecret!: String;
  22. sharedCounter!: String;
  23. /**
  24. * "Employee", "Supplier","Dealer","Contractor",Partner,Customer "Intern",
  25. * "Temp", "External", and "Unknown" .
  26. */
  27. userType!: String;
  28. userState!: String;
  29. windowsAccount!: String;
  30. // for user name
  31. displayName!: String;
  32. nickName!: String;
  33. nameZhSpell!: String;
  34. nameZhShortSpell!: String;
  35. givenName!: String;
  36. middleName!: String;
  37. familyName!: String;
  38. honorificPrefix!: String;
  39. honorificSuffix!: String;
  40. formattedName!: String;
  41. married!: Number;
  42. gender!: Number;
  43. birthDate!: String;
  44. picture!: String;
  45. pictureId!: String;
  46. pictureBase64!: string;
  47. idType!: Number;
  48. idCardNo!: String;
  49. education!: String;
  50. graduateFrom!: String;
  51. graduateDate!: String;
  52. webSite!: String;
  53. startWorkDate!: String;
  54. // for security
  55. authnType!: String;
  56. email!: String;
  57. emailVerified!: Number;
  58. mobile!: String;
  59. mobileVerified!: String;
  60. passwordQuestion!: String;
  61. passwordAnswer!: String;
  62. // for apps login protected
  63. appLoginAuthnType!: String;
  64. appLoginPassword!: String;
  65. protectedApps!: String;
  66. protectedAppsMap!: String;
  67. passwordLastSetTime!: String;
  68. badPasswordCount!: Number;
  69. badPasswordTime!: String;
  70. unLockTime!: String;
  71. isLocked!: Number;
  72. lastLoginTime!: String;
  73. lastLoginIp!: String;
  74. lastLogoffTime!: String;
  75. passwordSetType!: Number;
  76. loginCount!: Number;
  77. regionHistory!: String;
  78. passwordHistory!: String;
  79. locale!: String;
  80. timeZone!: String;
  81. preferredLanguage!: String;
  82. // for work
  83. workCountry!: String;
  84. workRegion!: String; // province;
  85. workLocality!: String; // city;
  86. workStreetAddress!: String;
  87. workAddressFormatted!: String;
  88. workEmail!: String;
  89. workPhoneNumber!: String;
  90. workPostalCode!: String;
  91. workFax!: String;
  92. workOfficeName!: String;
  93. // for home
  94. homeCountry!: String;
  95. homeRegion!: String; // province;
  96. homeLocality!: String; // city;
  97. homeStreetAddress!: String;
  98. homeAddressFormatted!: String;
  99. homeEmail!: String;
  100. homePhoneNumber!: String;
  101. homePostalCode!: String;
  102. homeFax!: String;
  103. // for company
  104. employeeNumber!: String;
  105. costCenter!: String;
  106. organization!: String;
  107. division!: String;
  108. departmentId!: String;
  109. department!: String;
  110. jobTitle!: String;
  111. jobLevel!: String;
  112. managerId!: String;
  113. manager!: String;
  114. assistantId!: String;
  115. assistant!: String;
  116. entryDate!: String;
  117. quitDate!: String;
  118. // for social contact
  119. defineIm!: String;
  120. theme!: String;
  121. /*
  122. * for extended Attribute from userType extraAttribute for database
  123. * extraAttributeName & extraAttributeValue for page submit
  124. */
  125. //protected String extraAttribute;
  126. //protected String extraAttributeName;
  127. //protected String extraAttributeValue;
  128. //@JsonIgnore
  129. //protected HashMap<String, String> extraAttributeMap;
  130. online!: Number;
  131. gridList!: Number;
  132. switch_dynamic: boolean = false;
  133. gender_select!: String;
  134. str_married!: String;
  135. str_idType!: String;
  136. constructor() {
  137. super();
  138. this.status = 1;
  139. this.sortIndex = 1;
  140. this.gender = 1;
  141. this.userType = 'EMPLOYEE';
  142. this.userState = 'RESIDENT';
  143. this.gender_select = '1';
  144. this.str_married = '0';
  145. this.str_idType = '0';
  146. }
  147. override init(data: any): void {
  148. Object.assign(this, data);
  149. if (this.status == 1) {
  150. this.switch_status = true;
  151. }
  152. if (this.gender == 1) {
  153. this.gender_select = '1';
  154. } else {
  155. this.gender_select = '2';
  156. }
  157. this.str_status = `${this.status}`;
  158. this.str_married = `${this.married}`;
  159. this.str_idType = `${this.idType}`;
  160. }
  161. override trans(): void {
  162. if (this.switch_status) {
  163. this.status = 1;
  164. } else {
  165. this.status = 0;
  166. }
  167. if (this.gender_select == '1') {
  168. this.gender = 1;
  169. } else {
  170. this.gender = 2;
  171. }
  172. this.status = Number.parseInt(`${this.str_status}`);
  173. this.married = Number.parseInt(`${this.str_married}`);
  174. this.idType = Number.parseInt(`${this.str_idType}`);
  175. }
  176. }