Sha256: ee0885ed238ba8a54be3b1f80fa6d9177d145465296ddfe98ee65dcdb3e7d483
Contents?: true
Size: 798 Bytes
Versions: 10
Compression:
Stored size: 798 Bytes
Contents
module Thredded class MessageboardUserPermissions attr_reader :messageboard, :user def initialize(messageboard, user) @messageboard = messageboard @user = user end def readable? (messageboard.restricted_to_private? && messageboard.has_member?(user)) || (messageboard.restricted_to_logged_in? && user.valid?) || messageboard.public? end def postable? if messageboard.posting_for_anonymous? && (messageboard.restricted_to_private? || messageboard.restricted_to_logged_in?) false else messageboard.posting_for_anonymous? || (messageboard.posting_for_logged_in? && user.try(:valid?)) || (messageboard.posting_for_members? && messageboard.has_member?(user)) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems