mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-27 07:14:56 +00:00
24 lines
717 B
Lua
24 lines
717 B
Lua
-- Delete user moderation action
|
|
-- Single function module for admin moderation
|
|
|
|
local check = require("check")
|
|
local LEVELS = require("levels")
|
|
|
|
---@class DeleteUser
|
|
local M = {}
|
|
|
|
---Deletes a user account after permission verification
|
|
---@param ctx ModerationContext Context with user and targetId
|
|
---@return ActionResult Result of the delete operation
|
|
function M.deleteUser(ctx)
|
|
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
|
return { success = false, error = "Admin required" }
|
|
end
|
|
if ctx.targetId == ctx.user.id then
|
|
return { success = false, error = "Cannot delete yourself" }
|
|
end
|
|
return { success = true, action = "delete_user", id = ctx.targetId }
|
|
end
|
|
|
|
return M
|