1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-24 10:23:28 +00:00

Can delete all user groups

This commit is contained in:
2020-03-26 17:08:56 +01:00
parent 9cc205f59a
commit c222c8b054
4 changed files with 47 additions and 2 deletions

View File

@ -298,8 +298,9 @@ export class AccountController {
public static async DeleteAccount(h: RequestHandler) {
await h.needUserPostPassword("password");
// TODO : implement
h.error(500, "Method not implemented yet.");
await AccountHelper.Delete(h.getUserId());
h.error(500, "Method not completely implemented yet.");
}
/**

View File

@ -414,6 +414,7 @@ export class GroupsController {
h.error(404, "Membership not found!");
// If the user is an admin, he must not be the last admin of the group
// TODO : use new method
if(userID == h.getUserId() && currUserMembership.level == GroupMembershipLevels.ADMINISTRATOR
&& await GroupsHelper.CountMembersAtLevel(groupID, GroupMembershipLevels.ADMINISTRATOR) == 1)
h.error(401, "You are the last administrator of this group!");
@ -533,6 +534,7 @@ export class GroupsController {
const groupID = await h.postGroupIDWithAccess("id", GroupsAccessLevel.LIMITED_ACCESS);
const level = await GroupsHelper.GetMembershipLevel(groupID, h.getUserId());
// TODO : use new method
if(level == GroupMembershipLevels.ADMINISTRATOR
&& await GroupsHelper.CountMembersAtLevel(groupID, GroupMembershipLevels.ADMINISTRATOR) == 1)
h.error(401, "You are the last administrator of the group!");