Not entirely sure where this bug is coming from... but a couple of tips:
1. If you are using PHP 4, your getUser method should return a reference:
e.g.
- Code: Select all
function &getUser(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
return $user;
}
(note the prepended '&' to the method definition).
Otherwise it will be making a lot of unnecessary copies of the $user object and it will slow down your code. (in PHP 5 this would be fine).
Second your permissions method should handle the case where $usager is null (which occurs when no users are logged in).
e.g.
- Code: Select all
function date_demande__permissions(&$record){
$usager =$this->getUser($record);
if ( !$usager ) return Dataface_PermissionsTool::READ_ONLY();
if ( $usager->val('identifiant')=='demande' ){
return Dataface_PermissionsTool::ALL();
} elseif ($usager->val('identifiant')=='admin'){
return Dataface_PermissionsTool::ALL();
}
else {
return Dataface_PermissionsTool::READ_ONLY();
}
}
However I'm not sure that this will fix the warning message. There may be a bug that I have to track down. You can help by adding the following to the beginning of the edit() method of PermissionsTool.
- Code: Select all
if ( !$perms ) echo Dataface_Error::printStackTrace();
This will just print a stacktace if there are no permissions passed to help us figure out where this is happening.
I'll see about dusting off the 0.7.1 release to find out where the bug lies (the frustrating thing is that I have likely fixed this bug long ago for the current release, but didn't document it for the 0.7.1 release
)
-Steve