2011-01-14 12:16:25 -05:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
|
|
2010-09-16 10:28:07 -04:00
|
|
|
/* Authors:
|
|
|
|
|
* Pavel Zuna <pzuna@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
|
*
|
2010-12-09 13:59:11 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
2010-09-16 10:28:07 -04:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2010-12-09 13:59:11 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-09-16 10:28:07 -04:00
|
|
|
*/
|
|
|
|
|
|
2011-11-02 12:21:39 -05:00
|
|
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
|
2010-09-16 10:28:07 -04:00
|
|
|
|
2012-03-28 17:53:17 +02:00
|
|
|
IPA.netgroup = {
|
|
|
|
|
remove_method_priority: IPA.config.default_priority - 1,
|
|
|
|
|
enable_priority: IPA.config.default_priority + 1
|
|
|
|
|
};
|
2011-05-13 20:05:35 -05:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.netgroup.entity = function(spec) {
|
|
|
|
|
|
|
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2012-03-28 17:53:17 +02:00
|
|
|
that.builder.facet_groups(['settings', 'member', 'memberof']).
|
|
|
|
|
search_facet({
|
2011-09-16 18:21:41 -05:00
|
|
|
columns: [
|
2011-05-13 20:05:35 -05:00
|
|
|
'cn',
|
|
|
|
|
'description'
|
|
|
|
|
]
|
|
|
|
|
}).
|
|
|
|
|
details_facet({
|
2012-03-28 17:53:17 +02:00
|
|
|
factory: IPA.netgroup.details_facet,
|
|
|
|
|
entity: that,
|
|
|
|
|
command_mode: 'info'
|
2011-05-13 20:05:35 -05:00
|
|
|
}).
|
2011-03-18 16:43:54 -04:00
|
|
|
association_facet({
|
|
|
|
|
name: 'memberof_netgroup',
|
|
|
|
|
associator: IPA.serial_associator
|
|
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
standard_association_facets().
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-09-16 18:21:41 -05:00
|
|
|
fields: [
|
2011-05-13 20:05:35 -05:00
|
|
|
'cn',
|
2011-09-16 18:21:41 -05:00
|
|
|
{
|
2011-11-29 14:29:51 +01:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
|
}
|
2011-05-13 20:05:35 -05:00
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
2011-01-19 21:10:18 -05:00
|
|
|
};
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2012-03-28 17:53:17 +02:00
|
|
|
IPA.netgroup.details_facet = function(spec) {
|
|
|
|
|
|
|
|
|
|
var entity_name = spec.entity.name;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Identity
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
spec.fields = [
|
|
|
|
|
{
|
|
|
|
|
name: 'cn',
|
|
|
|
|
widget: 'identity.cn'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'textarea',
|
|
|
|
|
name: 'description',
|
|
|
|
|
widget: 'identity.description'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'nisdomainname',
|
|
|
|
|
widget: 'identity.nisdomainname'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
spec.widgets = [
|
|
|
|
|
{
|
|
|
|
|
type: 'details_table_section',
|
|
|
|
|
name: 'identity',
|
|
|
|
|
label: IPA.messages.details.general,
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
name: 'cn'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'textarea',
|
|
|
|
|
name: 'description'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'nisdomainname',
|
|
|
|
|
widget: 'general.nisdomainname'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Users
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
spec.fields.push(
|
|
|
|
|
{
|
|
|
|
|
type: 'radio',
|
|
|
|
|
name: 'usercategory',
|
|
|
|
|
widget: 'user.rule.usercategory'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
name: 'memberuser_user',
|
|
|
|
|
widget: 'user.rule.memberuser_user',
|
|
|
|
|
priority: IPA.netgroup.remove_method_priority
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
name: 'memberuser_group',
|
|
|
|
|
widget: 'user.rule.memberuser_group',
|
|
|
|
|
priority: IPA.netgroup.remove_method_priority
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
spec.widgets.push(
|
|
|
|
|
{
|
|
|
|
|
factory: IPA.collapsible_section,
|
|
|
|
|
name: 'user',
|
|
|
|
|
label: IPA.messages.objects.netgroup.user,
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
factory: IPA.rule_details_widget,
|
|
|
|
|
name: 'rule',
|
|
|
|
|
radio_name: 'usercategory',
|
|
|
|
|
options: [
|
|
|
|
|
{ value: 'all',
|
|
|
|
|
label: IPA.messages.objects.netgroup.anyone },
|
|
|
|
|
{ value: '',
|
|
|
|
|
label: IPA.messages.objects.netgroup.specified_users }
|
|
|
|
|
],
|
|
|
|
|
tables: [
|
|
|
|
|
{ name: 'memberuser_user' },
|
|
|
|
|
{ name: 'memberuser_group' }
|
|
|
|
|
],
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
id: entity_name+'-memberuser_user',
|
|
|
|
|
name: 'memberuser_user',
|
|
|
|
|
add_method: 'add_member',
|
|
|
|
|
remove_method: 'remove_member',
|
|
|
|
|
add_title: IPA.messages.association.add.member,
|
|
|
|
|
remove_title: IPA.messages.association.remove.member,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberuser_user',
|
|
|
|
|
label: IPA.messages.objects.netgroup.users
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
id: entity_name+'-memberuser_group',
|
|
|
|
|
name: 'memberuser_group',
|
|
|
|
|
add_method: 'add_member',
|
|
|
|
|
remove_method: 'remove_member',
|
|
|
|
|
add_title: IPA.messages.association.add.member,
|
|
|
|
|
remove_title: IPA.messages.association.remove.member,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberuser_group',
|
|
|
|
|
label: IPA.messages.objects.netgroup.usergroups
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Hosts
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
spec.fields.push(
|
|
|
|
|
{
|
|
|
|
|
type: 'radio',
|
|
|
|
|
name: 'hostcategory',
|
|
|
|
|
widget: 'host.rule.hostcategory'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
name: 'memberhost_host',
|
|
|
|
|
widget: 'host.rule.memberhost_host',
|
|
|
|
|
priority: IPA.netgroup.remove_method_priority,
|
|
|
|
|
external: 'externalhost'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
name: 'memberhost_hostgroup',
|
|
|
|
|
widget: 'host.rule.memberhost_hostgroup',
|
|
|
|
|
priority: IPA.netgroup.remove_method_priority
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
spec.widgets.push(
|
|
|
|
|
{
|
|
|
|
|
factory: IPA.collapsible_section,
|
|
|
|
|
name: 'host',
|
|
|
|
|
label: IPA.messages.objects.netgroup.host,
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
factory: IPA.rule_details_widget,
|
|
|
|
|
name: 'rule',
|
|
|
|
|
radio_name: 'hostcategory',
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
'value': 'all',
|
|
|
|
|
'label': IPA.messages.objects.netgroup.any_host
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'value': '',
|
|
|
|
|
'label': IPA.messages.objects.netgroup.specified_hosts
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
tables: [
|
|
|
|
|
{ 'name': 'memberhost_host' },
|
|
|
|
|
{ 'name': 'memberhost_hostgroup' }
|
|
|
|
|
],
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
id: entity_name+'-memberhost_host',
|
|
|
|
|
name: 'memberhost_host',
|
|
|
|
|
add_method: 'add_member',
|
|
|
|
|
remove_method: 'remove_member',
|
|
|
|
|
external: 'externalhost',
|
|
|
|
|
add_title: IPA.messages.association.add.member,
|
|
|
|
|
remove_title: IPA.messages.association.remove.member,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberhost_host',
|
|
|
|
|
label: IPA.messages.objects.netgroup.hosts
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'externalhost',
|
|
|
|
|
label: IPA.messages.objects.netgroup.external,
|
|
|
|
|
formatter: IPA.boolean_formatter(),
|
|
|
|
|
width: '200px'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rule_association_table',
|
|
|
|
|
id: entity_name+'-memberhost_hostgroup',
|
|
|
|
|
name: 'memberhost_hostgroup',
|
|
|
|
|
add_method: 'add_member',
|
|
|
|
|
remove_method: 'remove_member',
|
|
|
|
|
add_title: IPA.messages.association.add.member,
|
|
|
|
|
remove_title: IPA.messages.association.remove.member,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberhost_hostgroup',
|
|
|
|
|
label: IPA.messages.objects.netgroup.hostgroups
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var that = IPA.details_facet(spec);
|
|
|
|
|
|
|
|
|
|
that.update_on_success = function(data, text_status, xhr) {
|
|
|
|
|
that.refresh();
|
|
|
|
|
that.on_update.notify();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
that.update_on_error = function(xhr, text_status, error_thrown) {
|
|
|
|
|
that.refresh();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.register('netgroup', IPA.netgroup.entity);
|