Using the Troleauth class to authorize interface to the DATASNAP server

Source: Internet
Author: User

Using the Troleauth class, a kind of gaze-like code for authorization, is also the simplest and most convenient way to implement the following:

UnitServerMethodsUnit1;Interfaceusessystem.sysutils, System.classes, System.json, Datasnap.dsserver, Datasnap.dsauth, Datasnap.dsproviderdatamoduleadapter;typeTServerMethods1=class(Tdsservermodule)Private    {Private Declarations}   Public    {Public Declarations}[Troleauth ('AdminGroup','Guestgroup')]    functionEchostring (Value:string):string; [Troleauth ('Guestgroup','AdminGroup')]    functionReverseString (Value:string):string; End;Implementation{$R *.DFM}usessystem.strutils;functionTservermethods1.echostring (Value:string):string;beginResult:=Value;End;functionTservermethods1.reversestring (Value:string):string;beginResult:=System.StrUtils.ReverseString (Value);End;End.

Compilation environment: Delphi XE7

Join Datasnap Advanced Exchange Group 439992010 to download this demo

Using the Troleauth class to authorize interface to the DATASNAP server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.