Beispiel #1
0
        protected virtual bool ShouldIntercept(
            IRocketMethodInvocation invocation,
            out AuditLogInfo auditLog,
            out AuditLogActionInfo auditLogAction)
        {
            auditLog       = null;
            auditLogAction = null;

            if (RocketCrossCuttingConcerns.IsApplied(invocation.TargetObject, RocketCrossCuttingConcerns.Auditing))
            {
                return(false);
            }

            var auditLogScope = _auditingManager.Current;

            if (auditLogScope == null)
            {
                return(false);
            }

            if (!_auditingHelper.ShouldSaveAudit(invocation.Method))
            {
                return(false);
            }

            auditLog       = auditLogScope.Log;
            auditLogAction = _auditingHelper.CreateAuditLogAction(
                auditLog,
                invocation.TargetObject.GetType(),
                invocation.Method,
                invocation.Arguments
                );

            return(true);
        }
Beispiel #2
0
        public virtual AuditLogActionInfo CreateAuditLogAction(
            AuditLogInfo auditLog,
            Type type,
            MethodInfo method,
            IDictionary <string, object> arguments)
        {
            var actionInfo = new AuditLogActionInfo {
                ServiceName = type != null ?
                              type.FullName :
                              "",
                MethodName    = method.Name,
                Parameters    = SerializeConvertArguments(arguments),
                ExecutionTime = Clock.Now
            };

            //TODO Execute contributors

            return(actionInfo);
        }