hai Steve and all,
i can't able to add a new fields in my table demand.
when i add a field and clicks on the demand table . error pops up saying it can't find the field specified. but actualy the field is there.
my demand .php is below:
<?php
class tables_demand {
// here permission of demand table is set for demande and approver,admin is by default
function getPermissions(&$record){
//if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
$auth =&Dataface_AuthenticationTool::getInstance();
$user =& $auth ->getLoggedInUser();
if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
if ( isAdmin() ) return Dataface_PermissionsTool::ALL();
$role = $user->val('Role');
if($user->val('Role') == 'DEMANDE' ) return Dataface_PermissionsTool::getRolePermissions($role);
if($user->val('Role') == 'APPROVER' ) return Dataface_PermissionsTool::getRolePermissions($role);
if($user->val('Role') == 'LOAN INCHARGE' ) return Dataface_PermissionsTool::getRolePermissions($role);
//if ( isAdmin() ) return Dataface_PermissionsTool::ALL();
return Dataface_PermissionsTool::NO_ACCESS();
}
//this create the role column in demand table,this is a grafted column.
function __sql__(){
$user_id = getcurrentUsername();
return "select demand.*,if(owner_id='".addslashes($user_id)."','owner',if(approver='".addslashes($user_id)."','approver', null)) as role from demand";
}
function init(&$table){
$user = getUser();
if($user and $user->val('Role')!='ADMIN'){
$table->setSecurityFilter(array('role'=>'>'));
}return array();
}
// field level permission starts from here.
function sec_commander__permissions(&$record) {
$auth = & Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
$role = $user->val('Role');
if(isAdmin()){
return Dataface_PermissionsTool::ALL();
} elseif($user->val('Role') == 'APPROVER' ) {
return Dataface_PermissionsTool::getRolePermissions($role);
} else return Dataface_PermissionsTool::NO_ACCESS();
}
}
moreover i have created a grafted field role. when i delete it every thing runs fine
please help.