Security Custom File Class from Extension

This public forum is for user-to-user discussions of PHP Report Maker. Note that this is not support forum.

Security Custom File Class from Extension

Postby mobhar » Wed Jan 11, 2017 6:49 pm

I created an extension for PHP Report Maker 10 that has the ability to customize the generated Custom Files in my PHP Report Maker project. Everything is fine, until I found a strange behavior.

This code:
<!--## if (bSecurityEnabled) { ##-->
<!--##~SYSTEMFUNCTIONS.Security()##-->
<!--## } ##-->

will produce the generated code for Security checking inside Page_Init() function as follows:

if (!$Security->IsLoggedIn()) $Security->AutoLogin(); // Auto login
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->ProjectID . 'Quarterly Orders By Product');
$Security->TablePermission_Loaded();
if (!$Security->CanList()) {
$Security->SaveLastUrl();
$this->setFailureMessage($ReportLanguage->Phrase("NoPermission")); // Set no permission
$this->Page_Terminate(ewr_GetUrl("index.php"));
}
$Security->UserID_Loading();
if ($Security->IsLoggedIn()) $Security->LoadUserID();
$Security->UserID_Loaded();
if ($Security->IsLoggedIn() && strval($Security->CurrentUserID()) == "") {
$Security->SaveLastUrl();
$this->setFailureMessage($ReportLanguage->Phrase("NoPermission")); // Set no permission
$this->Page_Terminate(ewr_GetUrl("rlogin.php"));
}

Now let's see this code:
$Security->LoadCurrentUserLevel($this->ProjectID . 'Quarterly Orders By Product');

As you can see from the generated code above, it always point out to the first Report object in my PHP Report Maker project (I am using demo project for test purpose). In other words, all my generated code inside Page_Init function in Custom File, will always point to that first report object. This behavior does not happened in my similar extension for PHPMaker.

Thoughts?
mobhar
 
Posts: 4326
Joined: Wed Jun 05, 2013 2:11 pm

Re: Security Custom File Class from Extension

Postby Webmaster » Thu Jan 12, 2017 1:45 pm

In your extension, please make sure that you set up the global variable gsTblName properly for the current custom file.

gsTblName = TABLE.TblName;
Webmaster
 
Posts: 10444
Joined: Fri Aug 06, 2004 5:59 pm

Re: Security Custom File Class from Extension

Postby mobhar » Thu Jan 12, 2017 2:05 pm

Thank you. That did the trick. Simple, yet powerful! :-)
mobhar
 
Posts: 4326
Joined: Wed Jun 05, 2013 2:11 pm


Return to General Discussion (PHP Report Maker)