Welcome Guest, Not a member yet? Register   Sign In
Relationship Mapping between Users and Data, like OpenSourceFood.com
#1

[eluser]Unknown[/eluser]
I am working on my first test application using the CI framework, based in general concept on Yong Fook's opensourcefood.com, which is a CodeIgniter application. The relationship is one to many, like OSF's users submitting many recipes. I asked nicely of Yong Fook for examples, a link or book to where he learned from, or code samples so I could learn, but he declined to help.

My basic issue at this point is where to look for good guidance, tutorials and examples of mapping users to data using CI, at each end, MV&C. I have installed and customized FreakAuth as a starting point for getting user's registered and am currently looking to modify their profiles with the linkages to data they submit but don't know where to go...

Help, please!
#2

[eluser]obiron2[/eluser]
firstly, well done on building security in as part of the design, It is a pain to retrofit it.

Personally, I create my own user tables that have a 1:1 relationship with the Freakauth user table. I do this for two reasons. 1) I don't like touching other peoples code and tables and 2) I will have 'users' who are not registered on the site (i.e. I will need to hold information about folks who have never visited the site, but have been added by league administrators)

For any controller that grants view access to restricted pages, you will need to build validation rules to check that the user is A) logged in, B) has the correct permissions to access that part of the site (e.g. admin pages) and C) has access to the specific area (e.g. receipe X admin)

In terms of database relationships, look for normalisation rules in your favorite search enginebut for ease of logic regard you want to build a separate table for each enitity (e.g. user, receipe) but also for each logical 1:many relationship.
A user can have many receipes = table for users, table for receipes
A receipe can have many ingredients AND An ingredient can be in many receipes= table for recepies, table for ingredients AND
new table to link recepies to ingredients




Theme © iAndrew 2016 - Forum software by © MyBB