mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-25 11:50:23 +08:00
delete account
This commit is contained in:
parent
90f326b4f4
commit
21088f2176
@ -46,14 +46,15 @@ type deleteUserReq struct {
|
||||
|
||||
// DeleteUser permanently deletes a user account and cleans up associated data.
|
||||
// Steps: force-logout → delete friends → quit/kick groups → hard-delete user doc.
|
||||
// Only IM admins may call this endpoint.
|
||||
// Caller must be the same user as userID, or an IM admin (see CheckAccessV3).
|
||||
func (d *DeleteUserApi) DeleteUser(c *gin.Context) {
|
||||
var req deleteUserReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
apiresp.GinError(c, errs.ErrArgs.WrapMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
if err := authverify.CheckAdmin(c, d.imAdminUserIDs); err != nil {
|
||||
// Only the user themselves (or an IM admin) may delete the account.
|
||||
if err := authverify.CheckAccessV3(c, req.UserID, d.imAdminUserIDs); err != nil {
|
||||
apiresp.GinError(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -180,7 +180,6 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, co
|
||||
userRouterGroup.POST("/remove_global_blacklist", bl.RemoveGlobalBlacklist)
|
||||
userRouterGroup.POST("/get_global_blacklist", bl.GetGlobalBlacklist)
|
||||
|
||||
// 真实删除账号(仅管理员)
|
||||
userRouterGroup.POST("/delete_user", du.DeleteUser)
|
||||
}
|
||||
// friend routing group
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user