private void RenderCompliance(TextWriter output, object compliance)
        {
            string                text                  = string.Empty;
            string                text2                 = string.Empty;
            ComplianceType        complianceType        = ComplianceType.Unknown;
            ClassificationSummary classificationSummary = compliance as ClassificationSummary;

            if (classificationSummary != null)
            {
                text           = classificationSummary.ClassificationID.ToString();
                text2          = classificationSummary.DisplayName;
                complianceType = ComplianceType.MessageClassification;
            }
            RmsTemplate rmsTemplate = compliance as RmsTemplate;

            if (rmsTemplate != null)
            {
                text           = rmsTemplate.Id.ToString();
                text2          = rmsTemplate.GetName(base.UserContext.UserCulture);
                complianceType = ComplianceType.RmsTemplate;
            }
            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
            {
                string additionalAttributes = " iCType=\"" + (uint)complianceType + "\"";
                base.RenderMenuItem(output, text2, ThemeFileId.Clear, "divCPLA" + text, text, false, additionalAttributes, null, null, null, null, false);
            }
        }
Exemplo n.º 2
0
        private async Task DoHandle(ConfigEvent configEvent, ILambdaContext context, AmazonConfigServiceClient configServiceClient)
        {
            JObject ruleParamsObj;
            JObject configItem;

            if (configEvent.RuleParameters != null)
            {
                ruleParamsObj = JObject.Parse(configEvent.RuleParameters.ToString());
            }
            else
            {
                ruleParamsObj = new JObject();
            }

            JObject invokingEventObj = JObject.Parse(configEvent.InvokingEvent.ToString());

            if (invokingEventObj["configurationItem"] != null)
            {
                configItem = JObject.Parse(invokingEventObj[CONFIGURATION_ITEM].ToString());
            }
            else
            {
                configItem = new JObject();
            }

            FailForIncompatibleEventTypes(invokingEventObj);
            ComplianceType myCompliance = ComplianceType.NOT_APPLICABLE;

            if (!IsEventNotApplicable(configItem, configEvent.EventLeftScope))
            {
                myCompliance = RuleCode.EvaluateCompliance(invokingEventObj, ruleParamsObj, context);
            }

            // Associates the evaluation result with the AWS account published in the event.
            Evaluation evaluation = new Evaluation {
                ComplianceResourceId   = GetResourceId(configItem),
                ComplianceResourceType = GetResourceType(configItem),
                OrderingTimestamp      = GetCiCapturedTime(configItem),
                ComplianceType         = myCompliance
            };

            await DoPutEvaluations(configServiceClient, configEvent, evaluation);
        }
Exemplo n.º 3
0
        public int updateComplianceTypesMappedWithIndustryType(ComplianceType CompType)
        {
            int complianceID = 0;

            bool updateResult = false;

            try
            {
                OrganizationHelper organizationhelper = new OrganizationHelper();
                complianceID = organizationhelper.insertupdateComplianceTypesMappedWithIndustryType(CompType, 'U');

                {
                    updateResult = true;
                }
            }
            catch
            {
                throw;
            }
            return(complianceID);
        }
        public int insertupdateComplianceTypesMappedWithIndustryType(ComplianceType type, char Flag)
        {
            int ComplianceID = 0;

            try
            {
                if (type != null)
                {
                    conn.Open();
                    MySqlCommand cmd = new MySqlCommand("sp_insertupdateComplianceTypeWithIndustry", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("p_Flag", Flag);
                    cmd.Parameters.AddWithValue("p_Compliance_Type_ID", type.ComplianceTypeID);
                    cmd.Parameters.AddWithValue("p_Industry_Type_ID", type.IndustryTypeID);
                    cmd.Parameters.AddWithValue("p_Country_ID", type.CountryID);
                    cmd.Parameters.AddWithValue("p_Compliance_Type_Name", type.ComplianceTypeName);
                    cmd.Parameters.AddWithValue("p_Audit_Frequency", type.AuditingFrequency);
                    cmd.Parameters.AddWithValue("p_Start_Date", Convert.ToDateTime(type.StartDate));
                    cmd.Parameters.AddWithValue("p_End_Date", type.EndDate);


                    object objbranchlocationid = cmd.ExecuteScalar();
                    if (Convert.ToInt32(objbranchlocationid) > 0)
                    {
                        ComplianceID = Convert.ToInt32(objbranchlocationid);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return(ComplianceID);
        }
Exemplo n.º 5
0
        protected void UpdateComplianceAction(MessageItem message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            object parameter = base.GetParameter("CmpAc");

            if (parameter == null)
            {
                return;
            }
            string text = (string)parameter;

            if (text == "0")
            {
                message[ItemSchema.IsClassified]              = false;
                message[ItemSchema.ClassificationGuid]        = string.Empty;
                message[ItemSchema.ClassificationDescription] = string.Empty;
                message[ItemSchema.Classification]            = string.Empty;
                if (Utilities.IsIrmDecrypted(message))
                {
                    ((RightsManagedMessageItem)message).SetRestriction(null);
                }
                return;
            }
            Guid           empty          = Guid.Empty;
            ComplianceType complianceType = ComplianceType.Unknown;

            if (GuidHelper.TryParseGuid(text, out empty))
            {
                complianceType = OwaContext.Current.UserContext.ComplianceReader.GetComplianceType(empty, base.UserContext.UserCulture);
            }
            switch (complianceType)
            {
            case ComplianceType.MessageClassification:
            {
                ClassificationSummary classificationSummary = base.UserContext.ComplianceReader.MessageClassificationReader.LookupMessageClassification(empty, base.UserContext.UserCulture);
                if (classificationSummary == null)
                {
                    throw new OwaEventHandlerException("Invalid classification being set from client", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
                }
                message[ItemSchema.IsClassified]              = true;
                message[ItemSchema.ClassificationGuid]        = classificationSummary.ClassificationID.ToString();
                message[ItemSchema.ClassificationDescription] = classificationSummary.SenderDescription;
                message[ItemSchema.Classification]            = classificationSummary.DisplayName;
                message[ItemSchema.ClassificationKeep]        = classificationSummary.RetainClassificationEnabled;
                if (Utilities.IsIrmDecrypted(message))
                {
                    ((RightsManagedMessageItem)message).SetRestriction(null);
                    return;
                }
                return;
            }

            case ComplianceType.RmsTemplate:
                if (Utilities.IsIrmDecrypted(message))
                {
                    RmsTemplate rmsTemplate = base.UserContext.ComplianceReader.RmsTemplateReader.LookupRmsTemplate(empty);
                    if (rmsTemplate == null)
                    {
                        throw new OwaEventHandlerException("Invalid RMS template was sent from client.", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
                    }
                    ((RightsManagedMessageItem)message).SetRestriction(rmsTemplate);
                    if (message.Sender == null)
                    {
                        message.Sender = new Participant(base.UserContext.MailboxSession.MailboxOwner);
                    }
                }
                message[ItemSchema.IsClassified]              = false;
                message[ItemSchema.ClassificationGuid]        = string.Empty;
                message[ItemSchema.ClassificationDescription] = string.Empty;
                message[ItemSchema.Classification]            = string.Empty;
                return;
            }
            if (!OwaContext.Current.UserContext.ComplianceReader.RmsTemplateReader.IsInternalLicensingEnabled)
            {
                throw new OwaEventHandlerException("Unable to determine compliance type because licensing against internal RMS server has been disabled.", LocalizedStrings.GetNonEncoded(-27910813), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError, true);
            }
            if (OwaContext.Current.UserContext.ComplianceReader.RmsTemplateReader.TemplateAcquisitionFailed)
            {
                throw new OwaEventHandlerException("Unable to determine compliance type because there was an error loading templates from the RMS server.", LocalizedStrings.GetNonEncoded(1084956906), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError, true);
            }
            throw new OwaEventHandlerException("Invalid compliance label was sent from client.", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
        }