Sha256: 00bf1df5db88b15fbeb5c5f01e188c84aedd29c3c06f2700139a3454c3aba015

Contents?: true

Size: 573 Bytes

Versions: 10

Compression:

Stored size: 573 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)
      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

10 entries across 10 versions & 1 rubygems

Version Path
orange-0.2.8 lib/orange-more/administration/cartons/user.rb
orange-0.2.7 lib/orange-more/administration/cartons/user.rb
orange-0.2.6 lib/orange-more/administration/cartons/user.rb
orange-0.2.5 lib/orange-more/administration/cartons/user.rb
orange-0.2.4 lib/orange-more/administration/cartons/user.rb
orange-0.2.3 lib/orange-more/administration/cartons/user.rb
orange-0.1.10 lib/orange-more/administration/cartons/user.rb
orange-0.1.8 lib/orange-more/administration/cartons/user.rb
orange-0.1.7 lib/orange-more/administration/cartons/user.rb
orange-0.1.4 lib/orange-more/administration/cartons/user.rb