summaryrefslogtreecommitdiffstats
path: root/webapp/actions/admin_actions.jsx
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-01-27 11:39:13 +0100
committerGeorge Goldberg <george@gberg.me>2017-01-27 10:39:13 +0000
commitd72547433af3ec5829ce0de4f4e1cfd440be7142 (patch)
tree6bd7664e9058468842c7b7bb7c7a76abf1b7c5e3 /webapp/actions/admin_actions.jsx
parent49c677f6b46409289210abc0e0bda63735be3e9f (diff)
downloadchat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.gz
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.bz2
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.zip
Move remaining client functions in components to actions (#5171)
Diffstat (limited to 'webapp/actions/admin_actions.jsx')
-rw-r--r--webapp/actions/admin_actions.jsx404
1 files changed, 404 insertions, 0 deletions
diff --git a/webapp/actions/admin_actions.jsx b/webapp/actions/admin_actions.jsx
new file mode 100644
index 000000000..73b73c130
--- /dev/null
+++ b/webapp/actions/admin_actions.jsx
@@ -0,0 +1,404 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import Client from 'client/web_client.jsx';
+import * as AsyncClient from 'utils/async_client.jsx';
+import {browserHistory} from 'react-router/es6';
+
+export function revokeSession(altId, success, error) {
+ Client.revokeSession(altId,
+ () => {
+ AsyncClient.getSessions();
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function saveConfig(config, success, error) {
+ Client.saveConfig(
+ config,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function reloadConfig(success, error) {
+ Client.reloadConfig(
+ () => {
+ AsyncClient.getConfig();
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function adminResetMfa(userId, success, error) {
+ Client.adminResetMfa(
+ userId,
+ () => {
+ AsyncClient.getUser(userId);
+
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function getClusterStatus(success, error) {
+ Client.getClusterStatus(
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getClusterStatus');
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function saveComplianceReports(job, success, error) {
+ Client.saveComplianceReports(
+ job,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function testEmail(config, success, error) {
+ Client.testEmail(
+ config,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function ldapTest(success, error) {
+ Client.ldapTest(
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function invalidateAllCaches(success, error) {
+ Client.invalidateAllCaches(
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function recycleDatabaseConnection(success, error) {
+ Client.recycleDatabaseConnection(
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function adminResetPassword(userId, password, success, error) {
+ Client.adminResetPassword(
+ userId,
+ password,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function samlCertificateStatus(success, error) {
+ Client.samlCertificateStatus(
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function ldapSyncNow(success, error) {
+ Client.ldapSyncNow(
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function getOAuthAppInfo(clientId, success, error) {
+ Client.getOAuthAppInfo(
+ clientId,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function allowOAuth2(params, success, error) {
+ const responseType = params.response_type;
+ const clientId = params.client_id;
+ const redirectUri = params.redirect_uri;
+ const state = params.state;
+ const scope = params.scope;
+
+ Client.allowOAuth2(responseType, clientId, redirectUri, state, scope,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function emailToLdap(loginId, password, token, ldapId, ldapPassword, success, error) {
+ Client.emailToLdap(
+ loginId,
+ password,
+ token,
+ ldapId,
+ ldapPassword,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function emailToOAuth(loginId, password, token, newType, success, error) {
+ Client.emailToOAuth(
+ loginId,
+ password,
+ token,
+ newType,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function oauthToEmail(email, password, success, error) {
+ Client.oauthToEmail(
+ email,
+ password,
+ (data) => {
+ if (data.follow_link) {
+ browserHistory.push(data.follow_link);
+ }
+
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function regenerateOAuthAppSecret(oauthAppId, success, error) {
+ Client.regenerateOAuthAppSecret(
+ oauthAppId,
+ (data) => {
+ if (success) {
+ success(data);
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function uploadBrandImage(brandImage, success, error) {
+ Client.uploadBrandImage(
+ brandImage,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function uploadLicenseFile(file, success, error) {
+ Client.uploadLicenseFile(
+ file,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function removeLicenseFile(success, error) {
+ Client.removeLicenseFile(
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function uploadCertificateFile(certificateFile, success, error) {
+ Client.uploadCertificateFile(
+ certificateFile,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
+export function removeCertificateFile(certificateId, success, error) {
+ Client.removeCertificateFile(
+ certificateId,
+ () => {
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}