ปรับปรุงสิทธิการมองเห็นต่างๆ
This commit is contained in:
@@ -27,6 +27,7 @@ namespace TodoAPI2.Controllers
|
||||
private ILogger<eva_create_evaluation_detail_processController> _logger;
|
||||
private Ieva_create_evaluation_detail_processService _repository;
|
||||
private IConfiguration Configuration { get; set; }
|
||||
private Iexternal_employeeService emp;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@@ -37,13 +38,17 @@ namespace TodoAPI2.Controllers
|
||||
/// Default constructure for dependency injection
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
public eva_create_evaluation_detail_processController(ILogger<eva_create_evaluation_detail_processController> logger, Ieva_create_evaluation_detail_processService repository, IConfiguration configuration)
|
||||
/// <param name="inemp"></param>
|
||||
public eva_create_evaluation_detail_processController(ILogger<eva_create_evaluation_detail_processController> logger,
|
||||
Iexternal_employeeService inemp,
|
||||
Ieva_create_evaluation_detail_processService repository, IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
Configuration = configuration;
|
||||
emp = inemp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,9 +69,19 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
var result = _repository.GetWithSelection(id);
|
||||
|
||||
return Ok(result);
|
||||
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
|
||||
{
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
var result = _repository.GetWithSelection(id, e.id);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -122,7 +137,17 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_id));
|
||||
|
||||
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
|
||||
{
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
return Ok(_repository.GetListBycreate_evaluation_id(create_evaluation_id, e.id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -149,7 +174,17 @@ namespace TodoAPI2.Controllers
|
||||
try
|
||||
{
|
||||
if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
|
||||
return Ok(_repository.GetListBySearch(model));
|
||||
|
||||
if (!string.IsNullOrEmpty(HttpContext.Request.Cookies["user_id"]))
|
||||
{
|
||||
var loginid = Convert.ToInt32(HttpContext.Request.Cookies["user_id"]);
|
||||
var e = emp.GetEmployeeForLogin(Convert.ToInt32(loginid));
|
||||
return Ok(_repository.GetListBySearch(model, e.id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user