This topic is locked
[SOLVED]

  Link Session ID to PHPRunner's Native Security Tools

10/26/2011 12:48:47 PM
PHPRunner General questions
T
Tricause author

Hello,
I am wanting to connect an external portal, that already includes a user login, to the PHPRunner output without requiring the user to re-authenticate his/her credentials while still utilizing the native security tools present in PHPRunner. I am curious as to how, if possible, I could use a session ID being passed from the portal to the PHPRunner output such that the session ID would contain the user's information and would be compared with, for example, a "user" table used in PHPRunner to automatically grant appropriate privileges for adding, editing, deleting, etc, and avoiding the PHPRunner login page while also avoiding create new templates.
If this is not possible, then the other option I have in mind requires templates. Would it be possible to create a template to pass the Session ID each time a new table is loaded and to filter out which records the user can and cannot see (or edit, or whatever)? If both are possible, I would like to avoid this method because I really like the native security tools.
I look forward to any ideas or workarounds for this problem.
Thanks!

Jake

Sergey Kornilov admin 10/26/2011

You may want to take a look at the way how PHPRunner and Joomla integration is implemented:

http://www.asprunner.com/forums/topic/13251-phprunner-and-joomla/
Session ID is passed via URL and if authentication is successful PHPRunner session variables are populated making built-on PHPRunner security work as expected.

T
Tricause author 11/2/2011

Thank you for your response.
I have decided to create a solution beyond the native security tools through linking session ids to table records, modifying the query in the "Before SQL Query" events page. However, I would like to know how to make this event apply to all "Before SQL Query" pages, instead of manually inserting it to each through PHPRunner's GUI. I've made the algorithm in this event page (and indeed other pages) to where it is table-independent and inserting it into other "Before SQL Query" event pages will not lead to any complications.
I am certain there is a way to do this with Joomla and templates, but, alas, I've not the knowledge to do so. I've seen PHPRunner's documentation page for templates, but I am not quite clear how this would be implemented for something as simple as systematically appending these code snippets to the output files if it is not doable within PHPRunner interface itself (e.g. if it is not possible to apply one code snippet for all "After table initialized" event pages within the Events tab).
Similarly, I am curious of a simple solution to adding the same button (e.g. a button "Process" on a list page that performs some work depending upon the selected records) across all pages, which I am sure is just an extension of the former idea.
Again, I am nearly certain that the solution I am looking for lies within templates or possibly a Joomla integration, but if such a solution does not lie within the PHPRunner interface itself, I am somewhat at a loss on how to apply this to all pages. I am sorry for any inconvenience my questioning causes and I know I have somewhat diverged from the topic, but I appreciate any responses; I am not trying to shortcut the proper methodology for this but I would appreciate any further suggestions as I continue to research and apply a solution.
Thank you.

Sergey Kornilov admin 11/3/2011

You can add your button to the Header that is displayed on all pages. Most probably you'll need to implement your own way of retrieving the list of selected records on each page and passing it to a server-side code.

T
Tricause author 11/4/2011

Sergey, the header/footer pages do not have an option to add buttons nor code snippets, merely pure HTML and PHP.
In addition, I do have a way to select records that is purely page-independent, but even if the header/footer pages allowed for buttons and snippets to be inserted, this still does not solve issues of the queries needing to be modified manually on each page, since the variable that accesses the database is not available globally but only in the scope of the "Before Query" section, or are you suggesting that this too should be done in the header/footer?
Thank you.
EDIT: In addition, I have found that there appears to be a bug relating to buttons. In an older version of a particular button, I had the button merely output a variable after it was done with server-side work; however, I have since updated the button to perform another task (e.g. redirect), but it still outputs a variable rather than redirecting, although this output has since been removed. Strangely, if I create a new button, after resetting the page and copying the exact same code, everything proceeds fine. It appears that when the project is built (both in partial and in full), at some point it makes reference to code that no longer exists in the events tab of the GUI but exists somewhere else even though this old code that has since been "erased".

Sergey Kornilov admin 11/4/2011

Jake,
this is exactly what I'm saying - you cannot insert PHPRunner buttons into header and need to do it your own way i.e. inserting buttons as HTML code.
I'm not quite sure I follow your question here. It's hard to understand how button that performs a set of certain actions on the list page is related to something in "BeforeSQLQuery" event. Do you need to process records or to modify the SQL Query that retrieves data? Two different tasks they are.
PS. Hard to tell what might be wrong with that specific button without seeing the code. If you need more help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

T
Tricause author 11/4/2011



Jake,
this is exactly what I'm saying - you cannot insert PHPRunner buttons into header and need to do it your own way i.e. inserting buttons as HTML code.
I'm not quite sure I follow your question here. It's hard to understand how button that performs a set of certain actions on the list page is related to something in "BeforeSQLQuery" event. Do you need to process records or to modify the SQL Query that retrieves data? Two different tasks they are.
PS. Hard to tell what might be wrong with that specific button without seeing the code. If you need more help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Sergey,
Thanks for the response.
The "BeforeSQLQuery" event I have filters which records the user can and cannot see and these records populate the list page output. The button itself is located on the list page and the selected records (selected by the user through the check-boxes) will be sent through some server-side algorithm in the button; the user can only selected the records that are listed as a result of the modified query in the "BeforeSQLQuery" event. This is the only way the two are they are related.
I intend to have this across multiple tables such that each page will first be filtered by the "BeforeSQLQuery" and the records the user selects will be passed through a URL to some other portal through the button. I was interested in applying this across multiple pages to prevent myself from manually updating the pages each time the master code is updated.
Thank you.

Sergey Kornilov admin 11/4/2011

This is what what I assumed and it makes total sense.
To reiterate - why do you think this approach (custom button in header file) won't be the answer to your problem?

T
Tricause author 11/4/2011



To reiterate - why do you think this approach (custom button in header file) won't be the answer to your problem?


It can solve the problem with my button needing to be on all pages, but will also add it to unnecessary pages as well, since I only want it to appear on "list" pages.
More important, for example, is that I want modify the queries before the output on all pages and since I cannot reference the where clause of the SQL query in the header, I am at a loss as to how to make these events happen across all list pages so that I can still reference variables in the scope of a particular event (e.g. where clause in BeforeSQLProcess, strTableName in AfterTableInit, etc.). Shortly put, I want to utilize the events native to the GUI, but for 30+ tables, editing all the events pages gets rather tedious, and, again, using the header page as a one-stop solution would be a bit problematic in referencing variables in the scopes of these events.
Thank you.

Sergey Kornilov admin 11/4/2011

In header.php file you can find the page URL and only display the button when URL contains "_list.php".
To pass variables between events and other PHP code you can use session variables. Besides that, since header.php is executed in the context of the list page you have access to all table variables. Sample header file:

<?php
global $strTableName;

echo $strTableName;
?>
T
Tricause author 11/4/2011

I see -- thank you very much. I'm not so familiar with HTML so please forgive my questioning. I'll be able to do what I need now.