How to make an entire tab read-only?

A place for users and developers of the Xataface to discuss and receive support.

How to make an entire tab read-only?

Postby lblanc » Mon Oct 19, 2009 1:18 am

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
lblanc
 
Posts: 9
Joined: Mon Dec 08, 2008 7:07 am

Postby Jean » Mon Oct 19, 2009 2:30 am

Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby lblanc » Mon Oct 19, 2009 4:47 am

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?
lblanc
 
Posts: 9
Joined: Mon Dec 08, 2008 7:07 am

Postby Jean » Mon Oct 19, 2009 4:57 am

Sorry Lionel,
Which tabs do you want to act upon?
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby Jean » Mon Oct 19, 2009 5:06 am

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
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby lblanc » Mon Oct 19, 2009 5:11 am

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...
lblanc
 
Posts: 9
Joined: Mon Dec 08, 2008 7:07 am

Postby Jean » Mon Oct 19, 2009 5:23 am

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
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby shannah » Mon Oct 19, 2009 4:16 pm

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby lblanc » Tue Oct 20, 2009 12:42 am

Steve, Jean,

Thanks for the clarifications
lblanc
 
Posts: 9
Joined: Mon Dec 08, 2008 7:07 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved