private IDictionary <string, object> GetActionParameters(IDictionary <string, object> actionArguments)
 {
     if (SerializeActionParameters)
     {
         return(AuditApiHelper.SerializeParameters(actionArguments));
     }
     return(actionArguments);
 }
        private IDictionary <string, object> GetActionParameters(ControllerActionDescriptor actionDescriptor, IDictionary <string, object> actionArguments, bool serializeParams)
        {
            var args = actionArguments.ToDictionary(k => k.Key, v => v.Value);

            foreach (var param in actionDescriptor.Parameters)
            {
                if ((param as ControllerParameterDescriptor)?.ParameterInfo.GetCustomAttribute <AuditIgnoreAttribute>(true) != null)
                {
                    args.Remove(param.Name);
                }
            }
            if (serializeParams)
            {
                return(AuditApiHelper.SerializeParameters(args));
            }
            return(args);
        }
Beispiel #3
0
        private IDictionary <string, object> GetActionParameters(ReflectedHttpActionDescriptor actionDescriptor, IDictionary <string, object> actionArguments, bool serializeParams)
        {
            var args = actionArguments.ToDictionary(k => k.Key, v => v.Value);

            if (actionDescriptor.ActionBinding?.ParameterBindings != null)
            {
                foreach (var param in actionDescriptor.ActionBinding.ParameterBindings)
                {
                    var paramDescriptor = param.Descriptor as ReflectedHttpParameterDescriptor;
                    if (paramDescriptor?.ParameterInfo.GetCustomAttribute <AuditIgnoreAttribute>(true) != null)
                    {
                        args.Remove(paramDescriptor.ParameterName);
                    }
                }
            }
            if (serializeParams)
            {
                return(AuditApiHelper.SerializeParameters(args));
            }
            return(args);
        }
Beispiel #4
0
        private IDictionary <string, object> GetActionParameters(HttpActionDescriptor actionDescriptor, IDictionary <string, object> actionArguments, bool serializeParams)
        {
            var args       = actionArguments.ToDictionary(k => k.Key, v => v.Value);
            var parameters = actionDescriptor.GetParameters();

            if (parameters != null)
            {
                foreach (var param in parameters)
                {
                    if (param.GetCustomAttributes <AuditIgnoreAttribute>().Any())
                    {
                        args.Remove(param.ParameterName);
                    }
                }
            }
            if (serializeParams)
            {
                return(AuditApiHelper.SerializeParameters(args));
            }
            return(args);
        }