Wednesday, November 14, 2012

xataface fix for users being able to edit their roles

 in users.php

<?
function isAdmin(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and $user->val('Role') == 'ADMIN')  return true;
    return false;
}
class tables_users {




    function role__permissions(&$record){
        if (!isAdmin() ) return array('edit'=>0);
       return null;
    }
}
?>

No comments: