Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Repository/Multitier    [ Add a report in this area ]  
Report #:  88672   Status: Open
Amend DataSnapModules.pas for missing comments
Project:  Delphi Build #:  15.0.3890.34076
Version:    15.0 Submitted By:   Bob Swart
Report Type:  Minor failure / Design problem Date Reported:  10/5/2010 12:00:54 PM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   280729
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The unit DataSnapModules.pas in the ObjRepos directory is used to generate the ServerMethodsUnit.pas among others. Inside the ServerMethodsUnit.pas are two events handlers that have one line of code including comments to explain what to do.

The RTM version of DataSnapModules.pas does not contain these comments, but includes SPACES at the place of these comments. The code of the OnUserAuthenticate and OnUserAuthorize events only contain the assignment:

   valid := True;

The rest are empty lines, that contain some spaces however (which can be seen if you open the generated file using Notepad.exe).

In Jim Tierney's CodeRage presentation, I noticed that these empty lines and spaces actually contain some useful information:

begin
  { TODO : Validate the client user and password.
    If role-based authorization is needed, add role names to the UserRoles parameter  }
  valid := True;

And in the OnUserAuthorize there are a similar five lines of useful comments.

begin
  { TODO : Authorize a user to execute a method.
    Use values from EventObject such as UserName, UserRoles, AuthorizedRoles and DeniedRoles.
    Use DSAuthenticationManager1.Roles to define Authorized and Denied roles
    for particular server methods. }
  valid := True;

It would be great if these comments are placed back in the DataSnapModules.pas template file.
Steps to Reproduce:
Create a new DataSnap application, including ServerMethodsUnit and look for the OnUserAuthenticate and OnUserAuthorize events. They will only contain the Valid := True; assignment, and no helpful comments.
Workarounds
Manuallty modify DataSnapModules.pas in the ObjRepos directory to add the comments:

begin
  { TODO : Validate the client user and password.
    If role-based authorization is needed, add role names to the UserRoles parameter  }
  valid := True;

and

begin
  { TODO : Authorize a user to execute a method.
    Use values from EventObject such as UserName, UserRoles, AuthorizedRoles and DeniedRoles.
    Use DSAuthenticationManager1.Roles to define Authorized and Denied roles
    for particular server methods. }
  valid := True;
Attachment
None
Comments

None

Server Response from: ETNACODE01