Authentication not working

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

Authentication not working

Postby Dataguru » Tue Feb 21, 2012 5:05 pm

I added the _auth specs to my config.ini
Code: Select all
[_auth]
users_table = mytablename
username_column = myunfieldname
password_column = mypwfieldname


in the staff table created an ENUM field populated with the built in roles from the xataface/permissions.ini file
added my username and login info and made my role MANAGER.

copied and pasted the code into from the tutorial tar.gz file as per the tutorial
/conf/ApplicationDelegate.php
Code: Select all
<?
/**
* A delegate class for the entire application to handle custom handling of
* some functions such as permissions and preferences.
*/
class conf_ApplicationDelegate {
    /**
     * Returns permissions array.  This method is called every time an action is
     * performed to make sure that the user has permission to perform the action.
     * @param record A Dataface_Record object (may be null) against which we check
     *               permissions.
     * @see Dataface_PermissionsTool
     * @see Dataface_AuthenticationTool
     */
     function getPermissions(&$record){
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
             // if the user is null then nobody is logged in... no access.
             // This will force a login prompt.
         $role = $user->val('Role');
         return Dataface_PermissionsTool::getRolePermissions($role);
             // Returns all of the permissions for the user's current role.
      }
}
?>


when I hit the site, it displays part of the code in the ApplicationDelegate php file and nothing else:
Code: Select all
getLoggedInUser(); if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS(); // if the user is null then nobody is logged in... no access. // This will force a login prompt. $role = $user->val('Role'); return Dataface_PermissionsTool::getRolePermissions($role); // Returns all of the permissions for the user's current role. } } ?>


is it a php issue with -> ?
our PHP version is 5.3.3 running on Apache/2.2.3 (Red Hat)

Thanks,
Betty
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby samhans » Tue Feb 21, 2012 11:36 pm

hai friend;

the problem is with your application delegate class

can you give me the fieldname in users table you have specified

--samhans
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: Authentication not working

Postby samhans » Tue Feb 21, 2012 11:38 pm

hai friend ;
what i noticed that you have named the conf.ini file as config.ini . If it is true then change it to conf.ini

hope it help you
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: Authentication not working

Postby ADobkin » Wed Feb 22, 2012 3:13 am

It may be an issue with the short open tag in your ApplicationDelegate.php file. Try replacing the first line with:

Code: Select all
<?php
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: Authentication not working

Postby Dataguru » Wed Feb 22, 2012 7:58 am

sam: a typo here on my part. it is conf.ini on my site.

Steve... that worked!

permissions appear to be working. I've tested Read only and manager so far.

When I login with manager permissions I see 3 options on the control panel.
Migrations
Output cache
Build Search Index

output cache returns a blank page.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby Dataguru » Wed Feb 22, 2012 8:24 am

wow. logged in manager role. returned to the index from the control panel and now i'm getting just a white screen with no html at all in it. That can't be good. lol

cleared the files in /templates_c/dataface
removed /conf/ApplicationDelegate.php

still getting a white screen.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby Dataguru » Wed Feb 22, 2012 8:45 am

from the browser I also ran
/xataface/actions/clear_cache.php
/xataface/actions/clear_views.php

still getting a white screen.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby samhans » Wed Feb 22, 2012 9:09 am

exactly what you want to say. you can't able.to get the table view or something else
samhans
 
Posts: 96
Joined: Fri Feb 10, 2012 1:22 am

Re: Authentication not working

Postby shannah » Wed Feb 22, 2012 10:10 am

If you're getting a white screen, then there is an error. It will be reported in your error log. Check the error log.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Authentication not working

Postby Dataguru » Wed Feb 22, 2012 12:03 pm

I checked the log and didn't see an error. Went and did something else for a while and just refreshed again and it's happy now.
Could it be related to sessions?

I'm going to try adding the permissions code again.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby shannah » Wed Feb 22, 2012 12:23 pm

If you get a blank page and there's no error listing, then you need to check that the errors are be logged where you think they are.
http://xataface.com/wiki/Troubleshooting
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Authentication not working

Postby Dataguru » Thu Feb 23, 2012 9:14 am

I just checked the php.ini file and indeed <? is turned off.
could that setting be messing with any of the xataface code elsewhere?

I also turned on displaying errors per your link and embedded the code in index.php to display them.
The reason I ask is that I was attempting to use delegate classes to create a custom title for records and even if I replace the initial <? with <?php, it's still not working. I turned on display errors and none are being thrown. (verified that by checking the error log).

<?php
class tables_ProgObj {

function getTitle(&$record){
return $record->val('ObjectiveNo');
}

function titleColumn(){
return "CONCAT('Objective #', ObjectiveNo)";
}
}

?>
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby shannah » Thu Feb 23, 2012 10:51 am

That's a red herring. Xataface should work fine with standard php open tags. Do you get this white screen on every page load or only when you save something.

Before digging into the actual problem you should verify that errors do get reported. Make a simple PHP script that contains obvious errors and try to run it. Then check the error log to see if they show up. Make changes until you can get errors to show up in your error log, then you can try to debug the problem at hand.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Authentication not working

Postby Dataguru » Thu Feb 23, 2012 12:16 pm

That white screen issue yesterday magically resolved itself. I spent a couple of hours doing something else, came back and everything was working fine.

I believe I have it set up correctly now to display errors on the screen.
Added php_flag display_errors on to .htaccess
And added
error_reporting(E_ALL);
ini_set('display_errors', 'on');
to my index.php file

I just intentionally generated a php error and it did show up on the screen, however, it's not in the httpd log. I'm checking with my sysadmin to see where php errors are being logged.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am

Re: Authentication not working

Postby Dataguru » Thu Feb 23, 2012 2:59 pm

I think I had two things going on.
1) the file should have been named after the table
2) the default permissions weren't set to execute.
Dataguru
 
Posts: 27
Joined: Mon Feb 20, 2012 8:12 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 13 guests

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