コード例 #1
0
 /// <summary>
 ///     Called to write save audit log entries.
 /// </summary>
 /// <param name="success">if set to <c>true</c> [success].</param>
 /// <param name="accessRuleDetails">The report details.</param>
 protected override void OnWriteSaveAuditLogEntries(bool success, AuditLogReportDetails accessRuleDetails)
 {
     if (accessRuleDetails.IsAccessRuleReport)
     {
         AuditLog.OnChangeAccessRuleQuery(success, accessRuleDetails.SubjectName, accessRuleDetails.SecuredTypeName, accessRuleDetails.AccessRuleReportName);
     }
 }
コード例 #2
0
        /// <summary>
        ///     Called to gather audit log entity details for save.
        /// </summary>
        /// <param name="report">The report.</param>
        /// <returns></returns>
        protected override AuditLogReportDetails OnGatherAuditLogEntityDetailsForSave(Report report)
        {
            var reportInternal = report as IEntityInternal;
            IEntityFieldValues fields;
            IDictionary <long, IChangeTracker <IMutableIdKey> > forwardRelationships;
            IDictionary <long, IChangeTracker <IMutableIdKey> > reverseRelationships;

            report.GetChanges(out fields, out forwardRelationships, out reverseRelationships);

            var reportDetails = new AuditLogReportDetails();

            if (reportInternal.IsTemporaryId)
            {
                return(reportDetails);
            }

            if ((fields != null && fields.Any()) ||
                (reverseRelationships != null && reverseRelationships.Count > 0) ||
                (forwardRelationships != null && forwardRelationships.Count > 0))
            {
                AccessRule accessRule = report.ReportForAccessRule;
                if (accessRule != null)
                {
                    // gather info to notify that an access rule's query has changed
                    reportDetails.IsAccessRuleReport   = true;
                    reportDetails.AccessRuleReportName = report.Name;

                    SecurableEntity controlAccess = accessRule.ControlAccess;
                    if (controlAccess != null)
                    {
                        reportDetails.SecuredTypeName = controlAccess.Name;
                    }

                    Subject allowAccessBy = accessRule.AllowAccessBy;
                    if (allowAccessBy != null)
                    {
                        reportDetails.SubjectName = allowAccessBy.Name;
                    }
                }
            }

            return(reportDetails);
        }