# Restrict options based on group membership

**URL:** <https://discourse.openondemand.org/t/restrict-options-based-on-group-membership/4605>\
**Category:** General Discussion\
**Created:** [October 29, 2025, 6:46pm UTC](https://discourse.openondemand.org/t/restrict-options-based-on-group-membership/4605 "2025-10-29T18:46:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![doug-oneal-nih](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/doug-oneal-nih/32/2699_2.png) [@doug-oneal-nih](https://discourse.openondemand.org/u/doug-oneal-nih)\
**Post date:** [October 29, 2025, 6:46pm UTC](https://discourse.openondemand.org/t/restrict-options-based-on-group-membership/4605/1 "2025-10-29T18:46:04Z")

</div>

In a form.erb.yml I have a dropdown selection for available partitions, looking something like this  
partition:  
`label: “Partition”`  
` widget: select`  
` options:`  
` - [‘short’, ‘short’, select_partition: ‘Partition Name’]`  
` …`  
` - [‘unlimited’, ‘unlimited’, select_partition: ‘Partition Name’]`  
` - [‘debug’, ‘debug’, select_partition: ‘Partition Name’]`  
What I want to do is hide the debug partition for everybody other than users in a particular AD group. I _think_ that the CurrentUser class defined in /var/www/ood/apps/sys/dashboard/lib/current\_user.rb will likely give the structure I need. What I’m lost on is how to modify form.yml.erb to do something like  
`<%= if CurrentUser.groups.include?(‘debugusers’) %>`  
` - [‘debug’, ‘debug’, select_partition: ‘Partition Name’]`  
` <%= endif %>`

I am getting syntax errors on all of my attempts. Where am I going wrong?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [October 30, 2025, 1:08pm UTC](https://discourse.openondemand.org/t/restrict-options-based-on-group-membership/4605/2 "2025-10-30T13:08:29Z")

</div>

Can you share your full `form.yml.erb` I can take a look.

At a glance - the `endif` portion is wrong. It should be `<% end %>` - just `end` (not endif) and no `=`.
