Beispiel #1
0
    // TODO: 要禁止删除一个操作信息事项
    // ajax请求删除一个条目
    // chat.aspx?action=delete&refid=xxx&date=xxx
    // 版主和managechatroom的帐户可以进行删除
    void DoDeleteItem(int nIsEditor,
                      bool bIsManager)
    {
        string strError = "";
        int    nRet     = 0;

        DeleteResultInfo result_info = new DeleteResultInfo();

        string strRoom = this.Request.Form["room"];

        if (nIsEditor == -1)
        {
            // -1 0 1
            nIsEditor = app.IsEditor(strRoom,
                                     sessioninfo.UserID,
                                     out strError);
        }

        if (bIsManager == false && nIsEditor != 1)
        {
            result_info.ErrorString = "当前帐户不具备 managechatroom 权限,也不是编辑身份,无法删除消息";
            result_info.ResultValue = -1;
            goto END_DELETE;
        }

        string strRefID = this.Request.Form["refid"];
        string strDate  = this.Request["date"];

        long lNewVersion = 0;

        nRet = app.DeleteChatItem(
            MergeRights(sessioninfo.RightsOrigin, sessioninfo.SsoRights),
            strRoom,
            strDate,
            strRefID,
            false,  // bChangeVersion
            true,   // bNotify
            sessioninfo.UserID,
            out lNewVersion,
            out strError);

        result_info.NewFileVersion = lNewVersion;
        result_info.ErrorString    = strError;
        result_info.ResultValue    = nRet;

END_DELETE:
        this.Response.Write(GetResultString(result_info));
        this.Response.End();
    }
Beispiel #2
0
    // TODO: 要禁止删除一个操作信息事项
    // ajax请求删除一个条目
    // chat.aspx?action=delete&refid=xxx&date=xxx
    // 版主和managechatroom的帐户可以进行删除
    void DoDeleteItem(int nIsEditor,
        bool bIsManager)
    {
        string strError = "";
        int nRet = 0;

        DeleteResultInfo result_info = new DeleteResultInfo();

        string strRoom = this.Request.Form["room"];

        if (nIsEditor == -1)
        {
            // -1 0 1
            nIsEditor = app.IsEditor(strRoom,
                 sessioninfo.UserID,
                 out strError);
        }

        if (bIsManager == false && nIsEditor != 1)
        {
            result_info.ErrorString = "当前帐户不具备 managechatroom 权限,也不是编辑身份,无法删除消息";
            result_info.ResultValue = -1;
            goto END_DELETE;
        }

        string strRefID = this.Request.Form["refid"];
        string strDate = this.Request["date"];

        long lNewVersion = 0;
        nRet = app.DeleteChatItem(
            MergeRights(sessioninfo.RightsOrigin, sessioninfo.SsoRights),
            strRoom,
            strDate,
            strRefID,
            false,  // bChangeVersion
            true,   // bNotify
            sessioninfo.UserID,
            out lNewVersion,
            out strError);

        result_info.NewFileVersion = lNewVersion;
        result_info.ErrorString = strError;
        result_info.ResultValue = nRet;

    END_DELETE:
        this.Response.Write(GetResultString(result_info));
        this.Response.End();
    }