#1 2015-02-23 18:27:13

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Filter or callback on the server side

Hello,

My question: this is possible to filter search result on the server side and return to the client only records
which satisfy the conditions of the server logic.

In other word this is like per record authentication

Offline

#2 2015-02-23 21:06:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Filter or callback on the server side

Do you mean per record query for the remote ORM?
Yes of course!
http://synopse.info/files/html/Synopse% … ml#TITL_36

If you want to "hide" some data from the client, the best, safest and easier is to write an interface-based service, and some DTO objects.
See http://synopse.info/files/html/Synopse% … ml#TITL_63

Offline

#3 2015-02-24 07:16:25

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: Filter or callback on the server side

Thank you, I need hide some data and try now to research available ways.

Now I try to test Sample 20, but when start server from this sample I'm got error:
HttpSetServiceConfiguration failed: Access denied (5)

This error occured in unit SynCrtSock:
class function THttpApiServer.AddUrlAuthorize(const aRoot, aPort: RawByteString;
  Https: boolean; const aDomainName: RawByteString; OnlyDelete: boolean): string;

Oh, with admin right this is works, thanks )

Last edited by EgorovAlex (2015-02-24 07:35:35)

Offline

#4 2015-02-24 07:39:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Filter or callback on the server side

Please RTFM!
:-)

Offline

#5 2015-02-25 16:06:56

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: Filter or callback on the server side

This is possible to return from Service the TObjectList?

My idea - send request to the service with parameters and service should return list of TSQLRecord

Offline

#6 2015-02-25 17:55:01

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: Filter or callback on the server side

I found, that this is possible with DTO, thanks to your comment above

and now I have this classes:

  TSQLMyRec = class(TSQLRecord)

  TDTOItem = class(TCollectionItem)

  TDTOCollection = class(TInterfacedCollection)

In my situation TDTOItem is exact copy of TSQLMyRec
there is no way to avoid duplication and use single code for this classes?

Offline

#7 2015-02-25 18:45:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Filter or callback on the server side

Or you may return some RawJson parameter containing the whole data, then parse it on the client side.

Offline

#8 2015-02-26 11:22:03

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: Filter or callback on the server side

If I undersnand right - I can use one interface IInvokable with many methods,
which is the best way - one interface with full server functionality
or interfaces per specific job?
Which way more faster and correct?

Offline

#9 2015-02-26 13:44:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Filter or callback on the server side

Please take a look at the "SOLID principles", e.g. in our documentation.
See http://synopse.info/files/html/Synopse% … ml#TITL_47

You should better follow the "interface segregation" principle.
http://synopse.info/files/html/Synopse% … #TITLE_318

Offline

Board footer

Powered by FluxBB