|
@@ -429,13 +429,16 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: A result of `UserGroup.removeCompletelyById`
|
|
* description: A result of `UserGroup.removeCompletelyById`
|
|
|
*/
|
|
*/
|
|
|
- router.delete('/:id', loginRequiredStrictly, adminRequired, csrf, validator.delete, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
+ router.delete('/:id', loginRequiredStrictly, adminRequired, csrf, validator.delete, apiV3FormValidator, addActivity, async(req, res) => {
|
|
|
const { id: deleteGroupId } = req.params;
|
|
const { id: deleteGroupId } = req.params;
|
|
|
const { actionName, transferToUserGroupId } = req.query;
|
|
const { actionName, transferToUserGroupId } = req.query;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const userGroups = await crowi.userGroupService.removeCompletelyByRootGroupId(deleteGroupId, actionName, transferToUserGroupId, req.user);
|
|
const userGroups = await crowi.userGroupService.removeCompletelyByRootGroupId(deleteGroupId, actionName, transferToUserGroupId, req.user);
|
|
|
|
|
|
|
|
|
|
+ const parameters = { action: SupportedAction.ACTION_ADMIN_USER_GROUP_DELETE };
|
|
|
|
|
+ activityEvent.emit('update', res.locals.activity._id, parameters);
|
|
|
|
|
+
|
|
|
return res.apiv3({ userGroups });
|
|
return res.apiv3({ userGroups });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
@@ -473,7 +476,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: A result of `UserGroup.updateName`
|
|
* 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 { id } = req.params;
|
|
|
const {
|
|
const {
|
|
|
name, description, parentId, forceUpdateParents = false,
|
|
name, description, parentId, forceUpdateParents = false,
|
|
@@ -482,6 +485,9 @@ module.exports = (crowi) => {
|
|
|
try {
|
|
try {
|
|
|
const userGroup = await crowi.userGroupService.updateGroup(id, name, description, parentId, forceUpdateParents);
|
|
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 });
|
|
return res.apiv3({ userGroup });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
@@ -639,7 +645,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: the associative entity between user and userGroup
|
|
* 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;
|
|
const { id, username } = req.params;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -660,6 +666,8 @@ module.exports = (crowi) => {
|
|
|
const insertedRelations = await UserGroupRelation.createRelations(groupIdsOfRelationToCreate, user);
|
|
const insertedRelations = await UserGroupRelation.createRelations(groupIdsOfRelationToCreate, user);
|
|
|
const serializedUser = serializeUserSecurely(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 });
|
|
return res.apiv3({ user: serializedUser, createdRelationCount: insertedRelations.length });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|