1234567891011121314151617181920212223242526272829303132 |
- using FuelServer.Core.Entity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fuel.Application.Service
- {
- public class UserService : IUserService
- {
- private readonly EntityHelper _entityHelper;
- public UserService(EntityHelper entityHelper)
- {
- _entityHelper = entityHelper;
- }
- public users ValidateCredentials(string username, string password)
- {
- return _entityHelper.GetEntitiesAsync<users>(_ => _.Account == username && _.Password == password).Result.FirstOrDefault(); ;
- }
- public async Task<IEnumerable<string>> GetUserPermissions(string userId)
- {
- // 这里是模拟数据,实际应用中应该从数据库或其他来源获取权限信息
- return await Task.FromResult(new List<string>
- {
- "Admin:Index:GET",
- "Admin:Edit:POST"
- // 更多权限...
- });
- }
- }
- }
|