This commit is contained in:
2020-01-28 20:08:36 +00:00
parent 1b81188806
commit 5ad9c95f8c
3 changed files with 29 additions and 44 deletions

View File

@@ -43,45 +43,27 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get roles
/// </summary>
/// </summary>
/// <param name="AsJson">Return as compact JSON format</param>
/// <returns>Dictionary list of AyaNova object types and their authorization role rights in AyaNova</returns>
[HttpGet("list")]
public ActionResult GetRoles()
public ActionResult GetRoles([FromQuery] bool AsJson = false)
{
if (!serverState.IsOpen)
{
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
return Ok(ApiOkResponse.Response(BizRoles.roles, true));
//as json for client end of things
if (AsJson)
return Ok(ApiOkResponse.Response(Newtonsoft.Json.JsonConvert.SerializeObject(BizRoles.roles, Newtonsoft.Json.Formatting.None), true));
else
return Ok(ApiOkResponse.Response(BizRoles.roles, true));
}
// /// <summary>
// /// Get all possible enumerated values picklist key names
// /// </summary>
// /// <returns>List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute</returns>
// [HttpGet("listkeys")]
// public ActionResult GetTypesList()
// {
// if (!serverState.IsOpen)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
// List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
// ret.Add(new KeyValuePair<string, string>("usertypes", "AyaNova user account types"));
// ret.Add(new KeyValuePair<string, string>("authorizationroles", "AyaNova user account role types"));
// ret.Add(new KeyValuePair<string, string>("AyaType", "All AyaNova object types, use the AyaTypeController route to fetch these"));
// ret.Add(new KeyValuePair<string, string>("datatypes", "Types of data used in AyaNova for display and formatting UI purposes"));
// return Ok(ApiOkResponse.Response(ret, true));
// }