Module: Sequel::Plugins::Viewable::DatasetMethods

Defined in:
lib/cortex_reaver/support/viewable.rb

Instance Method Summary collapse

Instance Method Details

#viewable_by(user) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/cortex_reaver/support/viewable.rb', line 5

def viewable_by(user)
  if user.anonymous?
    self.exclude(:draft => true)
  elsif user.admin? or user.editor?
    self
  else
    self.exclude(:draft => true).or(:created_by => user.id)
  end
end