LdapContext.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 LdapContext extends BaseEntity {
  18. product!: String;
  19. providerUrl!: String;
  20. principal!: String;
  21. credentials!: String;
  22. sslSwitch!: Number;
  23. filters!: String;
  24. basedn!: String;
  25. msadDomain!: String;
  26. accountMapping!: String;
  27. trustStore!: String;
  28. trustStorePassword!: String;
  29. switch_sslSwitch: boolean = false;
  30. switch_accountMapping: boolean = false;
  31. override init(data: any): void {
  32. Object.assign(this, data);
  33. if (this.sslSwitch == 1) {
  34. this.switch_sslSwitch = true;
  35. }
  36. if (this.status == 1) {
  37. this.switch_status = true;
  38. }
  39. if (this.accountMapping == 'YES') {
  40. this.switch_accountMapping = true;
  41. }
  42. }
  43. override trans(): void {
  44. if (this.switch_sslSwitch) {
  45. this.sslSwitch = 1;
  46. } else {
  47. this.sslSwitch = 0;
  48. }
  49. if (this.switch_status) {
  50. this.status = 1;
  51. } else {
  52. this.status = 0;
  53. }
  54. if (this.switch_accountMapping) {
  55. this.accountMapping = 'YES';
  56. } else {
  57. this.accountMapping = 'NO';
  58. }
  59. }
  60. }