当前位置: 首页>>代码示例>>C#>>正文


C# acUI.acUI.UserIsInRole方法代码示例

本文整理汇总了C#中acUI.acUI.UserIsInRole方法的典型用法代码示例。如果您正苦于以下问题:C# acUI.acUI.UserIsInRole方法的具体用法?C# acUI.acUI.UserIsInRole怎么用?C# acUI.acUI.UserIsInRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在acUI.acUI的用法示例。


在下文中一共展示了acUI.acUI.UserIsInRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: wmSetSystemCondition

        public string wmSetSystemCondition(string sSetToStatus)
        {
            acUI.acUI ui = new acUI.acUI();
            if (!ui.UserIsInRole("Administrator"))
            {
                return "Only an Administrator can perform this action.";
            }
            else
            {
                if (sSetToStatus == "")
                {
                    return "Unable to set System condition - 'up' or 'down' status argument is required.";
                }

                dataAccess dc = new dataAccess();
                string sErr = null;

                if (sSetToStatus == "down")
                {
                    wmKickAllUsers();
                    wmSetAllPollers("off");
                    wmSetScheduler("off");

                    //kill all running tasks
                    if (!dc.sqlExecuteUpdate("update task_instance set task_status = 'Aborting' where task_status = 'Processing'", ref sErr))
                    { throw new Exception(sErr); }

                    //lock out users
                    if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 0", ref sErr))
                    { throw new Exception(sErr); }

                }
                else
                {
                    wmSetAllPollers("on");
                    wmSetScheduler("on");

                    //allow login
                    if (!dc.sqlExecuteUpdate("update login_security_settings set allow_login = 1", ref sErr))
                    { throw new Exception(sErr); }
                }

                // add security log
                dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "System Condition set to [" + sSetToStatus + "]", ref sErr);

                // no errors to here, so return an empty string
                return "";
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:49,代码来源:uiMethods.asmx.cs

示例2: wmKickAllUsers

        public string wmKickAllUsers()
        {
            acUI.acUI ui = new acUI.acUI();
            if (!ui.UserIsInRole("Administrator"))
            {
                return "Only an Administrator can perform this action.";
            }
            else
            {
                dataAccess dc = new dataAccess();
                string sErr = null;

                /*
                 Gives all users a one minute warning, then kicks them.
                 */

                try
                {
                    if (!dc.sqlExecuteUpdate("update user_session set kick=1 where user_id in " +
                        " (select user_id from users where user_role <> 'Administrator')"
                        , ref sErr)) { throw new Exception(sErr); }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }

                // add security log
                dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "All Users were just kicked by [" + ui.GetSessionUsername() + "]", ref sErr);

                // no errors to here, so return an empty string
                return "";
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:34,代码来源:uiMethods.asmx.cs

示例3: wmSetScheduler

        public string wmSetScheduler(string sSetToStatus)
        {
            acUI.acUI ui = new acUI.acUI();
            if (!ui.UserIsInRole("Administrator"))
            {
                return "Only an Administrator can perform this action.";
            }
            else
            {
                if (sSetToStatus == "")
                {
                    return "Unable to set Scheduler - 'on' or 'off' status argument is required.";
                }

                dataAccess dc = new dataAccess();
                string sErr = null;

                /*
                 Simply flips the switch on all pollers and logservers to either on or off based on the argument.
                 */
                string sStatus = (dc.IsTrue(sSetToStatus) ? "on" : "off");

                try
                {
                    if (!dc.sqlExecuteUpdate("update scheduler_settings set mode_off_on = '" + sStatus + "'", ref sErr)) { throw new Exception(sErr); }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }

                // add security log
                dc.addSecurityLog(ui.GetSessionUserID(), SecurityLogTypes.Security, SecurityLogActions.ConfigChange, acObjectTypes.None, "", "Scheduler set to [" + sStatus + "]", ref sErr);

                // no errors to here, so return an empty string
                return "";
            }
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:38,代码来源:uiMethods.asmx.cs

示例4: wmAssetSearch

        public string wmAssetSearch(string sSearchText, bool bAllowMultiSelect)
        {
            try
            {
                dataAccess dc = new dataAccess();
                acUI.acUI ui = new acUI.acUI();
                string sErr = "";
                string sWhereString = " where 1=1 and a.asset_status ='Active'";

                if (sSearchText.Length > 0)
                {
                    sSearchText = sSearchText.Replace("'", "''").Trim();

                    //split on spaces
                    int i = 0;
                    string[] aSearchTerms = sSearchText.Split(' ');
                    for (i = 0; i <= aSearchTerms.Length - 1; i++)
                    {

                        //if the value is a guid, it's an existing task.
                        //otherwise it's a new task.
                        if (aSearchTerms[i].Length > 0)
                        {
                            sWhereString += " and (a.asset_name like '%" + aSearchTerms[i] + "%' " +
                                "or a.port like '%" + aSearchTerms[i] + "%' " +
                                "or a.address like '%" + aSearchTerms[i] + "%' " +
                                "or a.connection_type like '%" + aSearchTerms[i] + "%' " +
                                "or a.db_name like '%" + aSearchTerms[i] + "%') ";
                        }
                    }
                }

                //limit the results to the users 'tags' unless they are a super user
                if (!ui.UserIsInRole("Developer") && !ui.UserIsInRole("Administrator"))
                {
                    sWhereString += " and a.asset_id in (" +
                        "select distinct at.object_id" +
                        " from object_tags ut" +
                        " join object_tags at on ut.tag_name = at.tag_name" +
                        " and ut.object_type = 1 and at.object_type = 2" +
                        " where ut.object_id = '" + ui.GetSessionUserID() + "'" +
                        ")";
                }

                string sSQL = "select a.asset_id, a.asset_name, a.port, a.address, a.db_name, a.connection_type, ac.username, " +
                        " case when a.is_connection_system = '1' then 'Yes' else 'No' end as is_connection_system " +
                        " from asset a " +
                        " left outer join asset_credential ac " +
                        " on ac.credential_id = a.credential_id " +
                        sWhereString +
                        " order by a.asset_name";

                DataTable dt = new DataTable();
                if (!dc.sqlGetDataTable(ref dt, sSQL, ref sErr))
                {
                    throw new Exception(sErr);
                }

                string sHTML = "";
                if (dt.Rows.Count == 0)
                {
                    sHTML += "No results found";
                }
                else
                {
                    int iRowsToGet = dt.Rows.Count;
                    if (iRowsToGet >= 100)
                    {
                        sHTML += "<div>Search found " + dt.Rows.Count + " results. Displaying the first 100.</div>";
                        iRowsToGet = 99;
                    }
                    sHTML += "<ul id=\"search_asset_ul\" class=\"search_dialog_ul\">";

                    for (int i = 0; i < iRowsToGet; i++)
                    {
                        sHTML += "<li class=\"search_dialog_value\" tag=\"asset_picker_row\" asset_id=\"" + dt.Rows[i]["asset_id"].ToString() + "\" asset_name=\"" + dt.Rows[i]["asset_name"].ToString() + "\">";

                        sHTML += "<div class=\"search_dialog_value_name\">";
                        if (bAllowMultiSelect)
                            sHTML += "<input type='checkbox' name='assetcheckboxes' id='assetchk_" + dt.Rows[i]["asset_id"].ToString() + "' value='assetchk_" + dt.Rows[i]["asset_id"].ToString() + "'>";
                        sHTML += "<span>" + dt.Rows[i]["asset_name"].ToString() + "</span>";
                        sHTML += "</div>";

                        sHTML += "<span class=\"search_dialog_value_inline_item\">Address: " + dt.Rows[i]["address"].ToString() + "</span>";
                        sHTML += "<span class=\"search_dialog_value_inline_item\"> Connection Type: " + dt.Rows[i]["connection_type"].ToString() + "</span>";
                        sHTML += "</li>";
                    }
                }
                sHTML += "</ul>";

                return sHTML;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
开发者ID:you8,项目名称:cato,代码行数:97,代码来源:uiMethods.asmx.cs


注:本文中的acUI.acUI.UserIsInRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。