admin.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. module.exports = function(crowi, app) {
  2. 'use strict';
  3. var debug = require('debug')('crowi:routes:admin')
  4. , models = crowi.models
  5. , Page = models.Page
  6. , User = models.User
  7. , ExternalAccount = models.ExternalAccount
  8. , Config = models.Config
  9. , PluginUtils = require('../plugins/plugin-utils')
  10. , pluginUtils = new PluginUtils()
  11. , ApiResponse = require('../util/apiResponse')
  12. , MAX_PAGE_LIST = 5
  13. , actions = {};
  14. function createPager(total, limit, page, pagesCount, maxPageList) {
  15. const pager = {
  16. page: page,
  17. pagesCount: pagesCount,
  18. pages: [],
  19. total: total,
  20. previous: null,
  21. previousDots: false,
  22. next: null,
  23. nextDots: false,
  24. };
  25. if (page > 1) {
  26. pager.previous = page - 1;
  27. }
  28. if (page < pagesCount) {
  29. pager.next = page + 1;
  30. }
  31. let pagerMin = Math.max(1, Math.ceil(page - maxPageList/2));
  32. let pagerMax = Math.min(pagesCount, Math.floor(page + maxPageList/2));
  33. if (pagerMin === 1) {
  34. if (MAX_PAGE_LIST < pagesCount) {
  35. pagerMax = MAX_PAGE_LIST;
  36. } else {
  37. pagerMax = pagesCount;
  38. }
  39. }
  40. if (pagerMax === pagesCount) {
  41. if ((pagerMax - MAX_PAGE_LIST) < 1) {
  42. pagerMin = 1;
  43. } else {
  44. pagerMin = pagerMax - MAX_PAGE_LIST;
  45. }
  46. }
  47. pager.previousDots = null;
  48. if (pagerMin > 1) {
  49. pager.previousDots = true;
  50. }
  51. pager.nextDots = null;
  52. if (pagerMax < pagesCount) {
  53. pager.nextDots = true;
  54. }
  55. for (let i = pagerMin; i <= pagerMax; i++) {
  56. pager.pages.push(i);
  57. }
  58. return pager;
  59. }
  60. actions.index = function(req, res) {
  61. return res.render('admin/index', {
  62. plugins: pluginUtils.listPlugins(crowi.rootDir),
  63. });
  64. };
  65. // app.get('/admin/app' , admin.app.index);
  66. actions.app = {};
  67. actions.app.index = function(req, res) {
  68. var settingForm;
  69. settingForm = Config.setupCofigFormData('crowi', req.config);
  70. return res.render('admin/app', {
  71. settingForm: settingForm,
  72. });
  73. };
  74. actions.app.settingUpdate = function(req, res) {
  75. };
  76. // app.get('/admin/security' , admin.security.index);
  77. actions.security = {};
  78. actions.security.index = function(req, res) {
  79. var settingForm;
  80. settingForm = Config.setupCofigFormData('crowi', req.config);
  81. return res.render('admin/security', { settingForm });
  82. };
  83. // app.get('/admin/markdown' , admin.markdown.index);
  84. actions.markdown = {};
  85. actions.markdown.index = function(req, res) {
  86. var config = crowi.getConfig();
  87. var markdownSetting = Config.setupCofigFormData('markdown', config);
  88. return res.render('admin/markdown', {
  89. markdownSetting: markdownSetting,
  90. });
  91. };
  92. // app.post('/admin/markdown/lineBreaksSetting' , admin.markdown.lineBreaksSetting);
  93. actions.markdown.lineBreaksSetting = function(req, res) {
  94. var markdownSetting = req.form.markdownSetting;
  95. req.session.markdownSetting = markdownSetting;
  96. if (req.form.isValid) {
  97. Config.updateNamespaceByArray('markdown', markdownSetting, function(err, config) {
  98. Config.updateConfigCache('markdown', config);
  99. req.session.markdownSetting = null;
  100. req.flash('successMessage', ['Successfully updated!']);
  101. return res.redirect('/admin/markdown');
  102. });
  103. } else {
  104. req.flash('errorMessage', req.form.errors);
  105. return res.redirect('/admin/markdown');
  106. }
  107. };
  108. // app.get('/admin/customize' , admin.customize.index);
  109. actions.customize = {};
  110. actions.customize.index = function(req, res) {
  111. var settingForm;
  112. settingForm = Config.setupCofigFormData('crowi', req.config);
  113. const highlightJsCssSelectorOptions = {
  114. "github": { name: '[Light] Github', border: false },
  115. "github-gist": { name: '[Light] Github Gist', border: true },
  116. "atom-one-light": { name: '[Light] Atom One Light', border: true },
  117. "xcode": { name: '[Light] Xcode', border: true },
  118. "vs": { name: '[Light] Vs', border: true },
  119. "atom-one-dark": { name: '[Dark] Atom One Dark', border: false },
  120. "hybrid": { name: '[Dark] Hybrid', border: false },
  121. "monokai": { name: '[Dark] Monokai', border: false },
  122. "tomorrow-night": { name: '[Dark] Tomorrow Night', border: false },
  123. "vs2015": { name: '[Dark] Vs 2015', border: false },
  124. }
  125. return res.render('admin/customize', {
  126. settingForm: settingForm,
  127. highlightJsCssSelectorOptions: highlightJsCssSelectorOptions
  128. });
  129. };
  130. // app.get('/admin/notification' , admin.notification.index);
  131. actions.notification = {};
  132. actions.notification.index = function(req, res) {
  133. var config = crowi.getConfig();
  134. var UpdatePost = crowi.model('UpdatePost');
  135. var slackSetting = Config.setupCofigFormData('notification', config);
  136. var hasSlackWebClientConfig = Config.hasSlackWebClientConfig(config);
  137. var hasSlackIwhUrl = Config.hasSlackIwhUrl(config);
  138. var hasSlackToken = Config.hasSlackToken(config);
  139. var slack = crowi.slack;
  140. var slackAuthUrl = '';
  141. if (!Config.hasSlackWebClientConfig(req.config)) {
  142. slackSetting['slack:clientId'] = '';
  143. slackSetting['slack:clientSecret'] = '';
  144. }
  145. else {
  146. slackAuthUrl = slack.getAuthorizeURL();
  147. }
  148. if (!Config.hasSlackIwhUrl(req.config)) {
  149. slackSetting['slack:incomingWebhookUrl'] = '';
  150. }
  151. if (req.session.slackSetting) {
  152. slackSetting = req.session.slackSetting;
  153. req.session.slackSetting = null;
  154. }
  155. UpdatePost.findAll()
  156. .then(function(settings) {
  157. return res.render('admin/notification', {
  158. settings,
  159. slackSetting,
  160. hasSlackWebClientConfig,
  161. hasSlackIwhUrl,
  162. hasSlackToken,
  163. slackAuthUrl
  164. });
  165. });
  166. };
  167. // app.post('/admin/notification/slackSetting' , admin.notification.slackauth);
  168. actions.notification.slackSetting = function(req, res) {
  169. var slackSetting = req.form.slackSetting;
  170. req.session.slackSetting = slackSetting;
  171. if (req.form.isValid) {
  172. Config.updateNamespaceByArray('notification', slackSetting, function(err, config) {
  173. Config.updateConfigCache('notification', config);
  174. req.flash('successMessage', ['Successfully Updated!']);
  175. req.session.slackSetting = null;
  176. // Re-setup
  177. crowi.setupSlack().then(function() {
  178. return res.redirect('/admin/notification');
  179. });
  180. });
  181. } else {
  182. req.flash('errorMessage', req.form.errors);
  183. return res.redirect('/admin/notification');
  184. }
  185. };
  186. // app.get('/admin/notification/slackAuth' , admin.notification.slackauth);
  187. actions.notification.slackAuth = function(req, res) {
  188. const code = req.query.code;
  189. const config = crowi.getConfig();
  190. if (!code || !Config.hasSlackConfig(req.config)) {
  191. return res.redirect('/admin/notification');
  192. }
  193. const slack = crowi.slack;
  194. slack.getOauthAccessToken(code)
  195. .then(data => {
  196. debug('oauth response', data);
  197. Config.updateNamespaceByArray('notification', {'slack:token': data.access_token}, function(err, config) {
  198. if (err) {
  199. req.flash('errorMessage', ['Failed to save access_token. Please try again.']);
  200. } else {
  201. Config.updateConfigCache('notification', config);
  202. req.flash('successMessage', ['Successfully Connected!']);
  203. }
  204. return res.redirect('/admin/notification');
  205. });
  206. }).catch(err => {
  207. debug('oauth response ERROR', err);
  208. req.flash('errorMessage', ['Failed to fetch access_token. Please do connect again.']);
  209. return res.redirect('/admin/notification');
  210. });
  211. };
  212. actions.search = {};
  213. actions.search.index = function(req, res) {
  214. var search = crowi.getSearcher();
  215. if (!search) {
  216. return res.redirect('/admin');
  217. }
  218. return res.render('admin/search', {
  219. });
  220. };
  221. // app.post('/admin/notification/slackIwhSetting' , admin.notification.slackIwhSetting);
  222. actions.notification.slackIwhSetting = function(req, res) {
  223. var slackIwhSetting = req.form.slackIwhSetting;
  224. if (req.form.isValid) {
  225. Config.updateNamespaceByArray('notification', slackIwhSetting, function(err, config) {
  226. Config.updateConfigCache('notification', config);
  227. req.flash('successMessage', ['Successfully Updated!']);
  228. // Re-setup
  229. crowi.setupSlack().then(function() {
  230. return res.redirect('/admin/notification#slack-incoming-webhooks');
  231. });
  232. });
  233. } else {
  234. req.flash('errorMessage', req.form.errors);
  235. return res.redirect('/admin/notification#slack-incoming-webhooks');
  236. }
  237. };
  238. // app.post('/admin/notification/slackSetting/disconnect' , admin.notification.disconnectFromSlack);
  239. actions.notification.disconnectFromSlack = function(req, res) {
  240. const config = crowi.getConfig();
  241. const slack = crowi.slack;
  242. Config.updateNamespaceByArray('notification', {'slack:token': ''}, function(err, config) {
  243. Config.updateConfigCache('notification', config);
  244. req.flash('successMessage', ['Successfully Disconnected!']);
  245. return res.redirect('/admin/notification');
  246. });
  247. };
  248. actions.search.buildIndex = function(req, res) {
  249. var search = crowi.getSearcher();
  250. if (!search) {
  251. return res.redirect('/admin');
  252. }
  253. return new Promise(function(resolve, reject) {
  254. search.deleteIndex()
  255. .then(function(data) {
  256. debug('Index deleted.');
  257. resolve();
  258. }).catch(function(err) {
  259. debug('Delete index Error, but if it is initialize, its ok.', err);
  260. resolve();
  261. });
  262. })
  263. .then(function() {
  264. return search.buildIndex()
  265. })
  266. .then(function(data) {
  267. if (!data.errors) {
  268. debug('Index created.');
  269. }
  270. return search.addAllPages();
  271. })
  272. .then(function(data) {
  273. if (!data.errors) {
  274. debug('Data is successfully indexed.');
  275. req.flash('successMessage', 'Data is successfully indexed.');
  276. } else {
  277. debug('Data index error.', data.errors);
  278. req.flash('errorMessage', `Data index error: ${data.errors}`);
  279. }
  280. return res.redirect('/admin/search');
  281. })
  282. .catch(function(err) {
  283. debug('Error', err);
  284. req.flash('errorMessage', `Error: ${err}`);
  285. return res.redirect('/admin/search');
  286. });
  287. };
  288. actions.user = {};
  289. actions.user.index = function(req, res) {
  290. var page = parseInt(req.query.page) || 1;
  291. User.findUsersWithPagination({page: page}, function(err, result) {
  292. const pager = createPager(result.total, result.limit, result.page, result.pages, MAX_PAGE_LIST);
  293. return res.render('admin/users', {
  294. users: result.docs,
  295. pager: pager
  296. });
  297. });
  298. };
  299. actions.user.invite = function(req, res) {
  300. var form = req.form.inviteForm;
  301. var toSendEmail = form.sendEmail || false;
  302. if (req.form.isValid) {
  303. User.createUsersByInvitation(form.emailList.split('\n'), toSendEmail, function(err, userList) {
  304. if (err) {
  305. req.flash('errorMessage', req.form.errors.join('\n'));
  306. } else {
  307. req.flash('createdUser', userList);
  308. }
  309. return res.redirect('/admin/users');
  310. });
  311. } else {
  312. req.flash('errorMessage', req.form.errors.join('\n'));
  313. return res.redirect('/admin/users');
  314. }
  315. };
  316. actions.user.makeAdmin = function(req, res) {
  317. var id = req.params.id;
  318. User.findById(id, function(err, userData) {
  319. userData.makeAdmin(function(err, userData) {
  320. if (err === null) {
  321. req.flash('successMessage', userData.name + 'さんのアカウントを管理者に設定しました。');
  322. } else {
  323. req.flash('errorMessage', '更新に失敗しました。');
  324. debug(err, userData);
  325. }
  326. return res.redirect('/admin/users');
  327. });
  328. });
  329. };
  330. actions.user.removeFromAdmin = function(req, res) {
  331. var id = req.params.id;
  332. User.findById(id, function(err, userData) {
  333. userData.removeFromAdmin(function(err, userData) {
  334. if (err === null) {
  335. req.flash('successMessage', userData.name + 'さんのアカウントを管理者から外しました。');
  336. } else {
  337. req.flash('errorMessage', '更新に失敗しました。');
  338. debug(err, userData);
  339. }
  340. return res.redirect('/admin/users');
  341. });
  342. });
  343. };
  344. actions.user.activate = function(req, res) {
  345. var id = req.params.id;
  346. User.findById(id, function(err, userData) {
  347. userData.statusActivate(function(err, userData) {
  348. if (err === null) {
  349. req.flash('successMessage', userData.name + 'さんのアカウントを承認しました');
  350. } else {
  351. req.flash('errorMessage', '更新に失敗しました。');
  352. debug(err, userData);
  353. }
  354. return res.redirect('/admin/users');
  355. });
  356. });
  357. };
  358. actions.user.suspend = function(req, res) {
  359. var id = req.params.id;
  360. User.findById(id, function(err, userData) {
  361. userData.statusSuspend(function(err, userData) {
  362. if (err === null) {
  363. req.flash('successMessage', userData.name + 'さんのアカウントを利用停止にしました');
  364. } else {
  365. req.flash('errorMessage', '更新に失敗しました。');
  366. debug(err, userData);
  367. }
  368. return res.redirect('/admin/users');
  369. });
  370. });
  371. };
  372. actions.user.remove = function(req, res) {
  373. var id = req.params.id;
  374. let username = '';
  375. return new Promise((resolve, reject) => {
  376. User.findById(id, (err, userData) => {
  377. username = userData.username;
  378. return resolve(userData);
  379. });
  380. })
  381. .then((userData) => {
  382. return new Promise((resolve, reject) => {
  383. userData.statusDelete((err, userData) => {
  384. if (err) {
  385. reject(err);
  386. }
  387. resolve(userData);
  388. });
  389. });
  390. })
  391. .then((userData) => {
  392. // remove all External Accounts
  393. ExternalAccount.remove({user: userData})
  394. .then((err) => {
  395. if (err) {
  396. throw new Error(err.message);
  397. }
  398. return userData;
  399. })
  400. })
  401. .then((userData) => {
  402. return Page.removePageByPath(`/user/${username}`)
  403. .then(() => userData);
  404. })
  405. .then((userData) => {
  406. req.flash('successMessage', `${username} さんのアカウントを削除しました`);
  407. return res.redirect('/admin/users');
  408. })
  409. .catch((err) => {
  410. req.flash('errorMessage', '削除に失敗しました。');
  411. return res.redirect('/admin/users');
  412. });
  413. };
  414. // これやったときの relation の挙動未確認
  415. actions.user.removeCompletely = function(req, res) {
  416. // ユーザーの物理削除
  417. var id = req.params.id;
  418. User.removeCompletelyById(id, function(err, removed) {
  419. if (err) {
  420. debug('Error while removing user.', err, id);
  421. req.flash('errorMessage', '完全な削除に失敗しました。');
  422. } else {
  423. req.flash('successMessage', '削除しました');
  424. }
  425. return res.redirect('/admin/users');
  426. });
  427. };
  428. // app.post('/_api/admin/users.resetPassword' , admin.api.usersResetPassword);
  429. actions.user.resetPassword = function(req, res) {
  430. const id = req.body.user_id;
  431. const User = crowi.model('User');
  432. User.resetPasswordByRandomString(id)
  433. .then(function(data) {
  434. data.user = User.filterToPublicFields(data.user);
  435. return res.json(ApiResponse.success(data));
  436. }).catch(function(err) {
  437. debug('Error on reseting password', err);
  438. return res.json(ApiResponse.error('Error'));
  439. });
  440. }
  441. actions.externalAccount = {};
  442. actions.externalAccount.index = function(req, res) {
  443. const page = parseInt(req.query.page) || 1;
  444. ExternalAccount.findAllWithPagination({page})
  445. .then((result) => {
  446. const pager = createPager(result.total, result.limit, result.page, result.pages, MAX_PAGE_LIST);
  447. return res.render('admin/external-accounts', {
  448. accounts: result.docs,
  449. pager: pager
  450. })
  451. });
  452. };
  453. actions.externalAccount.remove = function(req, res) {
  454. const accountId = req.params.id;
  455. ExternalAccount.findOneAndRemove({accountId})
  456. .then((result) => {
  457. if (result == null) {
  458. req.flash('errorMessage', '削除に失敗しました。');
  459. return res.redirect('/admin/users/external-accounts');
  460. }
  461. else {
  462. req.flash('successMessage', `外部アカウント '${accountId}' を削除しました`);
  463. return res.redirect('/admin/users/external-accounts');
  464. }
  465. });
  466. };
  467. actions.api = {};
  468. actions.api.appSetting = function(req, res) {
  469. var form = req.form.settingForm;
  470. if (req.form.isValid) {
  471. debug('form content', form);
  472. // mail setting ならここで validation
  473. if (form['mail:from']) {
  474. validateMailSetting(req, form, function(err, data) {
  475. debug('Error validate mail setting: ', err, data);
  476. if (err) {
  477. req.form.errors.push('SMTPを利用したテストメール送信に失敗しました。設定をみなおしてください。');
  478. return res.json({status: false, message: req.form.errors.join('\n')});
  479. }
  480. return saveSetting(req, res, form);
  481. });
  482. } else {
  483. return saveSetting(req, res, form);
  484. }
  485. } else {
  486. return res.json({status: false, message: req.form.errors.join('\n')});
  487. }
  488. };
  489. actions.api.securitySetting = function(req, res) {
  490. var form = req.form.settingForm;
  491. if (req.form.isValid) {
  492. debug('form content', form);
  493. return saveSetting(req, res, form);
  494. } else {
  495. return res.json({status: false, message: req.form.errors.join('\n')});
  496. }
  497. };
  498. actions.api.securityPassportLdapSetting = function(req, res) {
  499. var form = req.form.settingForm;
  500. if (!req.form.isValid) {
  501. return res.json({status: false, message: req.form.errors.join('\n')});
  502. }
  503. debug('form content', form);
  504. return saveSettingAsync(form)
  505. .then(() => {
  506. const config = crowi.getConfig();
  507. // reset strategy
  508. crowi.passportService.resetLdapStrategy();
  509. // setup strategy
  510. if (Config.isEnabledPassportLdap(config)) {
  511. crowi.passportService.setupLdapStrategy(true);
  512. }
  513. return;
  514. })
  515. .then(() => {
  516. res.json({status: true});
  517. });
  518. };
  519. actions.api.customizeSetting = function(req, res) {
  520. var form = req.form.settingForm;
  521. if (req.form.isValid) {
  522. debug('form content', form);
  523. return saveSetting(req, res, form);
  524. } else {
  525. return res.json({status: false, message: req.form.errors.join('\n')});
  526. }
  527. }
  528. // app.post('/_api/admin/notifications.add' , admin.api.notificationAdd);
  529. actions.api.notificationAdd = function(req, res) {
  530. var UpdatePost = crowi.model('UpdatePost');
  531. var pathPattern = req.body.pathPattern;
  532. var channel = req.body.channel;
  533. debug('notification.add', pathPattern, channel);
  534. UpdatePost.create(pathPattern, channel, req.user)
  535. .then(function(doc) {
  536. debug('Successfully save updatePost', doc);
  537. // fixme: うーん
  538. doc.creator = doc.creator._id.toString();
  539. return res.json(ApiResponse.success({updatePost: doc}));
  540. }).catch(function(err) {
  541. debug('Failed to save updatePost', err);
  542. return res.json(ApiResponse.error());
  543. });
  544. };
  545. // app.post('/_api/admin/notifications.remove' , admin.api.notificationRemove);
  546. actions.api.notificationRemove = function(req, res) {
  547. var UpdatePost = crowi.model('UpdatePost');
  548. var id = req.body.id;
  549. UpdatePost.remove(id)
  550. .then(function() {
  551. debug('Successfully remove updatePost');
  552. return res.json(ApiResponse.success({}));
  553. }).catch(function(err) {
  554. debug('Failed to remove updatePost', err);
  555. return res.json(ApiResponse.error());
  556. });
  557. };
  558. // app.get('/_api/admin/users.search' , admin.api.userSearch);
  559. actions.api.usersSearch = function(req, res) {
  560. const User = crowi.model('User');
  561. const email =req.query.email;
  562. User.findUsersByPartOfEmail(email, {})
  563. .then(users => {
  564. const result = {
  565. data: users
  566. };
  567. return res.json(ApiResponse.success(result));
  568. }).catch(err => {
  569. return res.json(ApiResponse.error());
  570. });
  571. };
  572. /**
  573. * save settings, update config cache, and response json
  574. *
  575. * @param {any} req
  576. * @param {any} res
  577. * @param {any} form
  578. */
  579. function saveSetting(req, res, form)
  580. {
  581. Config.updateNamespaceByArray('crowi', form, function(err, config) {
  582. Config.updateConfigCache('crowi', config);
  583. return res.json({status: true});
  584. });
  585. }
  586. /**
  587. * save settings, update config cache ONLY. (this method don't response json)
  588. *
  589. * @param {any} form
  590. * @returns
  591. */
  592. function saveSettingAsync(form) {
  593. return new Promise((resolve, reject) => {
  594. Config.updateNamespaceByArray('crowi', form, (err, config) => {
  595. if (err) {
  596. return reject(err)
  597. };
  598. Config.updateConfigCache('crowi', config);
  599. return resolve();
  600. });
  601. });
  602. }
  603. function validateMailSetting(req, form, callback)
  604. {
  605. var mailer = crowi.mailer;
  606. var option = {
  607. host: form['mail:smtpHost'],
  608. port: form['mail:smtpPort'],
  609. };
  610. if (form['mail:smtpUser'] && form['mail:smtpPassword']) {
  611. option.auth = {
  612. user: form['mail:smtpUser'],
  613. pass: form['mail:smtpPassword'],
  614. };
  615. }
  616. if (option.port === 465) {
  617. option.secure = true;
  618. }
  619. var smtpClient = mailer.createSMTPClient(option);
  620. debug('mailer setup for validate SMTP setting', smtpClient);
  621. smtpClient.sendMail({
  622. to: req.user.email,
  623. subject: 'Wiki管理設定のアップデートによるメール通知',
  624. text: 'このメールは、WikiのSMTP設定のアップデートにより送信されています。'
  625. }, callback);
  626. }
  627. return actions;
  628. };