Fix SSSD Config
This commit is contained in:
parent
75e3f0f4d3
commit
2fe77ec1da
1 changed files with 25 additions and 12 deletions
|
|
@ -350,6 +350,7 @@ class SssdConfig extends React.Component {
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
this.handleInputChange = this.handleInputChange.bind(this);
|
this.handleInputChange = this.handleInputChange.bind(this);
|
||||||
this.setConfig = this.setConfig.bind(this);
|
this.setConfig = this.setConfig.bind(this);
|
||||||
|
this.confSave = this.confSave.bind(this);
|
||||||
this.file = null;
|
this.file = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
scope: "",
|
scope: "",
|
||||||
|
|
@ -359,6 +360,19 @@ class SssdConfig extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
confSave(obj) {
|
||||||
|
this.setState({submitting:"block"});
|
||||||
|
this.file.replace(obj).done(() => {
|
||||||
|
cockpit.spawn(["chmod", "600", "/etc/sssd/conf.d/sssd-session-recording.conf"], { "superuser": "require" }).done(() => {
|
||||||
|
cockpit.spawn(["systemctl", "restart", "sssd"], { "superuser": "require" }).done(() => {
|
||||||
|
this.setState({submitting:"none"});
|
||||||
|
})
|
||||||
|
.fail((data) => console.log(data));
|
||||||
|
})
|
||||||
|
.fail((data) => console.log(data));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
handleInputChange(e) {
|
handleInputChange(e) {
|
||||||
const value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
|
const value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
|
||||||
const name = e.target.name;
|
const name = e.target.name;
|
||||||
|
|
@ -368,9 +382,16 @@ class SssdConfig extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
setConfig(data) {
|
setConfig(data) {
|
||||||
|
if (data === null) {
|
||||||
|
const obj = {};
|
||||||
|
obj.session_recording = {};
|
||||||
|
obj.session_recording.scope = "none";
|
||||||
|
this.confSave(obj);
|
||||||
|
} else {
|
||||||
const config = {...data['session_recording']};
|
const config = {...data['session_recording']};
|
||||||
this.setState(config);
|
this.setState(config);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
let syntax_object = {
|
let syntax_object = {
|
||||||
|
|
@ -385,7 +406,7 @@ class SssdConfig extends React.Component {
|
||||||
|
|
||||||
let promise = this.file.read();
|
let promise = this.file.read();
|
||||||
|
|
||||||
promise.done(this.setConfig);
|
promise.done(() => this.file.watch(this.setConfig));
|
||||||
|
|
||||||
promise.fail(function(error) {
|
promise.fail(function(error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
@ -393,20 +414,12 @@ class SssdConfig extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
this.setState({submitting:"block"});
|
|
||||||
const obj = {};
|
const obj = {};
|
||||||
obj.session_recording = {};
|
obj.session_recording = {};
|
||||||
obj.session_recording.scope = this.state.scope;
|
obj.session_recording.scope = this.state.scope;
|
||||||
obj.session_recording.users = this.state.users;
|
obj.session_recording.users = this.state.users;
|
||||||
obj.session_recording.groups = this.state.groups;
|
obj.session_recording.groups = this.state.groups;
|
||||||
|
this.confSave(obj);
|
||||||
let _this = this;
|
|
||||||
this.file.replace(obj).done(function() {
|
|
||||||
_this.setState({submitting:"none"});
|
|
||||||
})
|
|
||||||
.fail(function(error) {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue