|
|
@@ -37,6 +37,47 @@ module.exports = (crowi) => {
|
|
|
}),
|
|
|
];
|
|
|
|
|
|
+ /**
|
|
|
+ * @swagger
|
|
|
+ *
|
|
|
+ * paths:
|
|
|
+ * /_api/v3/users/invite:
|
|
|
+ * post:
|
|
|
+ * tags: [Users]
|
|
|
+ * description: Create new users and send Emails
|
|
|
+ * produces:
|
|
|
+ * - application/json
|
|
|
+ * parameters:
|
|
|
+ * - name: shapedEmailList
|
|
|
+ * in: query
|
|
|
+ * description: Invitation emailList
|
|
|
+ * schema:
|
|
|
+ * type: array
|
|
|
+ * - name: sendEmail
|
|
|
+ * in: query
|
|
|
+ * description: Whether to send mail
|
|
|
+ * schema:
|
|
|
+ * type: boolean
|
|
|
+ * responses:
|
|
|
+ * 200:
|
|
|
+ * description: Inviting user success
|
|
|
+ * content:
|
|
|
+ * application/json:
|
|
|
+ * schema:
|
|
|
+ * properties:
|
|
|
+ * createdUserList:
|
|
|
+ * type: array
|
|
|
+ * email:
|
|
|
+ * type: string
|
|
|
+ * password:
|
|
|
+ * type: string
|
|
|
+ * description: Users successfully created
|
|
|
+ * existingEmailList:
|
|
|
+ * type: array
|
|
|
+ * email:
|
|
|
+ * type: string
|
|
|
+ * description: Users email that already exists
|
|
|
+ */
|
|
|
router.post('/invite', loginRequired(), adminRequired, csrf, validator.inviteEmail, ApiV3FormValidator, async(req, res) => {
|
|
|
try {
|
|
|
const emailList = await User.createUsersByInvitation(req.body.shapedEmailList, req.body.sendEmail);
|