find form viewing records depending on logged in user
Archived from the Xataface Users forum.
PolderBoy — Thu Apr 15, 2010 8:11 am
Hello All,
On my find form the colum ‘Betaald_NLE’ should only be viewable by 1 role ‘Boss’
So I made the next function:
- Code: Select all
function Betaald_NLE__permissions(&$record) { $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); $role = $user->val('Role'); if ($role == "Boss") { return array('find' => 1); exit; } else { return array('find' => 0); exit; } }
But this doesn’t work. Everybody can view and fill in the pull down and find records.
In fields..ini I have:
[Betaald_NLE]
group=Status_info
widget:type = select
vocabulary = Betaald_NLE_Vocabulary
visibility:list = hidden
visibility:browse = hidden
Could somebody please help me?
PolderBoy.
shannah — Tue May 04, 2010 9:12 am
The column permissions don’t currently support fine-grained access on find. An approach that would work is to programmatically override the fields.ini directives for the field in the init() method of the delegate class for that table.
- Code: Select all
function init(&$table){ $fld =& $table->getField('Betaald_NLE'); $fld['visibility']['find'] = 0; }