public void SimpleMethod()
 {
     Logg.Info(GetType().Name);
     Logg.Info("Process start");
     Repo.TestRepository1();
     Logg.Info($@"Repo out - {Repo.TestRepository2()}");
     Logg.Debug("Process stopped");
 }
示例#2
0
 public object Reset(ResetEventData data)
 {
     Logg.Info(new { logon = "reset was called" });
     foreach (var logonProvider in Extensions)
     {
         logonProvider.Reset(data);
     }
     return(null);
 }
示例#3
0
 private void LogResult(IIdentity result, string opid)
 {
     if (!result.IsAuthenticated)
     {
         if (Logg.IsForWarn())
         {
             Logg.Warn(new { logonid = opid, auth = false, result }.stringify());
         }
     }
     else
     {
         if (Logg.IsForInfo())
         {
             Logg.Info(new { logonid = opid, auth = true, result }.stringify());
         }
     }
 }
示例#4
0
        private UpdateResult UpdateResult(IIdentity actor, IUser target, bool store, UserUpdateInfo updateinfo
                                          )
        {
            UpdateResult res = null;

            Logg.Info(new { updateusr = "******", usr = actor.Name, info = updateinfo }.stringify());
            if (string.IsNullOrWhiteSpace(updateinfo.Login))
            {
                updateinfo.Login = actor.Name;
            }
            target = target ?? Users.GetUser(updateinfo.Login);
            var newuser = target == null;

            if (!updateinfo.HasDelta(target))
            {
                return(new UpdateResult {
                    Ok = true, Message = "notchanged", ResultUser = target
                });
            }

            res = Checker.ValidateUpdate(actor, updateinfo, target);
            if (!res.Ok)
            {
                Logg.Warn(
                    new { updateusr = "******", validation = res, usr = actor.Name, info = updateinfo }.stringify());

                return(res);
            }
            if (null == target)
            {
                target = new User {
                    Login = updateinfo.Login
                };
            }
            updateinfo.Apply(target);
            UserPolicy policy = null;

            if (newuser)
            {
                policy = UserPolicy.GetNewUserPolicy(updateinfo);
            }
            if (null != policy)
            {
                policy.Apply(target);
            }
            if (store)
            {
                Users.Store(target);
            }
            if (null != policy && policy.MakePassRequest && null != Messendger)
            {
                if (newuser)
                {
                    Messendger.SendWelcome(target);
                }
            }
            Logg.Info(new { updateusr = "******", result = target, usr = actor.Name, info = updateinfo }.stringify());
            Users.Clear();
            Roles.Clear();
            res = new UpdateResult {
                Ok = true, ResultUser = target
            };
            return(res);
        }