2011-01-14 11:16:25 -06:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
|
2010-09-16 09:28:07 -05:00
|
|
|
/* Authors:
|
|
|
|
* Pavel Zuna <pzuna@redhat.com>
|
2011-01-19 20:10:18 -06:00
|
|
|
* Endi Dewata <edewata@redhat.com>
|
|
|
|
* Adam Young <ayoung@redhat.com>
|
2010-09-16 09:28:07 -05:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
2010-12-09 06:59:11 -06: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 09:28:07 -05: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 06:59:11 -06:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-09-16 09:28:07 -05: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 09:28:07 -05:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.group = {};
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.group.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
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.builder.search_facet({
|
2011-09-16 18:21:41 -05:00
|
|
|
columns: [
|
|
|
|
'cn',
|
|
|
|
'gidnumber',
|
|
|
|
'description'
|
|
|
|
]
|
|
|
|
}).
|
|
|
|
details_facet({
|
|
|
|
sections: [
|
|
|
|
{
|
|
|
|
name: 'details',
|
|
|
|
fields: [
|
|
|
|
'cn',
|
|
|
|
{
|
2011-11-29 07:29:51 -06:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
},
|
|
|
|
'gidnumber'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2011-03-18 15:43:54 -05:00
|
|
|
}).
|
2011-04-07 16:14:58 -05:00
|
|
|
association_facet({
|
|
|
|
name: 'member_user',
|
2011-03-18 15:43:54 -05:00
|
|
|
columns:[
|
2011-11-18 19:47:39 -06:00
|
|
|
'uid',
|
|
|
|
'uidnumber',
|
|
|
|
'mail',
|
|
|
|
'telephonenumber',
|
|
|
|
'title'
|
2011-03-18 15:43:54 -05:00
|
|
|
],
|
|
|
|
adder_columns:[
|
|
|
|
{
|
|
|
|
name: 'cn',
|
|
|
|
width: '100px'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'uid',
|
|
|
|
primary_key: true,
|
|
|
|
width: '100px'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2011-04-07 16:14:58 -05:00
|
|
|
}).
|
2011-03-18 15:43:54 -05:00
|
|
|
association_facet({
|
2011-05-13 20:05:35 -05:00
|
|
|
name: 'memberof_group',
|
|
|
|
associator: IPA.serial_associator
|
2011-03-18 15:43:54 -05:00
|
|
|
}).
|
|
|
|
association_facet({
|
|
|
|
name: 'memberof_netgroup',
|
|
|
|
associator: IPA.serial_associator
|
|
|
|
}).
|
|
|
|
association_facet({
|
|
|
|
name: 'memberof_role',
|
|
|
|
associator: IPA.serial_associator
|
|
|
|
}).
|
2011-07-06 10:03:04 -05:00
|
|
|
association_facet({
|
|
|
|
name: 'memberof_hbacrule',
|
|
|
|
associator: IPA.serial_associator,
|
|
|
|
add_method: 'add_user',
|
|
|
|
remove_method: 'remove_user'
|
|
|
|
}).
|
|
|
|
association_facet({
|
|
|
|
name: 'memberof_sudorule',
|
|
|
|
associator: IPA.serial_associator,
|
|
|
|
add_method: 'add_user',
|
|
|
|
remove_method: 'remove_user'
|
|
|
|
}).
|
2011-03-31 14:32:29 -05:00
|
|
|
standard_association_facets().
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-10-04 11:38:08 -05:00
|
|
|
factory: IPA.group_adder_dialog,
|
2011-04-18 10:59:50 -05:00
|
|
|
fields: [
|
|
|
|
'cn',
|
2011-09-16 18:21:41 -05:00
|
|
|
{
|
2011-11-29 07:29:51 -06:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
},
|
2011-04-18 10:59:50 -05:00
|
|
|
{
|
2011-11-29 07:29:51 -06:00
|
|
|
type: 'nonposix_checkbox',
|
2011-09-14 12:36:58 -05:00
|
|
|
name: 'nonposix',
|
2011-04-18 10:59:50 -05:00
|
|
|
label: IPA.messages.objects.group.posix,
|
2011-09-14 12:36:58 -05:00
|
|
|
checked: true
|
2011-04-18 10:59:50 -05:00
|
|
|
},
|
2011-09-16 18:21:41 -05:00
|
|
|
'gidnumber'
|
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-01-14 11:16:25 -06:00
|
|
|
};
|
2011-09-14 12:36:58 -05:00
|
|
|
|
|
|
|
IPA.group_nonposix_checkbox_widget = function (spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = IPA.checkbox_widget(spec);
|
|
|
|
|
|
|
|
that.save = function() {
|
|
|
|
var value = that.checkbox_save()[0];
|
|
|
|
// convert posix into non-posix
|
|
|
|
return [!value];
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-10-04 11:38:08 -05:00
|
|
|
};
|
|
|
|
|
2011-11-29 07:29:51 -06:00
|
|
|
IPA.widget_factories['nonposix_checkbox'] = IPA.group_nonposix_checkbox_widget;
|
|
|
|
IPA.field_factories['nonposix_checkbox'] = IPA.checkbox_fields;
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.group_adder_dialog = function(spec) {
|
2011-10-04 11:38:08 -05:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-10-24 19:20:14 -05:00
|
|
|
var that = IPA.entity_adder_dialog(spec);
|
2011-10-04 11:38:08 -05:00
|
|
|
|
|
|
|
var init = function() {
|
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
var posix_field = that.fields.get_field('nonposix');
|
2011-11-29 06:34:59 -06:00
|
|
|
posix_field.widget.value_changed.attach(that.on_posix_change);
|
2011-10-04 11:38:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
that.on_posix_change = function (value) {
|
|
|
|
|
2011-11-22 10:33:09 -06:00
|
|
|
var gid_field = that.fields.get_field('gidnumber');
|
2011-11-29 06:34:59 -06:00
|
|
|
if (value[0]) {
|
2011-10-04 11:38:08 -05:00
|
|
|
gid_field.reset();
|
|
|
|
}
|
2011-11-29 06:34:59 -06:00
|
|
|
gid_field.set_enabled(!value[0]);
|
2011-10-04 11:38:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|
2011-11-02 14:07:07 -05:00
|
|
|
|
|
|
|
IPA.register('group', IPA.group.entity);
|