Module: Thredded::UserPermissions::Read::All

Extended by:
ActiveSupport::Concern
Included in:
NullUser, Thredded::UserExtender
Defined in:
app/models/thredded/user_permissions/read/all.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#thredded_can_read_messageboard?(messageboard) ⇒ Boolean

Returns Whether the user can read the given messageboard.

Parameters:

Returns:

  • (Boolean)

    Whether the user can read the given messageboard.


17
18
19
20
# File 'app/models/thredded/user_permissions/read/all.rb', line 17

def thredded_can_read_messageboard?(messageboard)
  scope = thredded_can_read_messageboards
  scope == Thredded::Messageboard.all || scope.include?(messageboard)
end

#thredded_can_read_messageboardsActiveRecord::Relation<Thredded::Messageboard>

Returns messageboards that the user can read.

Returns:


11
12
13
# File 'app/models/thredded/user_permissions/read/all.rb', line 11

def thredded_can_read_messageboards
  Thredded::Messageboard.all
end