Page 1 of 1

Migration problem.

PostPosted: Thu Jul 01, 2010 4:38 am
by jvinolas
HI,

I created a local application and tried to make it work on domain. Changed database config, but when I point to the root of my application folder what I get is part of ApplicationDelegate.php, which is the same that it is working on my local installation. What I get in browser (as text) is this:

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'); $app =& Dataface_Application::getInstance(); $tables =& $app->_conf['_tables']; if ($role=="EDIT"){ unset($tables['resultats_classificacio']); unset($tables['users']); } return Dataface_PermissionsTool::getRolePermissions($role); // Returns all of the permissions for the user's current role. } /* function after_action_new(){ $app =& Dataface_Application::getInstance(); $query =& $app->getQuery(); $query['-action'] = 'browse'; $url = $app->url($query).'&--msg='.urlencode('Record added. You may add another record'); header("Location: $url"); exit; } */ } ?>

That is part of my ApplicationDelegate.php:

<?
/**
* 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');.......


I have other xataface applications working well in my domain, but don't know what is causing this.

Thanks.

Re: Migration problem.

PostPosted: Thu Jul 01, 2010 8:27 am
by jvinolas
Hi again,

I've disabled authentication (removed ApplicationDelegate, removed _auth from conf.ini and other authentication functions and then it works). But, what is the problem with my actual ApplicationDelegate? (it works on local but not in domain, even the database and users table is created, well backed up direcltly from my local mysql to the domain).

This is my ApplicationDelegate:

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');

        // Disables tables depending on rights.
        /*
        $app =& Dataface_Application::getInstance();
        $tables =& $app->_conf['_tables'];
        if ($role=="EDIT"){
                unset($tables['resultats_classificacio']);
                unset($tables['users']);
        }
        */

         return Dataface_PermissionsTool::getRolePermissions($role);
         // Returns all of the permissions for the user's current role.
      }
}
?>


And my conf.ini

Code: Select all
;;Configuration settings for application
title="lime_survey"

[_database]
        host="localhost"
        name="lime"
        user="XXXX"
        password="XXXXX"

[_auth]
     users_table=users
     username_column=Usuari
     password_column=Clau

[_tables]

r_dades = "Dades Alumnes"
r_classificacio = "Graf. Questionari"
resultats_classificacio = "Tipus Preguntes"
users = "Usuaris"

[_modules]
modules_DataGrid=modules/DataGrid/DataGrid.php

[languages]
en=English
ca="Catala"


Don't know what is causing this error, but it is due to rights. I will double check users table, but I'm pretty sure it is ok because I can edit it through my xataface app when authentication is disabled.

Thanks.-

Re: Migration problem.

PostPosted: Mon Jul 05, 2010 4:36 pm
by shannah
Your server doesn't have short_open_tags enabled. You need to either enable short open tags in your php.ini file or you need to change your open tags to full tags.

i.e.g
change
Code: Select all
<?

to
Code: Select all
<?php

Re: Migration problem.

PostPosted: Tue Jul 06, 2010 10:30 am
by jvinolas
It was making me crazy! Thanks a lot, now it is working as it should.