Suppose you have a column in each record that records the username of the owner, called 'owner'.
Then in your delegate class:
- Code: Select all
function getPermissions(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $record and $user and $record->val('owner') == $user->val('username') ){
return Dataface_PermissionsTool::ALL();
}
return Dataface_PermissionsTool::NO_ACCESS();
}
Unfortunately in list view it will still show all records, it will just say "NO ACCESS" to the records that you don't have access to.
You can correct this by adding a security filter.
In your delegate class:
- Code: Select all
function init(&$table){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user ){
$table->setSecurityFilter(array('owner'=>'='.$user->val('username')));
}
}