diff --git a/src/client/index.d.ts b/src/client/index.d.ts index 39cf809a..d416d88f 100644 --- a/src/client/index.d.ts +++ b/src/client/index.d.ts @@ -759,6 +759,7 @@ declare module fng { readRecord: (modelName: string, id: string, formName?: string) => angular.IHttpPromise; getAll: (modelName: string, _options: any) => angular.IHttpPromise; getAllListAttributes: (ref: string) => angular.IHttpPromise; + getAllPickListAttributes: (ref: string) => angular.IHttpPromise; getPagedAndFilteredList: ( modelName: string, options: IListQueryOptions diff --git a/src/client/js/services/submissions.ts b/src/client/js/services/submissions.ts index b8cf46b9..e0e90e07 100644 --- a/src/client/js/services/submissions.ts +++ b/src/client/js/services/submissions.ts @@ -130,9 +130,14 @@ module fng.services { }, // return only the list attributes for ALL records in the given collection, returning ILookupItem[] + // getAllPickListAttributes() is intended to be used to retrieve records for display in a picklist; + // getAllListAttributes() for all other use cases getAllListAttributes: function (ref: string): angular.IHttpPromise { return $http.get(`/api/${ref}/listAll`, { cache: expCache }); }, + getAllPickListAttributes: function (ref: string): angular.IHttpPromise { + return $http.get(`/api/${ref}/picklistAll`, { cache: expCache }); + }, // return only the list attributes for records in the given collection that satisfy the given query conditions (filter, limit etc.) // return ILookupItem[] if options.concatenate is true, else the raw documents diff --git a/src/server/data_form.ts b/src/server/data_form.ts index b3514319..cf8400a5 100644 --- a/src/server/data_form.ts +++ b/src/server/data_form.ts @@ -150,7 +150,9 @@ export class FormsAngular { processArgs(this.options, [resourceName, this.collectionGet()]) ); - // return the List attributes for all records - used by record-handler's setUpLookupOptions() method, for cases + // return the List attributes for all records. two endpoints that go through the same handler so permissions + // can be applied differently for the two use cases. /listAll is intended for listing records on a page; + // /picklistAll for listing them in a