|
|
@@ -473,7 +473,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
|
* description: A result of `UserGroup.updateName`
|
|
|
*/
|
|
|
- router.put('/:id', loginRequiredStrictly, adminRequired, csrf, validator.update, apiV3FormValidator, async(req, res) => {
|
|
|
+ router.put('/:id', loginRequiredStrictly, adminRequired, csrf, validator.update, apiV3FormValidator, addActivity, async(req, res) => {
|
|
|
const { id } = req.params;
|
|
|
const {
|
|
|
name, description, parentId, forceUpdateParents = false,
|
|
|
@@ -482,6 +482,9 @@ module.exports = (crowi) => {
|
|
|
try {
|
|
|
const userGroup = await crowi.userGroupService.updateGroup(id, name, description, parentId, forceUpdateParents);
|
|
|
|
|
|
+ const parameters = { action: SupportedAction.ACTION_ADMIN_USER_GROUP_UPDATE };
|
|
|
+ activityEvent.emit('update', res.locals.activity._id, parameters);
|
|
|
+
|
|
|
return res.apiv3({ userGroup });
|
|
|
}
|
|
|
catch (err) {
|
|
|
@@ -639,7 +642,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
|
* description: the associative entity between user and userGroup
|
|
|
*/
|
|
|
- router.post('/:id/users/:username', loginRequiredStrictly, adminRequired, validator.users.post, apiV3FormValidator, async(req, res) => {
|
|
|
+ router.post('/:id/users/:username', loginRequiredStrictly, adminRequired, validator.users.post, apiV3FormValidator, addActivity, async(req, res) => {
|
|
|
const { id, username } = req.params;
|
|
|
|
|
|
try {
|
|
|
@@ -660,6 +663,8 @@ module.exports = (crowi) => {
|
|
|
const insertedRelations = await UserGroupRelation.createRelations(groupIdsOfRelationToCreate, user);
|
|
|
const serializedUser = serializeUserSecurely(user);
|
|
|
|
|
|
+ const parameters = { action: SupportedAction.ACTION_ADMIN_USER_GROUP_ADD_USER };
|
|
|
+ activityEvent.emit('update', res.locals.activity._id, parameters);
|
|
|
return res.apiv3({ user: serializedUser, createdRelationCount: insertedRelations.length });
|
|
|
}
|
|
|
catch (err) {
|