0

I'm using forem as forum engine and have it attached to my User model.

As part of my User model, I have "experts" and "novices" as the two different types of users.

If I only want to show the "expert" forum to "expert" users, what is the best way to control this access within forem?

dmt2989
  • 1,610
  • 3
  • 17
  • 30

1 Answers1

1

You could try to modify the view under app/views/forem/forums/_forum.html.erb, enclosing all with this:

<% if forem_user.expert? %>
  ...
<% end %>

Note: if you don't have the forem views, you have to generate them with rails g forem:views.

Cheers!

EDIT:

The last version of Forem allows to redefine methods for permissions in your User model.

https://github.com/radar/forem/wiki/Authorization-System

So, in your case, you'd define the method can_read_forem_forum?(forum) and return true if the user is expert.

dalvallana
  • 469
  • 6
  • 13