roles/permissions question
57 posts
• Page 2 of 4 • 1, 2, 3, 4
hi steve
i implemented this function "as is" and it semms that there is a problem with this line $user =& $app->getLoggedInUser(); Fatal error: Call to undefined function: getloggedinuser() in /data/mad/haschisch-online.de/www/html/df69/cdb/conf/ApplicationDelegate.php on line 15 this happens either on win and linux maybe you have an idea ?(?(?(
hi steve
i changed it to $auth ,but.. Fatal error: Call to a member function val() on a non-object in E:\schlumpp\htdocs\df6.11\cdb\conf\ApplicationDelegate.php on line 33 line 33: if ( $record and $record->val('owner') == $user->val('UserName') ) spooky isn`t it?
OK.. this is where you need to get your debugging hat on and figure out what is going on. I can give you some tips of where to look, but ultimately you're gonna have to find this one.
First... you know which line is the culprit and you know what the error is. Evidently it claims that $record is not an object - but it is also not null! So add an echo statement just before that line to see what $record is: e.g. echo "Record is $record"; exit; If it turns out to be an array, go: echo "Record is "; print_r($record);exit; Do what you have to do to prevent that line from being called if $record is not an object.
Record is Array ( [table] => datenbank )
..if I was the parser, I would approve it but unfortunately php seems to be more strict It looks like an object to me...it even looks like the right object and it contains a field 'owner', when I understood it right, that [table] => datenbank is an array of all fields of datenbank ps: a friend of mine borrowed my debugging hat and never gave it back
Ok.. this is a bit sticky.Ê Record is not an object, it is an array.. there are 2 possibilities for the cause of this.
In the spot where you are placing your debugging code, add: echo Dataface_Error::printStackTrace(); An post the output to the forum.Ê Also it would help to know what version of Dataface you are using. Thanks Steve
hi steve
I am using dataface 6.11 and the FacultyOfWidgetry-12 example (not modified) ,where i extended the course table with a field "owner". and the ApplicationDelegate.php from your last post. (system: win xampp)
the output above is printed out on the screen about 40 times!
the following is the output of the linux server where I am using dataface 6.9 (same setup as the example above)
cheers martin
I have added this to the issue tracker and submitted a patched version of Table.php.Ê Let me know how it goes.
hi steve
this is the output with the patch:
Excellent.Ê That looks right.Ê Remove the debugging code (i.e. the stack trace).ÊÊ Now, testing to see if record exists should work properly. -Steve
If I were you I'd probably be ready to give up Ê Can't believe it is giving you this much trouble. That error means: You are calling a member function on a non-object. So it is doing something like $record->val() but $record is not an object. What you have to do is, find out what $record is, and by way of an if statement, prevent that line from being executed unless $record is an object. You can also use the php is_object() function to test if it is an object, but you shouldn't need to.Ê Either $record will be null, or it will be an object (in which case you can call the val() method on it without problems).Ê It will be null if no records were found in the current query and it is just checking the permissions on the table in general.Ê Otherwise it will have a reference to the current record object.Ê There should be no in between. I have about 20 apps all running with permissions methods very similar to the one you are setting up here and they all work ok - so there is light at the end of the tunnel here.
Hi Guys
I have been following this thread with interest as I am getting the same problems as Martin using a similar application delegate class on my own application. I have kept my nose out until now as I am really not that technical but have been struggling for several weeks to secure my tables. What I am finding is that using the old Table.php ( on current release before Steve's patch) is exactly what Martin was finding from the output of 'echo "Record is.. "; print_r($record);exit;' Record is Array ( [table] => table25 ) After applying the patch I guess the output is null or no records? Record is.. (All my tables have some data in them) Further back in the thread Steve said that:- Quote Ok.. this is a bit sticky. Record is not an object, it is an array.. there are 2 possibilities for the cause of this. 1. It is a bug in dataface 2. Somewhere in your code (anywhere in your application) you have assigned some other value to that particular record.. I am not sure if this is relavent but I captured the output from echo "User is "; print_r($user);exit; Some way through the output is:- [_tables] => Array ( [table25] => table 1 [table26] => table 2 [table27] => table 3 [table28] => table 4 ) Is this related to Steve's point number 2. ? Is it the conf.ini assigning another value to the tables? Probably not but I am clutching at straws...
Can you post your current getPermissions() method that you are using... keeping your debugging code intact and also post the full output so I can take a look. On another note, I have just posted another tutorial in the documentation section that involves permissions that might be helpful.Ê It comes with source code. -Steve
57 posts
• Page 2 of 4 • 1, 2, 3, 4
Who is onlineUsers browsing this forum: No registered users and 21 guests |