Project

General

Profile

« Previous | Next » 

Revision 611f5bff

Added by Amos Benari over 11 years ago

  • ID 611f5bff49c1f06ae9ad0dd42b7566df9a02af2f

Add organization and location to foreman.

This feature allows foreman to provide multi location, multi tenant and
multi organizations capablities.

the idea is that resources within foreman (e.g. hosts, subnets, users,
environments etc) can belong to one or more locations and organization,
effectivily hidding resources from users.

Organization may contain multiple locations, and Locations can belong
to multiple Organization, this is an extermily flexiable design,
however, it is up to the user to allocate the resources across the
organizations and locations.

When creating new hosts, the resources that can be consumed are only
resources in which exists in both the currently used organization and location.

fixes #1578
fixes #1593

View differences:

app/models/user.rb
class User < ActiveRecord::Base
include Authorization
include Foreman::ThreadSession::UserModel
include Taxonomix
audited :except => [:last_login_on, :password, :password_hash, :password_salt, :password_confirmation]
self.auditing_enabled = !defined?(Rake)
......
has_many :user_facts, :dependent => :destroy
has_many :facts, :through => :user_facts, :source => :fact_name
scope :except_admin, where(:admin => false)
accepts_nested_attributes_for :user_facts, :reject_if => lambda { |a| a[:criteria].blank? }, :allow_destroy => true
validates :mail, :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)*[a-z]{2,})$/i },
......
scoped_search :on => :last_login_on, :complete_value => :true
scoped_search :in => :roles, :on => :name, :rename => :role, :complete_value => true
default_scope lambda {
with_taxonomy_scope do
order('firstname')
end
}
def to_label
"#{firstname} #{lastname}"
end
......
compute_resources.any? or
domains.any? or
hostgroups.any? or
facts.any?
facts.any? or
locations.any? or
organizations.any?
end
private

Also available in: Unified diff