Users.ts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. webSite!: String;
  50. startWorkDate!: String;
  51. // for security
  52. authnType!: String;
  53. email!: String;
  54. emailVerified!: Number;
  55. mobile!: String;
  56. mobileVerified!: String;
  57. passwordQuestion!: String;
  58. passwordAnswer!: String;
  59. // for apps login protected
  60. appLoginAuthnType!: String;
  61. appLoginPassword!: String;
  62. protectedApps!: String;
  63. protectedAppsMap!: String;
  64. passwordLastSetTime!: String;
  65. badPasswordCount!: Number;
  66. badPasswordTime!: String;
  67. unLockTime!: String;
  68. isLocked!: Number;
  69. lastLoginTime!: String;
  70. lastLoginIp!: String;
  71. lastLogoffTime!: String;
  72. passwordSetType!: Number;
  73. loginCount!: Number;
  74. regionHistory!: String;
  75. passwordHistory!: String;
  76. locale!: String;
  77. timeZone!: String;
  78. preferredLanguage!: String;
  79. // for work
  80. workCountry!: String;
  81. workRegion!: String; // province;
  82. workLocality!: String; // city;
  83. workStreetAddress!: String;
  84. workAddressFormatted!: String;
  85. workEmail!: String;
  86. workPhoneNumber!: String;
  87. workPostalCode!: String;
  88. workFax!: String;
  89. workOfficeName!: String;
  90. // for home
  91. homeCountry!: String;
  92. homeRegion!: String; // province;
  93. homeLocality!: String; // city;
  94. homeStreetAddress!: String;
  95. homeAddressFormatted!: String;
  96. homeEmail!: String;
  97. homePhoneNumber!: String;
  98. homePostalCode!: String;
  99. homeFax!: String;
  100. // for company
  101. employeeNumber!: String;
  102. costCenter!: String;
  103. organization!: String;
  104. division!: String;
  105. departmentId!: String;
  106. department!: String;
  107. jobTitle!: String;
  108. jobLevel!: String;
  109. managerId!: String;
  110. manager!: String;
  111. assistantId!: String;
  112. assistant!: String;
  113. entryDate!: String;
  114. quitDate!: String;
  115. // for social contact
  116. defineIm!: String;
  117. theme!: String;
  118. /*
  119. * for extended Attribute from userType extraAttribute for database
  120. * extraAttributeName & extraAttributeValue for page submit
  121. */
  122. //protected String extraAttribute;
  123. //protected String extraAttributeName;
  124. //protected String extraAttributeValue;
  125. //@JsonIgnore
  126. //protected HashMap<String, String> extraAttributeMap;
  127. online!: Number;
  128. gridList!: Number;
  129. switch_dynamic: boolean = false;
  130. gender_select!: String;
  131. str_married!: String;
  132. str_idType!: String;
  133. constructor() {
  134. super();
  135. this.status = 1;
  136. this.sortIndex = 1;
  137. this.gender = 1;
  138. this.userType = 'EMPLOYEE';
  139. this.userState = 'RESIDENT';
  140. this.gender_select = '1';
  141. this.str_married = '0';
  142. this.str_idType = '0';
  143. }
  144. override init(data: any): void {
  145. Object.assign(this, data);
  146. if (this.status == 1) {
  147. this.switch_status = true;
  148. }
  149. if (this.gender == 1) {
  150. this.gender_select = '1';
  151. } else {
  152. this.gender_select = '2';
  153. }
  154. this.str_status = `${this.status}`;
  155. this.str_married = `${this.married}`;
  156. this.str_idType = `${this.idType}`;
  157. }
  158. override trans(): void {
  159. if (this.switch_status) {
  160. this.status = 1;
  161. } else {
  162. this.status = 0;
  163. }
  164. if (this.gender_select == '1') {
  165. this.gender = 1;
  166. } else {
  167. this.gender = 2;
  168. }
  169. this.status = Number.parseInt(`${this.str_status}`);
  170. this.married = Number.parseInt(`${this.str_married}`);
  171. this.idType = Number.parseInt(`${this.str_idType}`);
  172. }
  173. }