Sha256: 50f4bd69da2862df3af7ecb06378159775a554beaf7b700cdd925a9c71dd2698

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'cfoundry/v2/model'
require "cfoundry/v2/helper"

module CFoundry::V2
  class Organization < Model
    extend Helper

    attribute :name, :string
    attribute :billing_enabled, :boolean
    attribute :status, :string

    to_many   :spaces
    to_many   :domains
    to_many   :users
    to_many   :managers, :as => :user
    to_many   :billing_managers, :as => :user
    to_many   :auditors, :as => :user

    to_many_support   :spaces
    to_many_support   :domains
    to_many_support   :users
    to_many_support   :managers
    to_many_support   :billing_managers
    to_many_support   :auditors

    to_one    :quota_definition

    queryable_by :name, :space_guid, :user_guid, :manager_guid,
      :billing_manager_guid, :auditor_guid

    def delete_user_from_all_roles(user)
      remove_user(user)
      remove_manager(user)
      remove_billing_manager(user)
      remove_auditor(user)

      spaces.each do |space|
        space.remove_developer(user)
        space.remove_auditor(user)
        space.remove_manager(user)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
new_cfoundry-4.9.4 lib/cfoundry/v2/organization.rb
new_cfoundry-4.9.3 lib/cfoundry/v2/organization.rb
ncfoundry-4.9.4 lib/cfoundry/v2/organization.rb
ncfoundry-4.9.3 lib/cfoundry/v2/organization.rb
ncfoundry-4.9.2 lib/cfoundry/v2/organization.rb
new_cfoundry-4.9.2 lib/cfoundry/v2/organization.rb
new_cfoundry-4.9.1 lib/cfoundry/v2/organization.rb
new_cfoundry-4.9.0 lib/cfoundry/v2/organization.rb
new_cfoundry-4.8.3 lib/cfoundry/v2/organization.rb
new_cfoundry-4.8.2 lib/cfoundry/v2/organization.rb