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:

public/javascripts/host_edit.js
if ($('[id^="#puppetclass_' + id + '_params\\["]').length > 0) return; // already loaded
var url = $(item).attr('data-url');
var data = $("[data-submit='progress_bar']").serialize();
var data = $("form").serialize();
if (url == undefined) return; // no parameters
var placeholder = $('<tr id="puppetclass_'+id+'_params_loading">'+
......
function hostgroup_changed(element) {
var host_id = $(element).attr('data-host-id');
var url = $(element).attr('data-url');
var attrs = attribute_hash(['hostgroup_id', 'compute_resource_id']);
var attrs = attribute_hash(['hostgroup_id', 'compute_resource_id', 'organization_id', 'location_id']);
if (attrs["hostgroup_id"] == undefined) attrs["hostgroup_id"] = $('#hostgroup_parent_id').attr('value');
$('#hostgroup_indicator').show();
if (!host_id){ // a new host
......
}
}
function organization_changed(element) {
var url = $(element).attr('data-url');
var data = $('form').serialize().replace('method=put', 'method=post');
$('#organization_indicator').show();
$.ajax({
type: 'post',
url: url,
data: data,
success: function(response) {
$('#organization_indicator').hide();
$('form').html(response);
onContentLoad();
},
complete: function(){
$('#organization_indicator').hide();
$('[rel="twipsy"]').tooltip();
}
})
}
function location_changed(element) {
var url = $(element).attr('data-url');
var data = $('form').serialize().replace('method=put', 'method=post');
$('#location_indicator').show();
$.ajax({
type: 'post',
url: url,
data: data,
success: function(response) {
$('#location_indicator').hide();
$('form').html(response);
onContentLoad();
},
complete: function(){
$('#location_indicator').hide();
$('[rel="twipsy"]').tooltip();
}
})
}
function subnet_selected(element){
var subnet_id = $(element).val();
if (subnet_id == '' || $('#host_ip').size() == 0) return;
......
if (subnet_contains(details[0], details[1], $('#host_ip').val()))
return;
}
var attrs = attribute_hash(["subnet_id", "host_mac"]);
var attrs = attribute_hash(["subnet_id", "host_mac", 'organization_id', 'location_id']);
$('#subnet_indicator').show();
$.ajax({
data: attrs,
......
}
function domain_selected(element){
var domain_id = $(element).val();
var attrs = attribute_hash(['domain_id', 'organization_id', 'location_id']);
var url = $(element).attr('data-url');
$.ajax({
data:'domain_id=' + domain_id,
data: attrs,
type:'post',
url: url,
success: function(request) {
......
}
function architecture_selected(element){
var architecture_id = $(element).val();
var attrs = attribute_hash(['architecture_id', 'organization_id', 'location_id']);
var url = $(element).attr('data-url');
$.ajax({
data:'architecture_id=' + architecture_id,
data: attrs,
type:'post',
url: url,
success: function(request) {
......
}
function os_selected(element){
var attrs = attribute_hash(['operatingsystem_id', 'organization_id', 'location_id']);
var os_id = $(element).val();
var url = $(element).attr('data-url');
$.ajax({
data:'operatingsystem_id=' + os_id,
data: attrs,
type:'post',
url: url,
success: function(request) {

Also available in: Unified diff