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:
@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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!");
|
||||
|
Reference in New Issue
Block a user