This commit is contained in:
@@ -125,6 +125,53 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get available types allowed for Custom fields
|
||||
/// Used to build UI for customizing a form
|
||||
///
|
||||
/// Required roles:
|
||||
/// BizAdminFull only has rights to customize forms
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>A list of type string values valid for custom fields</returns>
|
||||
[HttpGet("AvailableCustomTypes")]
|
||||
public ActionResult GetAvailableCustomTypes()
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, AyaType.FormCustom))
|
||||
return StatusCode(401, new ApiNotAuthorizedResponse());
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
return Ok(new ApiOkResponse(AyDataType.ValidCustomFieldTypes));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all customizable form keys
|
||||
/// Used to build UI for customizing a form
|
||||
///
|
||||
/// Required roles:
|
||||
/// BizAdminFull only has rights to customize forms
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>A list of string formKey values valid for customization</returns>
|
||||
[HttpGet("AvailableCustomizableFormKeys")]
|
||||
public ActionResult GetAvailableCustomizableFormKeys()
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.IsAuthorizedToReadFullRecord(HttpContext.Items, AyaType.FormCustom))
|
||||
return StatusCode(401, new ApiNotAuthorizedResponse());
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
return Ok(new ApiOkResponse(FormAvailableFields.AvailableFormKeys));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user