public AuthController(IBusinessUser authService, ITokenHelper tokenHelper, IBusinessCustomer customerService, IBusinessAccount accountService, IBusinessTransaction transactionService)
 {
     _authService        = authService;
     _tokenHelper        = tokenHelper;
     _customerService    = customerService;
     _accountService     = accountService;
     _transactionService = transactionService;
 }
Esempio n. 2
0
        public AccountController(IOptions <TokenOptions> jwtOptions, IBusinessUser service)
        {
            _service      = service;
            _TokenOptions = jwtOptions.Value;     // recebendo o value do token
            ThrowIfInvalidOptions(_TokenOptions); // usando o metodo criado para tratamento de excessões

            // vericar se é preciso para versões mais recentes se nao precisar pode apagar essa configuração
            _serializeSettings = new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
        }
Esempio n. 3
0
        /// <summary>
        /// 清理某些已经改变的缓存
        /// </summary>
        /// <param name="entity"></param>
        private static void CleanUpCache(IBusinessUser entity)
        {
            CacheHelper.Remove(CoreCacheKeys.GetUserByAccountKey(entity.UserName));
            CacheHelper.Remove(CoreCacheKeys.GetUserByAccountKey(entity.UserEmail));
            CacheHelper.Remove(CoreCacheKeys.GetUserByEMailKey(entity.UserEmail));
            CacheHelper.Remove(CoreCacheKeys.GetUserByGuidKey(entity.UserGuid));
            CacheHelper.Remove(CoreCacheKeys.GetUserByNameKey(entity.UserName));

            CacheHelper.Remove(CoreCacheKeys.GetUserRolesByGuidKey(entity.UserGuid));

            CacheHelper.RemoveByPattern(CoreCacheKeys.GetUserListPrefixKey());
        }
Esempio n. 4
0
        /// <summary>
        /// 根据实体构建缓存
        /// </summary>
        /// <param name="entity"></param>
        private static void BuildUpCache(IBusinessUser entity)
        {
            CacheHelper.Set(CoreCacheKeys.GetUserByAccountKey(entity.UserName), entity, CacheHelper.AFewTime);
            CacheHelper.Set(CoreCacheKeys.GetUserByAccountKey(entity.UserEmail), entity, CacheHelper.AFewTime);

            CacheHelper.Set(CoreCacheKeys.GetUserByEMailKey(entity.UserEmail), entity, CacheHelper.AFewTime);
            CacheHelper.Set(CoreCacheKeys.GetUserByGuidKey(entity.UserGuid), entity, CacheHelper.AFewTime);
            CacheHelper.Set(CoreCacheKeys.GetUserByNameKey(entity.UserName), entity, CacheHelper.AFewTime);
        }
Esempio n. 5
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static bool UpdateUser(IBusinessUser entity)
        {
            BusinessUser originalModel = BusinessUserBLL.Get(entity.UserGuid, true);
            if (string.IsNullOrEmpty(entity.UserFullPath) ||
                originalModel.UserNameDisplay != entity.UserNameDisplay ||
                originalModel.DepartmentGuid != entity.DepartmentGuid)
            {
                entity.UserFullPath = GetFullPath(entity);
            }

            bool isSuccessful = DALSave.UpdateUser(entity);
            if (isSuccessful == true)
            {
                if (entity is IModelExtensible)
                {
                    ((IModelExtensible)entity).PropertyNames = ((IModelExtensible)entity).ExtensiableRepository.GetSerializerData().Keys;
                    ((IModelExtensible)entity).PropertyValues = ((IModelExtensible)entity).ExtensiableRepository.GetSerializerData().Values;
                }

                if (entity.UserFullPath != originalModel.UserFullPath)
                {
                    ChangeFullPath(originalModel.UserFullPath, entity.UserFullPath);
                }

                CleanUpCache(entity);
                BuildUpCache(entity);
            }
            return isSuccessful;
        }
Esempio n. 6
0
 /// <summary>
 /// 获取部门内用户的全路径
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static string GetFullPath(IBusinessUser entity)
 {
     return string.Format("{0}||{1}", BusinessDepartmentBLL.Instance.GetFullPath(entity.DepartmentGuid), entity.UserNameDisplay);
 }
Esempio n. 7
0
 /// <summary>
 /// 创建用户
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public static BusinessUser CreateUser(IBusinessUser entity, out CreateUserRoleStatuses status)
 {
     entity = BusinessUserDAL.DealWithPassword(entity);
     entity.UserFullPath = GetFullPath(entity);
     BusinessUser entityCreated = DALSave.CreateUser(entity, out status);
     if (status == CreateUserRoleStatuses.Successful)
     {
         CleanUpCache(entity);
         BuildUpCache(entityCreated);
     }
     return entityCreated;
 }
Esempio n. 8
0
 public UserController(IBusinessUser service)
 {
     _service = service;
 }
Esempio n. 9
0
 public AccountController(IBusinessUser userBusiness)
 {
     _userBusiness = userBusiness;
 }
Esempio n. 10
0
 public UserController(IBusinessUser _member)
 {
     member = _member;
 }
Esempio n. 11
0
 // GET: User
 public UserController(IBusinessUser busiuser)
 {
     _busiuser = busiuser;
 }
Esempio n. 12
0
 public ServiceUser(IBusinessBase <User> businessBase, IBusinessUser businessUser)
     : base(businessBase)
 {
     _businessUser = businessUser;
 }
Esempio n. 13
0
 public LoginController(IBusinessUser businesUserParam)
 {
     businesUser = businesUserParam;
 }
Esempio n. 14
0
 public LoginController()
 {
     businesUser = new BusinessUser();
 }
Esempio n. 15
0
 public LoginController(IOptions <AppSettings> appSettings, IBusinessUser businessUser, IHostingEnvironment env)
 {
     _businessUser = businessUser;
     _appSettings  = appSettings.Value;
     _env          = env;
 }