This topic is locked

Using security in application

7/2/2012 10:13:50 AM
PHPRunner General questions
D
dodgebros author

I am trying to add security to my application. I have created a users table and added a user_id column to my project's main table. Do I need to create a link between these two tables for this to work?
Thanks,

TD

Sergey Kornilov admin 7/2/2012

You need to explain what 'add security' means. There are many different security options in PHPRunner to choose from.

D
dodgebros author 7/2/2012



You need to explain what 'add security' means. There are many different security options in PHPRunner to choose from.



Sure, used the "Database" option plus "Dynamic permissions" option. I created a users table with the following fields: pid, username, password, and fullname. In the projects table (my main table for this app) I added a user_id field. My question is do I need to create a relationship, ie link, between the users.pid field and the projects.user_id field?
HTH,

TD

Sergey Kornilov admin 7/2/2012

This doesn't make much sense. It doesn't explain what you trying to achieve.
What sort of security you trying to implement? How it supposed to work?

D
dodgebros author 7/2/2012



This doesn't make much sense. It doesn't explain what you trying to achieve.
What sort of security you trying to implement? How it supposed to work?


The "Database" option as shown in the phprunner 6.1 manual on pages 123, 124.


Page 131 of the same manual shows the tables I am referring to when I ask if there needs to be primary key - foreign key link created in the MySQL database between these two tables.


Does this help? If not I'll withdraw the question...
TD

Sergey Kornilov admin 7/3/2012

What exactly you trying to implement in your project? How it supposed to work?

D
dodgebros author 7/3/2012



What exactly you trying to implement in your project? How it supposed to work?



I am trying to set it up so a user can add/edit/delete only their own records. Would love to see a sample app with this setup.
Thanks for trying to help,

TD

E
electromotive 7/4/2012



I am trying to set it up so a user can add/edit/delete only their own records. Would love to see a sample app with this setup.
Thanks for trying to help,

TD



For this option to work, the user_id has to be in the table you are securing, there are no hidden or magical properties in the database. Then in the security tab > advanced, select the table, choose "see and edit their own data only", choose the field which represents the user_id. When the record gets created you have to include the users id - several ways to do that, some of them automatic. Suggest you use $_SESSION["UserID"], as described in Help. That's it. Don't be intimidated, its really easy. PHPR takes care of everything else for you! If you provide some specifics, such as the names of the tables and fields involved some kind forum soul will surely tell you exactly what you need to do if it doesn't already make sense.