Sha256: 813a5964dd631ba39a58399bf0809d0411e5af20f73202293e4ba87f353d1852
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
module Thredded class PostUserPermissions attr_reader :post, :user, :user_details, :messageboard, :topic def initialize(post, user, user_details) @post = post @topic = post.topic @messageboard = post.messageboard @user = user @user_details = user_details || UserDetail.new end def manageable? created_post? end def creatable? thread_is_not_locked? && can_create_topic? end private def created_post? user.id == post.user_id end def thread_is_not_locked? !@topic.locked? end def can_create_topic? TopicUserPermissions.new(@topic, @user, @user_details).creatable? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thredded-0.0.1 | lib/thredded/post_user_permissions.rb |