社区服务器库 - 删除用户的问题

时间:2009-10-09 18:28:47

标签: vb.net community-server

我被要求修复一个社区服务器论坛,通过脚本创建了数千个用户。他们所有的个人资料页面都是针对处方药等的SEOspam。该论坛未对新注册的用户使用电子邮件验证或管理员批准。我现在打开后者,但验证码会很好。

我的问题是批量删除这些帐户非常麻烦。我设置了一个.net网格(实际上是Telerik Radgrid),以便我可以批量选择用户并单击删除。但是,以下代码似乎不起作用(介意VB nubbery):

Protected Sub rgUsers_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgUsers.NeedDataSource
    rgUsers.DataSource = Users.GetUsers().Users()
End Sub

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
    For Each item As GridDataItem In rgUsers.SelectedItems
        Dim selectedUserID As Integer = item.OwnerTableView.DataKeyValues(item.ItemIndex)("UserID")
        Dim userToDelete As CommunityServer.Components.User = Users.GetUser(selectedUserID, False) ' User is definitely populated. '
        Dim username As String = userToDelete.Username
        Dim deleteStatus As DeleteUserStatus = Users.DeleteUser(User)
        Trace.Write(String.Format("Delete result for user {0}: {1}", username, deleteStatus.ToString)) ' Returns enum value 3 (Success.) '
    Next
    rgUsers.Rebind()
End Sub

UserDeleteStatus结果返回'Success',但实际上并未删除用户。我使用正确的删除功能吗?非常感谢任何帮助,因为这有点时间敏感(客户不在阴茎扩大丸市场。)

1 个答案:

答案 0 :(得分:0)

问题是UserDeleteStatus实际上正在返回'AuthenticationRequired'