2024-04-22 18:04:14 -05:00
|
|
|
using API.Authentication.Interfaces;
|
|
|
|
using API.DTO.Base;
|
|
|
|
using DAL.Contexts;
|
|
|
|
using DAL.Models;
|
|
|
|
using DAL.Models.Audits;
|
|
|
|
|
|
|
|
namespace API.Services
|
|
|
|
{
|
2024-07-12 23:29:28 -05:00
|
|
|
public class GrantService : ServiceBase<GrantService, GrantDTO, Grant, AuditGrant, IGrantAuthentication>
|
2024-04-22 18:04:14 -05:00
|
|
|
{
|
2024-07-12 23:29:28 -05:00
|
|
|
public GrantService(ILogger<GrantService> logger, SASGContext context, IGrantAuthentication auth) : base(logger, context, auth)
|
2024-04-22 18:04:14 -05:00
|
|
|
{
|
|
|
|
}
|
2024-08-31 20:59:42 -05:00
|
|
|
|
|
|
|
public IEnumerable<Grant>? getMine(User user)
|
|
|
|
{
|
|
|
|
if (!_auth.canGetMine(user))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
return Context.Set<Grant>().Where(x => x.permissionId == user.permissionId);
|
|
|
|
}
|
2024-04-22 18:04:14 -05:00
|
|
|
}
|
|
|
|
}
|