From f5a85f0f6afe30e37148c47844063dda65e5c8fe Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 20 Sep 2018 19:11:14 +0000 Subject: [PATCH] --- server/AyaNova/biz/BizObjectNameFetcher.cs | 4 +-- server/AyaNova/biz/Search.cs | 30 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/AyaNova/biz/BizObjectNameFetcher.cs b/server/AyaNova/biz/BizObjectNameFetcher.cs index 9f95c038..9bcab00d 100644 --- a/server/AyaNova/biz/BizObjectNameFetcher.cs +++ b/server/AyaNova/biz/BizObjectNameFetcher.cs @@ -17,9 +17,9 @@ namespace AyaNova.Biz internal static class BizObjectNameFetcher { - internal static string Name(AyaTypeId tid) + internal static string Name(AyaTypeId tid, AyContext ct = null) { - return Name(tid.ObjectType, tid.ObjectId); + return Name(tid.ObjectType, tid.ObjectId, ct); } diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index 24065fb9..37465daf 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -302,30 +302,30 @@ namespace AyaNova.Biz //If it's not a name only search then rights need to be checked for full read because even if it's just a tags search that's part of the full record of the object if (!searchParameters.NameOnly) { + //list to hold temporary matches + List CanReadMatchingObjects = new List(); foreach (AyaTypeId t in MatchingObjects) { if (AyaNova.Api.ControllerHelpers.Authorized.IsAuthorizedToReadFullRecord(currentUserRoles, t.ObjectType)) { - + CanReadMatchingObjects.Add(t); } - } + + //Ok, we're here with the list of allowable objects which is now the master matching objects list so... + MatchingObjects = CanReadMatchingObjects; } - //amost ready to return, now populate the return list - //TODO: change this to use MatchingObjects list instead - // foreach (SearchKey SearchKeyMatch in SearchKeyMatches) - // { - // SearchResult SR = new SearchResult(); - // SR.Name = BizObjectNameFetcher.Name(SearchKeyMatch.ObjectType, SearchKeyMatch.ObjectId, ct); - // SR.Id = SearchKeyMatch.ObjectId; - // SR.Type = SearchKeyMatch.ObjectType; - // ResultList.Add(SR); - // } - - - + //Build the return list from the remaining matching objects list + foreach (AyaTypeId i in MatchingObjects) + { + SearchResult SR = new SearchResult(); + SR.Name = BizObjectNameFetcher.Name(i, ct); + SR.Id = i.ObjectId; + SR.Type = i.ObjectType; + ResultList.Add(SR); + } return ResultList; }