This commit is contained in:
2021-01-27 22:24:56 +00:00
parent e83a389b72
commit 67d89b1d32
2 changed files with 26 additions and 23 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Models;
using AyaNova.Biz;
namespace AyaNova.DataList
@@ -117,9 +116,15 @@ namespace AyaNova.DataList
}
//Ensure only current user can fetch their reminders
string IAyaDataListServerCriteria.DataListServerCriteria(AyaNova.Models.AyContext ct, long currentUserId, DataListOptions dataListOptions)
public List<DataListFilterOption> DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase)
{
return "[{\"fld\":\"metareminderuser\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":" + currentUserId.ToString() + "}]}}]";
List<DataListFilterOption> ret = new List<DataListFilterOption>();
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metareminderuser" };
FilterOption.items.Add(new DataListColumnFilter() { value = currentUserId.ToString(), op = DataListFilterComparisonOperator.Equality });
ret.Add(FilterOption);
return ret;
}
}//eoc

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz;
namespace AyaNova.DataList
{
@@ -13,31 +12,30 @@ namespace AyaNova.DataList
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
//Default ListView
dynamic dlistView = new JArray();
// //Default ListView
// dynamic dlistView = new JArray();
dynamic cm = new JObject();
cm.fld = "name";
cm.sort = "+";
dlistView.Add(cm);
// dynamic cm = new JObject();
// cm.fld = "name";
// cm.sort = "+";
// dlistView.Add(cm);
cm = new JObject();
cm.fld = "objecttype";
dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "objecttype";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "active";
// dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "name", "objecttype", "active" };
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
cm = new JObject();
cm.fld = "active";
dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>();
//DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" });
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "Report",