Multiple Users, one site [SOLVED]

A place for users and developers of the Xataface to discuss and receive support.

Multiple Users, one site [SOLVED]

Postby cantlep » Tue Aug 31, 2010 6:50 am

Hi All,

Wondering if anyone has done this before. I'm going to start a second Xataface site. This one will contain gym workout details for various users. Now, Obviously, I don't want UserA to be able to edit UserB's workout details (or even see them for that matter).

If I have a table called "Chest" (for example - to indicate body part worked on), how do I allow UserA to add in his details and only see his details...and the same for UserB, UserC, etc, etc. I guess in SQl some sort of WHERE USER = UserA needs to be in place but I'm not sure how to do it from the SQl side or the Xataface side.

I think this might work - http://xataface.com/documentation/how-t ... ty_filters but not sure if that just applies to tables "owned" by each user or if it applies to tables that need to be written to by all users.

Any thoughts?

PS: Steve - the link to the filters section needs updating as it's currently broken. Cheers

Paul
Last edited by cantlep on Wed Sep 01, 2010 8:10 am, edited 1 time in total.
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: Multiple Users, one site

Postby jhenry » Tue Aug 31, 2010 10:45 am

Paul,

Could you set it up so that each person only has access to their table for say 'Users' and then make the workouts a datagrid within that users record. If you set up the user_id for the workouts to be tied to the users the permissions should follow and only allow access to those records that belong to that person. It should follow as well that if the workouts are tied to a specific user then they should only be able to see those records assigned to them. Hope this helps.

Jason
Do not mistake understanding for realization, and do not mistake realization for liberation....Tibetan Saying.
jhenry
 
Posts: 58
Joined: Sun Jul 12, 2009 1:20 pm
Location: Florida

Re: Multiple Users, one site

Postby cantlep » Wed Sep 01, 2010 7:43 am

Cheers Jason,

i'm almost there with what I want. I've added this (as per the wiki) into ApplicationDelegate.php
Code: Select all
function getPreferences(){
    $mytable =& Dataface_Table::loadTable('WorkoutLog') ; // load the table named 'WorkoutLog'
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and  $user->val('role') != 'ADMIN' ){
    $mytable->setSecurityFilter(array('UserName'=>$user->val('UserName')));
    }
    return array();  // Mandatory!! getPreferences() must return array.
}


I just need to tweak some permissions now :-)

Thanks
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: Multiple Users, one site

Postby cantlep » Wed Sep 01, 2010 8:10 am

All sorted now :-)

Thanks
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 25 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved