This commit is contained in:
@@ -17,26 +17,16 @@ namespace AyaNova.PickList
|
||||
{
|
||||
|
||||
|
||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(AyaType ayaType, string autoCompleteQuery, string tagSpecificQuery, bool includeInactive, AyContext ct, AuthorizationRoles userRoles)
|
||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery, string tagSpecificQuery, bool includeInactive, AyContext ct)
|
||||
{
|
||||
|
||||
var PickList = PickListFactory.GetAyaPickList(ayaType);
|
||||
|
||||
//was the name not found as a list?
|
||||
if (PickList == null)
|
||||
{
|
||||
throw new System.ArgumentOutOfRangeException($"PickList for type \"{ayaType}\" specified does not exist");
|
||||
}
|
||||
|
||||
//check rights
|
||||
|
||||
if (!userRoles.HasAnyFlags(PickList.AllowedRoles))
|
||||
throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
|
||||
|
||||
|
||||
|
||||
//Template
|
||||
string Template = null;
|
||||
//Attempt to fetch custom template
|
||||
var t = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == ((long)ayaType));
|
||||
var t = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == ((long)PickList.DefaultListObjectType));
|
||||
if (t == null)
|
||||
{
|
||||
Template = PickList.DefaultTemplate;
|
||||
|
||||
Reference in New Issue
Block a user