Modal Dialog for View Page when Access Denied

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mobhar
User
Posts: 11703

Modal Dialog for View Page when Access Denied

Post by mobhar »

I just found an issue in v2018: The Modal Dialog that contains View Page, will display the List Page including header and footer, when access denied for the View Page permission (for example, when the session has expired that triggered from another tab of the same browser).

For simplicity, let's say we use "Categories List" page of demo project.

To reproduce this issue, please follow all the following steps carefully:

  1. Open the demo project using PHPMaker 2018, and make sure to click or select on "categories" table from "Database" pane,

  2. Click on "Table" tab at the right pane, go to "View Page" section, then enable "Modal dialog",

  3. Generate all the script files as usual, everything should be working fine so far,

  4. Open the generated web application from your favorite browser,

  5. Make sure you have already logged in using username "admin" and password "master",

  6. Click on "OTHER TABLES" -> "categories", then you should see now the List page of "categories",

  7. Click on the dropdown button that belongs to the first record in that List page, then click on "View" menu, then the modal dialog will display the View page properly,

  8. Close that modal dialog, by clicking on "Close" button in that modal dialog window,

  9. Right click on "Home" menu, then click on "Open link in new tab", then you should see the Home page will be displayed in that new tab of the same browser,

  10. Go to that new tab that opens the Home page, click on the user icon at the top right corner, then click on "Logout",

  11. Go back to the previous tab which still displaying the List page of "categories", click again on the dropdown button that belongs to the first record in that List page, and click on "View" menu, then the modal dialog will display the List page.

So the issue is in the step #11 above. The modal dialog will display the List page, since the user session has expired. This looks weird to display the List page including the header and footer section in that modal dialog.

In other words, the modal dialog should only display the message "You do not have permission to access /demo2018/categoriesview.php" instead of displaying the List page.

Thoughts?


Webmaster
User
Posts: 9427

Post by Webmaster »

Try v2018.0.2.


mobhar
User
Posts: 11703

Post by mobhar »

Thank you, now it works properly.

Just a small issue found though, if we try to click several times to view the record, then the previous warning message will still keep appearing, and it looks a little bit of confusing.

So I customized line 1044 to 1046 of "phpcommon-scripts.php" file:
} else { // List page should not be shown as modal => error
$row["error"] = $this->getFailureMessage();
}

to:
} else { // List page should not be shown as modal => error
$row["error"] = $this->getFailureMessage();
if ($SESSION[EW_SESSION_FAILURE_MESSAGE] != "")
$
SESSION[EW_SESSION_FAILURE_MESSAGE] = "";
}

Now only the latest warning message will be shown. Hope this helps.


mobhar
User
Posts: 11703

Post by mobhar »

mobhar wrote:
if ($SESSION[EW_SESSION_FAILURE_MESSAGE] != "")
$
SESSION[EW_SESSION_FAILURE_MESSAGE] = "";

should be:
$this->ClearFailureMessage();


Post Reply