SOLVED: Conditionally show a field with autoform based on Roles


#1

I’m trying to prototype out a quick user profile screen for people to update their info. But I only need some of the fields to be displayed based on the users role (using the meteor-roles package). Is it possible to use a function in the autoform.omit object in Simple Schema?

{
    autoform: {
        omit: function()
          return Roles.userIsInRole(Meteor.userId(), ['admin','staff']);
        }
}

So in other words I want to omit the field in an autoform IF the user is in the Admin or Staff roles. Is this possible?

EDIT: I solved this using a helper in the template. Instead of listing the fields I wanted to omit in the autoForm tag I simply had a helper produce the list based on my criteria.