123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Microsoft.AspNetCore.Http;
- using ERP.Core.Dto;
- using ERP.Core.Entity;
- using ERP.Core.Repository;
- using ERP.Framework.Constants;
- using ERP.Framework.WebApi;
- namespace ERP.Core.Service
- {
- public class SysUserService
- {
- private SysUserRepository SysUserRepository;
- public SysUserService(SysUserRepository SysUserRepository)
- {
- this.SysUserRepository = SysUserRepository;
- }
- public async Task<LoginUser> GetUserInfo(string loginName)
- {
- var user = SysUserRepository.FirstOrDefault(t => t.UserName == loginName);
- //if (user == null)
- //{
- // throw new Exception(string.Format(_localizer["User.NotExist"], loginName)));
- //}
- //CheckUserStatus(user);
- //var roleList = SysRoleRepository.SelectRoleListByUserId(user.Id);
- //var roleKeyList = roleList.Select(t => t.RoleKey).ToList();
- //var permissions = new List<string>();
- //if (roleList.Any(t => t.RoleKey == FrameworkConstant.Admin))
- //{
- // permissions.Add(FrameworkConstant.AdminPermission);
- //}
- //else
- //{
- // var roleIds = roleList.Select(t => t.Id).ToList();
- // permissions = SysMenuRepository.SelectPermissionsByRoleIds(roleIds);
- //}
- return new LoginUser();
- }
- private void CheckUserStatus(SysUser user)
- {
- //if (user.UserStatus == UserStatusEnum.Enable)
- //{
- // return;
- //}
- //else if (user.UserStatus == UserStatusEnum.Disable)
- //{
- // throw new RpcException(new Status(StatusCode.Unknown, string.Format(_localizer["User.Bloked"], user.LoginName)));
- //}
- //else if (user.UserStatus == UserStatusEnum.Effact)
- //{
- // CheckEffective(user.EffectiveDate, user.LoginName);
- //}
- //else if (user.UserStatus == UserStatusEnum.Expiry)
- //{
- // CheckExpiry(user.ExpiryDate, user.LoginName);
- //}
- //else if (user.UserStatus == UserStatusEnum.Temporary)
- //{
- // CheckEffective(user.EffectiveDate, user.LoginName);
- // CheckExpiry(user.ExpiryDate, user.LoginName);
- //}
- }
- }
- }
|