Page 1 of 1

How to make an entire tab read-only?

PostPosted: Mon Oct 19, 2009 1:18 am
by lblanc
I defined an application using tabs feature in the "fields.ini' in order to make my input capture "wizard-oriented". I also defined some user roles and I'd like to make one tab read-only for a given role. Is it doable?

Thanks a lot
Lionel

PostPosted: Mon Oct 19, 2009 2:30 am
by Jean

PostPosted: Mon Oct 19, 2009 4:47 am
by lblanc
Thanks for your prompt answer Jean.
However, as far as I understand, filters apply to tables not to tabs. Do you know if we can add a permission attribute associated to a tab in the 'field.in'i?

PostPosted: Mon Oct 19, 2009 4:57 am
by Jean
Sorry Lionel,
Which tabs do you want to act upon?
Jean

PostPosted: Mon Oct 19, 2009 5:06 am
by Jean
To answer to you, you need first to identify the user. Something like this:

Code: Select all
  function getPreferences(){
        $Records =& Dataface_Table::loadTable('Records') ; // load the table named 'Records'
        $auth =& Dataface_AuthenticationTool::getInstance();
        $user =& $auth->getLoggedInUser();
        if ( $user and  $user->val('role') != 'ADMIN' ){
           return array('show_record_tabs'=>0);

        }
    return array();  // Mandatory!! getPreferences() must return array.
    }


http://xataface.com/wiki/preferences

Jean

PostPosted: Mon Oct 19, 2009 5:11 am
by lblanc
I've defined tabs for edition using these directives in the 'fields.ini':
[tab:__main__]
label = "General"
order = 0.1

I've associated some fields to these tabs like this:
[CATEGORY]
widget:label = "Category"
widget:description = "Define use-case category"
group = __main__
order = 3.1
filter = 1

And what I'd like to do is to not allow a user with a specific role to write into one specific tab; i.e. make this tab read-only. Just hiding that tab couls also be acceptable.

Hope that clarifies a bit...

PostPosted: Mon Oct 19, 2009 5:23 am
by Jean
So, Lionel, I understand well your aim. You created some fields to create new tabs ?
What about this page ? http://xataface.com/wiki/How_to_granulate_permissions_on_each_field
You can decide who can do whatever to a field...
Jean

PostPosted: Mon Oct 19, 2009 4:16 pm
by shannah
Jean is right. You can apply permissions on specific fields, but not to a tab. You can, however, achieve what you want by applying the desired permissions to each field in that tab.

-Steve

PostPosted: Tue Oct 20, 2009 12:42 am
by lblanc
Steve, Jean,

Thanks for the clarifications