using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Authorization; using AyaNova.Models; using AyaNova.Api.ControllerHelpers; using AyaNova.Biz; namespace AyaNova.Api.Controllers { /// /// Enum pick list controller /// [ApiController] [ApiVersion("8.0")] [Route("api/v{version:apiVersion}/[controller]")] [Produces("application/json")] [Authorize] public class AuthorizationRolesController : ControllerBase { private readonly AyContext ct; private readonly ILogger log; private readonly ApiServerState serverState; /// /// ctor /// /// /// /// public AuthorizationRolesController(AyContext dbcontext, ILogger logger, ApiServerState apiServerState) { ct = dbcontext; log = logger; serverState = apiServerState; } /// /// Get roles /// /// Dictionary list of AyaNova object types and their authorization role rights in AyaNova [HttpGet("list")] public ActionResult GetRoles() { if (!serverState.IsOpen) { return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); } return Ok(ApiOkResponse.Response(BizRoles.roles, true)); } // /// // /// Get all possible enumerated values picklist key names // /// // /// List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute // [HttpGet("listkeys")] // public ActionResult GetTypesList() // { // if (!serverState.IsOpen) // { // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); // } // List> ret = new List>(); // ret.Add(new KeyValuePair("usertypes", "AyaNova user account types")); // ret.Add(new KeyValuePair("authorizationroles", "AyaNova user account role types")); // ret.Add(new KeyValuePair("AyaType", "All AyaNova object types, use the AyaTypeController route to fetch these")); // ret.Add(new KeyValuePair("datatypes", "Types of data used in AyaNova for display and formatting UI purposes")); // return Ok(ApiOkResponse.Response(ret, true)); // } }//eoc }//ens