Page 1 of 1

Permissions [SOLVED]

PostPosted: Wed Sep 01, 2010 4:49 pm
by cantlep
Hi Steve,

If i've given a user some perms in permissions.ini (in this instance i've extended READ ONLY to allow some writing (similar to EDIT but a few less perms)) Is there a way I can stop them writing to a particular table?

i.e. A user called User1 has (for this example) EDIT permissions. They can edit all tables by default...but I don't want them to be able to create new users so I want to restrict their access to the User table to READ ONLY (this way, at least they can still view their profile, etc).

Any ideas?

Just found this: - http://xataface.com/wiki/fieldname__permissions Is this what I need to be using?

Thanks

Paul

Re: Permissions

PostPosted: Thu Sep 02, 2010 9:22 am
by cantlep
I've accomplished it with this in the table delegate class for "Users"
Code: Select all
//Restrict Non-admin users to read only on the Users table
function getPermissions(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and  $user->val('Role') != 'ADMIN' ){
    return Dataface_PermissionsTool::READ_ONLY();
}
}