Page 1 of 1

Customizing or removing the Find tab

PostPosted: Wed Oct 24, 2007 3:39 am
by ADobkin
Since the fields visibility tag doesn't apply to the Find in 0.7, is there some other way to customize the fields that display here?

If not, is there a way to just remove the Find tab altogether without removing the other tabs? In other words, setting 'show_table_tabs'=>0 in getPreferences() removes too much functionality. I do want the ability to create new records and switch to list view, but I don't want to display all the fields in the table.

Thanks,
Alan

PostPosted: Wed Oct 24, 2007 7:59 am
by shannah
In your actions.ini file you can override the find action.

Code: Select all
[find]


This overrides the find action with a blank action, so that I won't be displayed anymore.

PostPosted: Wed Oct 24, 2007 8:12 am
by ADobkin
That's perfect, thanks. I hadn't created an actions.ini file yet.

Now my next question is, can this be tied to permissions, so certain users (especially admin) can still use the find tab?

PostPosted: Wed Oct 24, 2007 9:17 am
by shannah
For this you would take a different approach (i.e. undo the change to the actions.ini file).

If you look in the dataface actions.ini file you can see the full definition of the find action. I believe that the permission for this action is called 'find' also. When you are defining your getPermissions(&$record) methods in your delegate class just make sure that admins have the 'find' permission and others do not.

One convenient way to do that is to define some custom roles in your permissions.ini file with the permissions that you want.

e.g.:

Code: Select all
[REGULAR USER extends READ ONLY]
    find=0


Then in your getPermissions() method:
Code: Select all
function getPermissions(&$record){
    if ( is regular user ){
        return Dataface_PermissionsTool::getRolePermissions('REGULAR USER');
    } else if ( is admin ){
        return Dataface_PermissionsTool::ALL();
    } else {
        return Dataface_PermissionsTool::NO_ACCESS();
    }
}


or something like that.

PostPosted: Wed Oct 24, 2007 12:26 pm
by ADobkin
Thanks, that was exactly what I was looking for!