-
Notifications
You must be signed in to change notification settings - Fork 80
/
sasl.jsx
764 lines (718 loc) · 30.3 KB
/
sasl.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
import cockpit from "cockpit";
import React from "react";
import { DoubleConfirmModal } from "../notifications.jsx";
import { log_cmd } from "../tools.jsx";
import {
Button,
Checkbox,
Col,
ControlLabel,
Form,
FormControl,
Icon,
Row,
Spinner,
} from "patternfly-react";
import { SASLTable } from "./serverTables.jsx";
import { SASLMappingModal } from "./serverModals.jsx";
import { Typeahead } from "react-bootstrap-typeahead";
export class ServerSASL extends React.Component {
constructor(props) {
super(props);
this.state = {
configLoading: false,
tableLoading: false,
loaded: false,
activeKey: 1,
errObj: {},
saveDisabled: true,
supportedMechs: [],
// Main settings
allowedMechs: [],
mappingFallback: false,
maxBufSize: "",
// Mapping modal
showMapping: false,
saveMappingDisabled: true,
testRegexDisabled: true,
testBtnDisabled: true,
saslMapName: "",
saslMapRegex: "",
saslTestText: "",
saslBase: "",
saslFilter: "",
saslPriority: "100",
saslModalType: "Create",
saslErrObj: {},
showConfirmDelete: false,
modalChecked: false,
};
this.handleChange = this.handleChange.bind(this);
this.handleModalChange = this.handleModalChange.bind(this);
this.handleModalAddChange = this.handleModalAddChange.bind(this);
this.handleTestRegex = this.handleTestRegex.bind(this);
this.loadConfig = this.loadConfig.bind(this);
this.loadMechs = this.loadMechs.bind(this);
this.loadSASLMappings = this.loadSASLMappings.bind(this);
this.saveConfig = this.saveConfig.bind(this);
this.showCreateMapping = this.showCreateMapping.bind(this);
this.showEditMapping = this.showEditMapping.bind(this);
this.closeMapping = this.closeMapping.bind(this);
this.showConfirmDelete = this.showConfirmDelete.bind(this);
this.closeConfirmDelete = this.closeConfirmDelete.bind(this);
this.createMapping = this.createMapping.bind(this);
this.editMapping = this.editMapping.bind(this);
this.deleteMapping = this.deleteMapping.bind(this);
}
componentDidMount() {
// Loading config
if (!this.state.loaded) {
this.loadConfig();
} else {
this.props.enableTree();
}
}
handleTestRegex() {
let test_string = this.state.saslTestText;
let regex = this.state.saslMapRegex;
let cleaned_regex = regex.replace(/\\\(/g, '(').replace(/\\\)/g, ')');
let sasl_regex = RegExp(cleaned_regex);
if (sasl_regex.test(test_string)) {
this.props.addNotification(
"success",
"The test string matches the Regular Expression"
);
} else {
this.props.addNotification(
"warning",
"The test string does not match the Regular Expression"
);
}
}
handleChange(e) {
let attr = "";
let value = "";
let isArray = false;
let chkBox = false;
let disableSaveBtn = true;
let valueErr = false;
let errObj = this.state.errObj;
// Could be a typeahead change, check if "e" is an Array
if (Array.isArray(e)) {
isArray = true;
attr = "allowedMechs";
value = e;
} else {
value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
attr = e.target.id;
if (e.target.type === 'checkbox') {
chkBox = true;
}
}
// Check if a setting was changed, if so enable the save button
if (attr == 'mappingFallback' && this.state._mappingFallback != value) {
disableSaveBtn = false;
} else if (attr == 'saslPriority' && this.state._saslPriority != value) {
disableSaveBtn = false;
} else if (attr == 'maxBufSize' && this.state._maxBufSize != value) {
disableSaveBtn = false;
} else if (attr == 'allowedMechs' && this.state._allowedMechs.join(' ') != value.join(' ')) {
if (this.state._allowedMechs.length > value.length) {
// The way allow mechanisms work if that once you set it initially
// you can't edit it without removing all the current mecahisms. So
// if we remove one, just remove them all and make the user start over.
// MARK THIS DOES NOT WORK
value = [];
}
disableSaveBtn = false;
}
// Now check for differences in values that we did not touch
if (attr != 'mappingFallback' && this.state._mappingFallback != this.state.mappingFallback) {
disableSaveBtn = false;
} else if (attr != 'saslPriority' && this.state._saslPriority != this.state.saslPriority) {
disableSaveBtn = false;
} else if (attr != 'maxBufSize' && this.state._maxBufSize != this.state.maxBufSize) {
disableSaveBtn = false;
} else if (attr != 'allowedMechs' && this.state._allowedMechs.join(' ') != this.state.allowedMechs.join(' ')) {
disableSaveBtn = false;
}
if (!isArray && !chkBox && value == "") {
valueErr = true;
disableSaveBtn = true;
}
errObj[attr] = valueErr;
this.setState({
[attr]: value,
saveDisabled: disableSaveBtn,
errObj: errObj,
});
}
handleModalAddChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
let disableRegexTestBtn = true;
let valueErr = false;
let errObj = this.state.errObj;
// Check if a setting was changed, if so enable the save button
if (attr == 'saslMapName' && value != "") {
disableSaveBtn = false;
} else if (attr == 'saslMapRegex' && value != "") {
disableSaveBtn = false;
} else if (attr == 'saslBase' && value != "") {
disableSaveBtn = false;
} else if (attr == 'saslPriority' && value != "0") {
disableSaveBtn = false;
} else if (attr == 'saslFilter' && value != "") {
disableSaveBtn = false;
}
if (!disableSaveBtn) {
// Make sure every other field is set
if (attr != 'saslMapName' && this.state.saslMapName == "") {
disableSaveBtn = true;
}
if (attr != 'saslMapRegex' && this.state.saslMapRegex == "") {
disableSaveBtn = true;
}
if (attr != 'saslBase' && this.state.saslBase == "") {
disableSaveBtn = true;
}
if (attr != 'saslFilter' && this.state.saslFilter == "") {
disableSaveBtn = true;
}
}
// Handle Test Text field and buttons
if (attr == 'saslTestText' && value != "" && this.state.saslMapRegex != "") {
disableRegexTestBtn = false;
}
if (attr != 'saslTestText' && this.state.saslMapRegex != "" && this.state.saslTestText != "") {
disableRegexTestBtn = false;
}
errObj[attr] = valueErr;
this.setState({
[attr]: value,
saveMappingDisabled: disableSaveBtn,
testBtnDisabled: disableRegexTestBtn,
errObj: errObj,
});
}
handleModalChange(e) {
let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
let attr = e.target.id;
let disableSaveBtn = true;
let disableRegexTestBtn = true;
let valueErr = false;
let errObj = this.state.errObj;
// Check if a setting was changed, if so enable the save button
if (attr == 'saslMapName' && this.state._saslMapName != value) {
disableSaveBtn = false;
} else if (attr == 'saslMapRegex' && this.state._saslMapRegex != value) {
disableSaveBtn = false;
} else if (attr == 'saslBase' && this.state._saslBase != value) {
disableSaveBtn = false;
} else if (attr == 'saslFilter' && this.state._saslFilter != value) {
disableSaveBtn = false;
} else if (attr == 'saslPriority' && this.state._saslPriority != value) {
disableSaveBtn = false;
}
// Now check for differences in values that we did not touch
if (attr != 'saslMapName' && this.state._saslMapName != this.state.saslMapName) {
disableSaveBtn = false;
} else if (attr != 'saslMapRegex' && this.state._saslMapRegex != this.state.saslMapRegex) {
disableSaveBtn = false;
} else if (attr != 'saslBase' && this.state._saslBase != this.state.saslBase) {
disableSaveBtn = false;
} else if (attr != 'saslFilter' && this.state._saslFilter != this.state.saslFilter) {
disableSaveBtn = false;
} else if (attr != 'saslPriority' && this.state._saslPriority != this.state.saslPriority) {
disableSaveBtn = false;
}
// Handle TEst Text filed and buttons
if (attr == 'saslTestText' && value != "" && this.state.saslMapRegex != "") {
disableRegexTestBtn = false;
}
if (attr != 'saslTestText' && this.state.saslMapRegex != "" && this.state.saslTestText != "") {
disableRegexTestBtn = false;
}
if (value == "" && attr != "saslTestText") {
valueErr = true;
disableSaveBtn = true;
}
errObj[attr] = valueErr;
this.setState({
[attr]: value,
saveMappingDisabled: disableSaveBtn,
testBtnDisabled: disableRegexTestBtn,
errObj: errObj,
});
}
loadConfig() {
let cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
"config", 'get'
];
log_cmd("loadConfig", "Get SASL settings", cmd);
cockpit
.spawn(cmd, { superuser: true, err: "message" })
.done(content => {
let config = JSON.parse(content);
let attrs = config.attrs;
let allowedMechsVal = attrs['nsslapd-allowed-sasl-mechanisms'][0];
let allowedMechs = [];
let fallback = false;
if (attrs['nsslapd-sasl-mapping-fallback'][0] == "on") {
fallback = true;
}
if (allowedMechsVal != "") {
// Could be space or comma separated
if (allowedMechsVal.indexOf(',') > -1) {
allowedMechsVal = allowedMechsVal.trim();
allowedMechs = allowedMechsVal.split(',');
} else {
allowedMechs = allowedMechsVal.split();
}
}
this.setState({
maxBufSize: attrs['nsslapd-sasl-max-buffer-size'][0],
allowedMechs: allowedMechs,
mappingFallback: fallback,
saveDisabled: true,
// Store original values
_maxBufSize: attrs['nsslapd-sasl-max-buffer-size'][0],
_allowedMechs: allowedMechs,
_mappingFallback: fallback,
}, this.loadMechs());
});
}
loadMechs() {
let cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket", "sasl", 'get-mechs'
];
log_cmd("loadMechs", "Get supported SASL mechanisms", cmd);
cockpit
.spawn(cmd, { superuser: true, err: "message" })
.done(content => {
const config = JSON.parse(content);
this.setState({
supportedMechs: config.items
}, this.loadSASLMappings());
});
}
loadSASLMappings() {
let cmd = ["dsconf", '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket", 'sasl', 'list', '--details'];
log_cmd('get_and_set_sasl', 'Get SASL mappings', cmd);
cockpit
.spawn(cmd, { superuser: true, err: "message" })
.done(content => {
let saslMapObj = JSON.parse(content);
let mappings = [];
for (let mapping of saslMapObj['items']) {
if (!mapping['attrs'].hasOwnProperty('nssaslmappriority')) {
mapping['attrs'].nssaslmappriority = ['100'];
}
mappings.push(mapping['attrs']);
}
this.setState({
mappings: mappings,
loaded: true,
tableLoading: false,
configLoading: false,
}, this.props.enableTree);
});
}
showCreateMapping() {
this.setState({
showMappingModal: true,
saveMappingDisabled: true,
testRegexDisabled: true,
saslModalType: "Create",
saslMapName: "",
saslMapRegex: "",
saslTestText: "",
saslBase: "",
saslFilter: "",
saslPriority: "100",
saslErrObj: {},
});
}
closeMapping() {
this.setState({
showMappingModal: false,
});
}
showEditMapping(name, regex, base, filter, priority) {
this.setState({
showMappingModal: true,
saveMappingDisabled: true,
testRegexDisabled: true,
saslModalType: "Edit",
saslMapName: name,
saslMapRegex: regex,
saslTestText: "",
saslBase: base,
saslFilter: filter,
saslPriority: priority,
// Note original values
_saslMapName: name,
_saslMapRegex: regex,
_saslTestText: "",
_saslBase: base,
_saslFilter: filter,
_saslPriority: priority,
saslErrObj: {},
});
}
showConfirmDelete(name) {
this.setState({
saslMapName: name,
modalChecked: false,
showConfirmDelete: true,
});
}
closeConfirmDelete() {
this.setState({
modalChecked: false,
showConfirmDelete: false,
});
}
createMapping() {
this.setState({
tableLoading: true,
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'sasl', 'create',
'--cn=' + this.state.saslMapName,
'--nsSaslMapFilterTemplate=' + this.state.saslFilter,
'--nsSaslMapRegexString=' + this.state.saslMapRegex,
'--nsSaslMapBaseDNTemplate=' + this.state.saslBase,
'--nsSaslMapPriority=' + this.state.saslPriority
];
log_cmd("createMapping", "Create sasl mapping", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadConfig();
this.closeMapping();
this.props.addNotification(
"success",
"Successfully create new SASL Mapping"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadConfig();
this.props.addNotification(
"error",
`Error creating new SASL Mapping - ${errMsg.desc}`
);
});
}
editMapping(name) {
// Start spinning
let new_mappings = this.state.mappings;
for (let saslMap of new_mappings) {
if (saslMap.cn[0] == name) {
saslMap.nssaslmapregexstring = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapregexstring[0]} loading size="sm" />];
saslMap.nssaslmapbasedntemplate = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapbasedntemplate[0]} loading size="sm" />];
saslMap.nssaslmapfiltertemplate = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapfiltertemplate[0]} loading size="sm" />];
saslMap.nssaslmappriority = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmappriority[0]} loading size="sm" />];
}
}
this.setState({
mappings: new_mappings
});
// Delete and create
let delete_cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'sasl', 'delete', this.state._saslMapName
];
let create_cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'sasl', 'create',
'--cn=' + this.state.saslMapName,
'--nsSaslMapFilterTemplate=' + this.state.saslFilter,
'--nsSaslMapRegexString=' + this.state.saslMapRegex,
'--nsSaslMapBaseDNTemplate=' + this.state.saslBase,
'--nsSaslMapPriority=' + this.state.saslPriority
];
log_cmd("editMapping", "deleting sasl mapping", delete_cmd);
cockpit
.spawn(delete_cmd, {superuser: true, "err": "message"})
.done(content => {
log_cmd("editMapping", "Create new sasl mapping", create_cmd);
cockpit
.spawn(create_cmd, {superuser: true, "err": "message"})
.done(content => {
this.closeMapping();
this.loadConfig();
this.props.addNotification(
"success",
"Successfully updated SASL Mapping"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.closeMapping();
this.loadConfig();
this.props.addNotification(
"error",
`Error updating SASL Mapping - ${errMsg.desc}`
);
});
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadConfig();
this.closeMapping();
this.props.addNotification(
"error",
`Error replacing SASL Mapping - ${errMsg.desc}`
);
});
}
deleteMapping() {
// Start spinning
let new_mappings = this.state.mappings;
for (let saslMap of new_mappings) {
if (saslMap.cn[0] == this.state.saslMapName) {
saslMap.nssaslmapregexstring = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapregexstring[0]} loading size="sm" />];
saslMap.nssaslmapbasedntemplate = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapbasedntemplate[0]} loading size="sm" />];
saslMap.nssaslmapfiltertemplate = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmapfiltertemplate[0]} loading size="sm" />];
saslMap.nssaslmappriority = [<Spinner className="ds-lower-field" key={new_mappings[0].nssaslmappriority[0]} loading size="sm" />];
}
}
this.setState({
mappings: new_mappings
});
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
'sasl', 'delete', this.state.saslMapName
];
log_cmd("deleteMapping", "Delete sasl mapping", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.closeConfirmDelete();
this.loadConfig();
this.props.addNotification(
"success",
"Successfully deleted SASL Mapping"
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadConfig();
this.closeConfirmDelete();
this.props.addNotification(
"error",
`Error deleting SASL Mapping - ${errMsg.desc}`
);
});
}
saveConfig() {
// Start spinning
this.setState({
configLoading: true,
});
// Build up the command list
let cmd = [
'dsconf', '-j', "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket", 'config', 'replace'
];
let mech_str_new = this.state.allowedMechs.join(' ');
let mech_str_orig = this.state._allowedMechs.join(' ');
if (mech_str_orig != mech_str_new) {
cmd.push("nsslapd-allowed-sasl-mechanisms=" + mech_str_new);
}
if (this.state._mappingFallback != this.state.mappingFallback) {
let value = "off";
if (this.state.mappingFallback) {
value = "on";
}
cmd.push("nsslapd-sasl-mapping-fallback=" + value);
}
if (this.state._maxBufSize != this.state.maxBufSize) {
cmd.push("nsslapd-sasl-max-buffer-size=" + this.state.maxBufSize);
}
log_cmd("saveConfig", "Applying SASL config change", cmd);
cockpit
.spawn(cmd, {superuser: true, "err": "message"})
.done(content => {
this.loadConfig();
this.props.addNotification(
"success",
"Successfully updated SASL configuration. These " +
"changes require the server to be restarted to take effect."
);
})
.fail(err => {
let errMsg = JSON.parse(err);
this.loadConfig();
this.props.addNotification(
"error",
`Error updating SASL configuration - ${errMsg.desc}`
);
});
}
render() {
let configSpinner = "";
let tableSpinner = " ";
let body = "";
if (this.state.tableLoading) {
tableSpinner = <Spinner loading size="sm" />;
}
if (this.state.configLoading) {
configSpinner = <Spinner loading size="md" />;
}
if (!this.state.loaded) {
body =
<div className="ds-loading-spinner ds-margin-top ds-center">
<h4>Loading SASL configuration ...</h4>
<Spinner className="ds-margin-top" loading size="md" />
</div>;
} else {
body =
<div className="ds-margin-left-sm">
<Row>
<Col sm={3} className="ds-word-wrap">
<ControlLabel className="ds-suffix-header ds-margin-top-lg">
SASL Settings
<Icon className="ds-left-margin ds-refresh"
type="fa" name="refresh" title="Refresh SASL configuration"
onClick={() => {
this.loadConfig();
}}
/>
</ControlLabel>
</Col>
<Col sm={1} className="ds-margin-top-lg">
{configSpinner}
</Col>
</Row>
<hr />
<Form>
<Row title="The maximum SASL buffer size in bytes (nsslapd-sasl-max-buffer-size)." className="ds-margin-top">
<Col componentClass={ControlLabel} sm={3}>
Max SASL Buffer Size
</Col>
<Col sm={4}>
<FormControl
id="maxBufSize"
type="number"
min="-1"
max="2147483647"
value={this.state.maxBufSize}
onChange={this.handleChange}
/>
</Col>
</Row>
<Row
title="A list of SASL mechanisms the server will only accept (nsslapd-allowed-sasl-mechanisms). The default is all mechanisms are allowed."
className="ds-margin-top"
>
<Col componentClass={ControlLabel} sm={3}>
Allowed SASL Mechanisms
</Col>
<Col sm={4}>
<Typeahead
id="allowedMechs"
onChange={value => {
this.handleChange(value);
}}
multiple
options={this.state.supportedMechs}
selected={this.state.allowedMechs}
placeholder="Type SASL mechanism to allow"
ref={(typeahead) => { this.typeahead = typeahead }}
/>
</Col>
</Row>
<Row
title="Check all sasl mappings until one succeeds or they all fail (nsslapd-sasl-mapping-fallback)."
className="ds-margin-top"
>
<Checkbox
checked={this.state.mappingFallback}
id="mappingFallback"
onChange={this.handleChange} className="ds-margin-left-sm"
>
Allow SASL Mapping Fallback
</Checkbox>
</Row>
</Form>
<Button
disabled={this.state.saveDisabled}
bsStyle="primary"
className="ds-margin-top-med"
onClick={this.saveConfig}
>
Save Settings
</Button>
<hr />
<Row>
<h4 className="ds-center ds-logo-style">
<div className="ds-inline">
<ControlLabel>
<b>SASL Mappings</b>
</ControlLabel>
</div>
<div className="ds-left-indent ds-inline">
<ControlLabel>
{tableSpinner}
</ControlLabel>
</div>
</h4>
</Row>
<SASLTable
rows={this.state.mappings}
editMapping={this.showEditMapping}
deleteMapping={this.showConfirmDelete}
className="ds-margin-top"
/>
<Button
bsStyle="primary"
className="ds-margin-top-med"
onClick={this.showCreateMapping}
>
Create New Mapping
</Button>
</div>;
}
return (
<div id="server-sasl-page">
{body}
<SASLMappingModal
showModal={this.state.showMappingModal}
testBtnDisabled={this.state.testBtnDisabled}
saveDisabled={this.state.saveMappingDisabled}
closeHandler={this.closeMapping}
handleChange={this.state.saslModalType == "Create" ? this.handleModalAddChange : this.handleModalChange}
handleTestRegex={this.handleTestRegex}
saveHandler={this.state.saslModalType == "Create" ? this.createMapping : this.editMapping}
error={this.state.saslErrObj}
type={this.state.saslModalType}
name={this.state.saslMapName}
regex={this.state.saslMapRegex}
testText={this.state.saslTestText}
base={this.state.saslBase}
filter={this.state.saslFilter}
priority={this.state.saslPriority}
spinning={this.state.tableLoading}
/>
<DoubleConfirmModal
showModal={this.state.showConfirmDelete}
closeHandler={this.closeConfirmDelete}
handleChange={this.handleModalChange}
actionHandler={this.deleteMapping}
item={this.state.saslMapName}
checked={this.state.modalChecked}
spinning={this.state.tableLoading}
mTitle="Delete SASL Mapping"
mMsg="Are you sure you want to delete this SASL mapping?"
mSpinningMsg="Deleting SASL Mapping ..."
mBtnName="Delete Mapping"
/>
</div>
);
}
}