Hide Databasejoin element options depending on J! groups

Mustafa_s

Member
Hi Guys,

My goal is to limit dropdown options within a Databasejoin element depending on the current logged on users group membership ID. So if the current logged in user is in group A he/she has access to some of the element options "Purchasing, Engineering, New". But if if the current logged in user is in group B he/she has access to all the element options "Closed, Purchasing, Engineering, New".

I created a a new table "DDP_Status" with the following options:

busgVIB.png


I then created a new Databasejoin element with the following options:

zCvTumr.png


I see the dropdown in my form/list/detail view, I now need help limiting the element options but I dont know the required code.

Thank you.
 
I added a new column to my table:
ojbQ1Hf.png


I then added a filter where (for registered users)
qKATYLj.png


But my form still shows ALL the dropdowns (i'm logged on using a registered user)
FlqZ65M.png


What may I be doing wrong?
 
Also tried with:

`ddp_status`.`permissions` = '4'

But that didnt work either. When I try the following in phpmyadmin it works fine returning only 1 result as it should:

SELECT * FROM `ddp_status` WHERE `permissions` = '4'
 
I think I may not be using the correct options required here.. Even if my above experiment worked I think it's only for the LIST view correct? And not for the FORM view?
 
Thanks again Troester, that worked. I was getting close lol :)

Is there a way to apply the Joins Where to a specific access level? I need to apply WHERE `ddp_status`.`permissions` = '4' to 1 access level and not all.
 
Does the "apply where to ..." not do what you need? Or do you need more than one set of permissions / access level pairings?

if you need more that one, then you'll have to create a fairly complex WHERE query using OR and AND which uses the {$my->id} placeholder (J! user id of logged on user) against the J! viewlevels and usergroups map tables.

It might be easier to do it at the PHP level, in the "eval options" (under Advanced), where you can remove an option from the display by returning false. Then you can use the JUser API, getAuthorizedViewLevels(), to establish if the uses should see a given item.

-- hugh
*+
 
Hi Hugh,

Thank you for the follow-up, I believe "eval options" as you described it would work perfectly for what I need. I'm fairly new to PHP and Fabrik. I now created a standard Dropdown element, this element has the following characteristics:

-Dropdown
--New
--Processing
--Closed

How can I use the "eval options" (under Advanced) to limit the "Closed" option to a specific J! group? Can this method be used multiple times? So Allow GroupA to see "New" and GroupB to see "Processing" ?

Since my requirements are granular the standard access options on the element aren't sufficient.

Thank you.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top