This commit is contained in:
@@ -35,6 +35,23 @@ namespace AyaNova.DataList
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Verify listkey
|
||||
internal static bool ListKeyIsValid(string listKey)
|
||||
{
|
||||
|
||||
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
||||
|
||||
foreach (System.Reflection.TypeInfo ti in ass.DefinedTypes)
|
||||
{
|
||||
if (!ti.IsAbstract && ti.ImplementedInterfaces.Contains(typeof(IDataListProcessing)))
|
||||
{
|
||||
if (ti.Name == listKey)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -17,24 +17,22 @@ namespace AyaNova.DataList
|
||||
// Get the data list data requested
|
||||
//
|
||||
//
|
||||
internal static async Task<DataListReturnData> GetResponseAsync(AyContext ct, DataListTableRequest dataListTableRequest, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||
internal static async Task<DataListReturnData> GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableOptions,IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||
{
|
||||
|
||||
var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey);
|
||||
// var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey);
|
||||
|
||||
//was the name not found as a list?
|
||||
if (DataList == null)
|
||||
throw new System.ArgumentOutOfRangeException($"DataList \"{dataListTableRequest.DataListKey}\" specified does not exist");
|
||||
// if (DataList == null)
|
||||
// throw new System.ArgumentOutOfRangeException($"DataList \"{dataListTableRequest.DataListKey}\" specified does not exist");
|
||||
|
||||
|
||||
//check rights
|
||||
if (!userRoles.HasAnyFlags(DataList.AllowedRoles))
|
||||
throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
|
||||
|
||||
|
||||
|
||||
//turn the DataListTableRequest into a DataListTableProcesingOptions object here
|
||||
//hydrates filter and column selections etc
|
||||
DataListTableProcessingOptions dataListTableOptions = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct);
|
||||
// = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct);
|
||||
|
||||
//#### TODO: below block into above method to clean it up and centralize it
|
||||
|
||||
@@ -233,11 +231,8 @@ namespace AyaNova.DataList
|
||||
|
||||
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
|
||||
Newtonsoft.Json.Linq.JArray ColumnsJSON = null;
|
||||
|
||||
ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableOptions.Columns);//<<<-----this next
|
||||
|
||||
ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableOptions.Columns);
|
||||
return new DataListReturnData(rows, totalRecordCount, ColumnsJSON);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user