5b40cf6fb0
* Added language support api * Added canRead canWrite to functions Access api
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Claims;
|
|
using System.Web.Http;
|
|
using Step.Database.Controllers;
|
|
using Step.Model.DTOModels;
|
|
using static Step.Utils.Constants;
|
|
|
|
namespace Step.Controllers.WebApi
|
|
{
|
|
|
|
[RoutePrefix("api/config")]
|
|
public class ConfigurationController : ApiController
|
|
{
|
|
[Route("functions"), HttpGet]
|
|
[WebApiAuthorize(FunctionAccess = "test", Action = ACTIONS.READ)]
|
|
public IHttpActionResult GetFunctionsConfig()
|
|
{
|
|
using (FunctionAccessController functionController = new FunctionAccessController())
|
|
{
|
|
var identity = User.Identity as ClaimsIdentity;
|
|
|
|
var userRoleLevel = identity.Claims.Where(c => c.Type == ROLE_LEVEL_KEY).SingleOrDefault();
|
|
|
|
|
|
List<DTOFunctionAccessModel> functionsList = functionController.GetFunctionAccess(Convert.ToInt32(userRoleLevel.Value));
|
|
|
|
if (functionsList == null)
|
|
return NotFound();
|
|
|
|
return Ok(functionsList);
|
|
}
|
|
}
|
|
}
|
|
}
|