Exemple #1
0
        /// <summary>
        /// 更新安全行为属性
        /// </summary>
        /// <param name="se"></param>
        public void UpdateSecurityActionProperties(string eventGuid, SecurityAction sa)
        {
            try
            {
                if (!m_rules.ContainsKey(eventGuid))
                {
                    throw new Exception(string.Format("安全事件的guid{0}不存在", eventGuid));
                }

                SecurityEvent se = m_rules[eventGuid];

                if (!se.ContainsAction(sa.ActionGuid))
                {
                    throw new Exception(string.Format("安全事件{0}中不存在安全行为{1}", eventGuid, sa.Name));
                }

                m_manager.UpdateSecurityActionProperties(eventGuid, sa);

                se.GetSecurityAction(sa.ActionGuid).CopyFrom(sa);
            }
            catch (Exception ex)
            {
                throw new Exception("更新安全行为属性失败,错误消息为:" + ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除指定的安全行为,包含条件
        /// </summary>
        /// <param name="eventGuid"></param>
        public void DeleteSecurityAction(string eventGuid, string actionGuid)
        {
            try
            {
                if (!m_rules.ContainsKey(eventGuid))
                {
                    throw new Exception(string.Format("安全事件的guid{0}不存在", eventGuid));
                }

                SecurityEvent se = m_rules[eventGuid];

                if (!se.ContainsAction(actionGuid))
                {
                    throw new Exception(string.Format("安全事件{0}中不存在安全行为{1}", eventGuid, actionGuid));
                }

                m_manager.DeleteSecurityAction(eventGuid, actionGuid);
                se.DeleteAction(actionGuid);
            }
            catch (Exception ex)
            {
                throw new Exception("删除指定的安全行为失败,错误消息为:" + ex.Message);
            }
        }
Exemple #3
0
        /// <summary>
        /// 新建安全行为
        /// </summary>
        /// <param name="se"></param>
        public void AddSecurityAction(string eventGuid, SecurityAction sa)
        {
            try
            {
                if (!m_rules.ContainsKey(eventGuid))
                {
                    throw new Exception(string.Format("安全事件的guid{0}不存在", eventGuid));
                }

                SecurityEvent se = m_rules[eventGuid];

                if (se.ContainsAction(sa.ActionGuid))
                {
                    throw new Exception(string.Format("安全事件{0}中已经存在安全行为{1}", eventGuid, sa.Name));
                }

                m_manager.CreateNewSecurityAction(eventGuid, sa);
                se.AddSecurityAction(sa);
            }
            catch (Exception ex)
            {
                throw new Exception("新建安全行为失败,错误消息为:" + ex.Message);
            }
        }