Page 1 of 1

Allow Read Only Access Without Having to Login?

PostPosted: Sun May 22, 2011 1:06 pm
by rhc
I have 3 custom permissions roles set up and working fine. However I would like to give "the world" read only access to application without having to login. Is there some way to do this? Even if its something like passing the readonly userid and password as parameters in the hyperlink someone clicks on, on a different web page?

thanks in advance for your help.

Re: Allow Read Only Access Without Having to Login?

PostPosted: Sun May 22, 2011 1:26 pm
by PaulR
Hi rhc,

I wanted to do exactly the same thing a couple of days ago - the answer is in this thread (you need to use delegate classes for each table):

viewtopic.php?f=4&t=6047

My table 'SITE_RECORDS' has a file SITE_RECORDS.php that looks like this:

Code: Select all
class tables_SITE_RECORDS{

     function getPermissions(&$record){
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if ( !isset($user) ) return Dataface_PermissionsTool::READ_ONLY();
             // 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.
      }
    
}

?>



Paul

EDIT: Note the comment is wrong (I copied it from the wiki), it gives READ_ONLY access not NO_ACCESS.