Sha256: ac25234afe48057989fe4455bb916b484a384227b9503a7f752d8ab85be1153b

Contents?: true

Size: 581 Bytes

Versions: 20

Compression:

Stored size: 581 Bytes

Contents

require 'orange-core/carton'

class OrangeUser < Orange::Carton
  id
  admin do
    title :name
    text :open_id
  end
  
  has n, :orange_sites, :through => Resource
  
  def allowed?(packet)
    subsite_access = packet['subsite'].blank? ? false : self.orange_sites.first(:id => packet['subsite'].id)
    site_access = self.orange_sites.first(:id => packet['site'].id)
    if(!site_access.blank?)
      true
    elsif !packet['subsite'].blank? && subsite_access
      true
    else
      false
    end
  end
end

class OrangeSite 
  has n, :orange_users, :through => Resource
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
orange-more-0.5.8 lib/orange-more/administration/cartons/user.rb
orange-more-0.5.7 lib/orange-more/administration/cartons/user.rb
orange-0.5.5 lib/orange-more/administration/cartons/user.rb
orange-0.5.4 lib/orange-more/administration/cartons/user.rb
orange-0.5.3 lib/orange-more/administration/cartons/user.rb
orange-0.5.2 lib/orange-more/administration/cartons/user.rb
orange-0.5.1 lib/orange-more/administration/cartons/user.rb
orange-0.4.0 lib/orange-more/administration/cartons/user.rb
orange-0.3.9 lib/orange-more/administration/cartons/user.rb
orange-0.3.8 lib/orange-more/administration/cartons/user.rb
orange-0.3.7 lib/orange-more/administration/cartons/user.rb
orange-0.3.6 lib/orange-more/administration/cartons/user.rb
orange-0.3.5 lib/orange-more/administration/cartons/user.rb
orange-0.3.4 lib/orange-more/administration/cartons/user.rb
orange-0.3.3 lib/orange-more/administration/cartons/user.rb
orange-0.3.2 lib/orange-more/administration/cartons/user.rb
orange-0.3.1 lib/orange-more/administration/cartons/user.rb
orange-0.3.0 lib/orange-more/administration/cartons/user.rb
orange-0.2.11 lib/orange-more/administration/cartons/user.rb
orange-0.2.9 lib/orange-more/administration/cartons/user.rb