-
-
Configuration
-
+
+
+
General Configuration
+
+
+
+
+
diff --git a/src/config.jsx b/src/config.jsx
index 0277128..ae02053 100644
--- a/src/config.jsx
+++ b/src/config.jsx
@@ -23,6 +23,7 @@
let cockpit = require("cockpit");
let React = require("react");
let json = require('comment-json');
+ let ini = require('ini');
let Config = class extends React.Component {
constructor(props) {
@@ -273,7 +274,117 @@
);
}
}
- }
+ };
- React.render(
, document.getElementById('view'));
+ let SssdConfig = class extends React.Component {
+ constructor(props) {
+ super(props);
+ this.handleSubmit = this.handleSubmit.bind(this);
+ this.handleInputChange = this.handleInputChange.bind(this);
+ this.setConfig = this.setConfig.bind(this);
+ this.file = null;
+ this.state = {
+ config: {
+ session_recording: {
+ scope: null,
+ users: null,
+ groups: null,
+ },
+ },
+ };
+ }
+
+ handleInputChange(e){
+ const value = e.target.type === 'checkbox' ? e.target.checked : e.target.value;
+ const name = e.target.name;
+ const config = this.state.config;
+ config.session_recording[name] = value;
+
+ this.forceUpdate();
+ }
+
+ setConfig(data) {
+ this.setState({config: data});
+ }
+
+ componentDidMount() {
+ let syntax_object = {
+ parse: ini.parse,
+ stringify: ini.stringify
+ };
+
+ this.file = cockpit.file("/etc/sssd/conf.d/sssd-session-recording.conf", {
+ syntax: syntax_object,
+ superuser: true,
+ });
+
+ let promise = this.file.read();
+
+ promise.done(this.setConfig);
+
+ promise.fail(function(error) {
+ console.log(error);
+ });
+ }
+
+ handleSubmit() {
+ this.file.replace(this.state.config).done( function() {
+ console.log('updated');
+ })
+ .fail( function(error) {
+ console.log(error);
+ });
+ event.preventDefault();
+ }
+
+ render() {
+ return (
+
+ );
+ }
+ };
+
+ React.render(
, document.getElementById('sr_config'));
+ React.render(
, document.getElementById('sssd_config'));
}());