2010-09-17 18:03:50 -05:00
|
|
|
/* Authors:
|
|
|
|
* Endi Sukma Dewata <edewata@redhat.com>
|
|
|
|
*
|
|
|
|
* 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-17 18:03:50 -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-17 18:03:50 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
function ipa_service() {
|
|
|
|
|
|
|
|
var that = ipa_entity({
|
|
|
|
'name': 'service'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.init = function() {
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2010-11-10 19:03:49 -06:00
|
|
|
that.create_association({
|
|
|
|
'name': 'host',
|
|
|
|
'add_method': 'add_host',
|
2010-12-02 22:12:59 -06:00
|
|
|
'remove_method': 'remove_host'
|
2010-11-10 19:03:49 -06:00
|
|
|
});
|
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var dialog = ipa_service_add_dialog({
|
2010-10-27 22:32:30 -05:00
|
|
|
'name': 'add',
|
2010-11-09 14:22:31 -06:00
|
|
|
'title': 'Add New Service'
|
2010-10-27 22:32:30 -05:00
|
|
|
});
|
2010-11-09 14:22:31 -06:00
|
|
|
that.add_dialog(dialog);
|
|
|
|
dialog.init();
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var facet = ipa_service_search_facet({
|
2010-10-27 22:32:30 -05:00
|
|
|
'name': 'search',
|
2010-11-09 14:22:31 -06:00
|
|
|
'label': 'Search'
|
2010-10-27 22:32:30 -05:00
|
|
|
});
|
2010-11-09 14:22:31 -06:00
|
|
|
that.add_facet(facet);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
facet = ipa_service_details_facet({
|
2010-10-27 22:32:30 -05:00
|
|
|
'name': 'details',
|
2010-11-09 14:22:31 -06:00
|
|
|
'label': 'Details'
|
2010-10-27 22:32:30 -05:00
|
|
|
});
|
2010-11-09 14:22:31 -06:00
|
|
|
that.add_facet(facet);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-19 23:52:33 -06:00
|
|
|
facet = ipa_service_managedby_host_facet({
|
|
|
|
'name': 'managedby_host',
|
2010-12-02 17:16:34 -06:00
|
|
|
'label': IPA.messages.association.managedby+' '+IPA.metadata['host'].label,
|
2010-11-19 23:52:33 -06:00
|
|
|
'other_entity': 'host'
|
2010-11-09 14:22:31 -06:00
|
|
|
});
|
|
|
|
that.add_facet(facet);
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.entity_init();
|
2010-11-09 14:22:31 -06:00
|
|
|
};
|
2010-10-27 22:32:30 -05:00
|
|
|
|
|
|
|
return that;
|
|
|
|
}
|
|
|
|
|
|
|
|
IPA.add_entity(ipa_service());
|
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
function ipa_service_add_dialog(spec) {
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
spec = spec || {};
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var that = ipa_add_dialog(spec);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
that.init = function() {
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.add_field(ipa_widget({
|
2010-12-06 13:51:49 -06:00
|
|
|
name: 'krbprincipalname'
|
2010-11-09 14:22:31 -06:00
|
|
|
}));
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-12-06 16:30:10 -06:00
|
|
|
// TODO: Replace with i18n label
|
2010-11-16 18:10:40 -06:00
|
|
|
that.add_field(ipa_text_widget({
|
2010-12-06 16:30:10 -06:00
|
|
|
'name': 'service',
|
|
|
|
'label': 'Service',
|
2010-11-15 11:10:55 -06:00
|
|
|
'size': 20,
|
|
|
|
'undo': false
|
|
|
|
}));
|
|
|
|
|
2010-12-06 16:30:10 -06:00
|
|
|
// TODO: Replace with i18n label
|
2010-11-16 18:10:40 -06:00
|
|
|
that.add_field(ipa_text_widget({
|
2010-11-15 11:10:55 -06:00
|
|
|
'name': 'host',
|
|
|
|
'label': 'Host Name',
|
|
|
|
'size': 40,
|
|
|
|
'undo': false
|
|
|
|
}));
|
2010-12-06 16:30:10 -06:00
|
|
|
|
|
|
|
that.add_dialog_init();
|
2010-11-09 14:22:31 -06:00
|
|
|
};
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
that.create = function() {
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var table = $('<table/>').appendTo(that.container);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var field = that.get_field('service');
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var tr = $('<tr/>').appendTo(table);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
var td = $('<td/>', {
|
|
|
|
'style': 'vertical-align: top;'
|
|
|
|
}).appendTo(tr);
|
|
|
|
td.append(field.label+': ');
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
td = $('<td/>', {
|
|
|
|
'style': 'vertical-align: top;'
|
|
|
|
}).appendTo(tr);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
var span = $('<span/>', { 'name': 'service' }).appendTo(td);
|
|
|
|
field.create(span);
|
2010-11-09 14:22:31 -06:00
|
|
|
|
|
|
|
field = that.get_field('host');
|
|
|
|
|
|
|
|
tr = $('<tr/>').appendTo(table);
|
|
|
|
|
|
|
|
td = $('<td/>', {
|
|
|
|
'style': 'vertical-align: top;'
|
|
|
|
}).appendTo(tr);
|
|
|
|
td.append(field.label+': ');
|
|
|
|
|
|
|
|
td = $('<td/>', {
|
|
|
|
'style': 'vertical-align: top;'
|
|
|
|
}).appendTo(tr);
|
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
span = $('<span/>', { 'name': 'host' }).appendTo(td);
|
|
|
|
field.create(span);
|
2010-11-09 14:22:31 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.get_record = function() {
|
|
|
|
var record = {};
|
|
|
|
|
|
|
|
var field = that.get_field('service');
|
2010-11-18 20:17:14 -06:00
|
|
|
var service = field.save()[0];
|
2010-11-09 14:22:31 -06:00
|
|
|
|
|
|
|
field = that.get_field('host');
|
2010-11-18 20:17:14 -06:00
|
|
|
var host = field.save()[0];
|
2010-09-17 18:03:50 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
record['krbprincipalname'] = service+'/'+host;
|
|
|
|
|
|
|
|
return record;
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2010-09-08 18:25:14 -05:00
|
|
|
}
|
2010-10-01 16:33:57 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
function ipa_service_search_facet(spec) {
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = ipa_search_facet(spec);
|
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
that.create_column({name:'krbprincipalname'});
|
2010-11-16 18:10:40 -06:00
|
|
|
that.search_facet_init();
|
2010-11-09 14:22:31 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
}
|
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
function ipa_service_details_facet(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = ipa_details_facet(spec);
|
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
var section = ipa_details_list_section({
|
2010-11-16 18:10:40 -06:00
|
|
|
name: 'details',
|
|
|
|
label: 'Service Details'
|
2010-11-15 11:10:55 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
2010-11-09 14:22:31 -06:00
|
|
|
|
|
|
|
section.create_field({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'krbprincipalname'
|
2010-11-09 14:22:31 -06:00
|
|
|
});
|
|
|
|
|
2010-12-06 13:51:49 -06:00
|
|
|
// TODO: Replace with i18n label
|
2010-11-09 14:22:31 -06:00
|
|
|
section.create_field({
|
|
|
|
name: 'service',
|
|
|
|
label: 'Service',
|
|
|
|
load: service_service_load
|
|
|
|
});
|
|
|
|
|
2010-12-06 13:51:49 -06:00
|
|
|
// TODO: Replace with i18n label
|
2010-11-09 14:22:31 -06:00
|
|
|
section.create_field({
|
|
|
|
name: 'host',
|
|
|
|
label: 'Host Name',
|
|
|
|
load: service_host_load
|
|
|
|
});
|
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
section = ipa_details_list_section({
|
2010-11-16 18:10:40 -06:00
|
|
|
name: 'provisioning',
|
|
|
|
label: 'Provisioning'
|
2010-11-15 11:10:55 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
section.add_field(service_provisioning_status_widget({
|
2010-11-09 14:22:31 -06:00
|
|
|
name: 'provisioning_status',
|
2010-11-16 18:10:40 -06:00
|
|
|
label: 'Status'
|
|
|
|
}));
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
section = ipa_details_list_section({
|
2010-11-16 18:10:40 -06:00
|
|
|
name: 'certificate',
|
|
|
|
label: 'Service Certificate'
|
2010-11-15 11:10:55 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
section.add_field(service_certificate_status_widget({
|
2010-11-09 14:22:31 -06:00
|
|
|
name: 'certificate_status',
|
2010-11-16 18:10:40 -06:00
|
|
|
label: 'Status'
|
|
|
|
}));
|
2010-11-09 14:22:31 -06:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.details_facet_init();
|
2010-11-09 14:22:31 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
}
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
function service_service_load(result) {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
var that = this;
|
|
|
|
|
|
|
|
$('dd', that.container).remove();
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
var dd = ipa_create_first_dd(this.name);
|
2010-11-18 20:17:14 -06:00
|
|
|
dd.appendTo(that.container);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
var krbprincipalname = result['krbprincipalname'][0];
|
|
|
|
var service = krbprincipalname.replace(/\/.*$/, '');
|
2010-11-16 18:10:40 -06:00
|
|
|
dd.append(service);
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
}
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
function service_host_load(result) {
|
|
|
|
|
|
|
|
var that = this;
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
$('dd', that.container).remove();
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
var dd = ipa_create_first_dd(this.name);
|
2010-11-18 20:17:14 -06:00
|
|
|
dd.appendTo(that.container);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
var krbprincipalname = result['krbprincipalname'][0];
|
2010-10-15 12:22:01 -05:00
|
|
|
var host = krbprincipalname.replace(/^.*\//, '').replace(/@.*$/, '');
|
2010-11-16 18:10:40 -06:00
|
|
|
dd.append(host);
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
}
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
function service_provisioning_status_widget(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = ipa_widget(spec);
|
|
|
|
|
|
|
|
that.create = function(container) {
|
|
|
|
|
|
|
|
that.widget_create(container);
|
|
|
|
|
|
|
|
var table = $('<table/>').appendTo(container);
|
|
|
|
|
|
|
|
var tr = $('<tr/>').appendTo(table);
|
|
|
|
|
|
|
|
var td = $('<td/>').appendTo(tr);
|
|
|
|
var li = $('<li/>', {
|
|
|
|
'class': 'key-status-valid'
|
|
|
|
}).appendTo(td);
|
|
|
|
|
|
|
|
td = $('<td/>').appendTo(tr);
|
|
|
|
td.append('Kerberos Key Present, Service Provisioned:');
|
|
|
|
|
|
|
|
td = $('<td/>').appendTo(tr);
|
|
|
|
|
|
|
|
$('<input/>', {
|
|
|
|
'type': 'button',
|
|
|
|
'name': 'unprovision',
|
|
|
|
'value': 'Delete Key, Unprovision'
|
|
|
|
}).appendTo(td);
|
|
|
|
|
|
|
|
tr = $('<tr/>').appendTo(table);
|
|
|
|
|
|
|
|
td = $('<td/>').appendTo(tr);
|
|
|
|
li = $('<li/>', {
|
|
|
|
'class': 'key-status-missing'
|
|
|
|
}).appendTo(td);
|
|
|
|
|
|
|
|
td = $('<td/>').appendTo(tr);
|
|
|
|
td.append('Kerberos Key Not Present');
|
|
|
|
};
|
|
|
|
|
|
|
|
that.setup = function(container) {
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.widget_setup(container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.valid = $('li.key-status-valid', that.container);
|
|
|
|
that.missing = $('li.key-status-missing', that.container);
|
|
|
|
|
|
|
|
var button = $('input[name=unprovision]', that.container);
|
|
|
|
that.unprovision_button = ipa_button({
|
|
|
|
'label': 'Delete Key, Unprovision',
|
|
|
|
'click': that.unprovision
|
|
|
|
});
|
|
|
|
button.replaceWith(that.unprovision_button);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.unprovision = function() {
|
|
|
|
|
|
|
|
var label = IPA.metadata[that.entity_name].label;
|
|
|
|
var dialog = ipa_dialog({
|
|
|
|
'title': 'Unprovisioning '+label
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.create = function() {
|
|
|
|
dialog.container.append(
|
|
|
|
'To confirm your intention to unprovision this service, '+
|
|
|
|
'click the "Unprovision" button.');
|
|
|
|
};
|
|
|
|
|
|
|
|
dialog.add_button('Unprovision', function() {
|
|
|
|
var pkey = that.result['krbprincipalname'][0];
|
|
|
|
ipa_cmd(that.entity_name+'_disable', [pkey], {},
|
|
|
|
function(data, text_status, xhr) {
|
|
|
|
set_status('missing');
|
|
|
|
dialog.close();
|
|
|
|
},
|
|
|
|
function(xhr, text_status, error_thrown) {
|
|
|
|
dialog.close();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.add_button('Cancel', function() {
|
|
|
|
dialog.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.init();
|
|
|
|
|
|
|
|
dialog.open(that.container);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.load = function(result) {
|
2010-11-16 18:10:40 -06:00
|
|
|
that.result = result;
|
|
|
|
var krblastpwdchange = result['krblastpwdchange'];
|
|
|
|
set_status(krblastpwdchange ? 'valid' : 'missing');
|
|
|
|
};
|
|
|
|
|
|
|
|
function set_status(status) {
|
|
|
|
that.valid.toggleClass('key-status-active', status == 'valid');
|
|
|
|
that.missing.toggleClass('key-status-active', status == 'missing');
|
|
|
|
|
|
|
|
that.unprovision_button.css('visibility', status == 'valid' ? 'visible' : 'hidden');
|
|
|
|
}
|
|
|
|
|
|
|
|
return that;
|
2010-10-15 12:22:01 -05:00
|
|
|
}
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
function service_certificate_status_widget(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = certificate_status_widget(spec);
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
that.entity_label = IPA.metadata[that.entity_name].label;
|
2010-10-15 12:22:01 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.get_entity_pkey = function(result) {
|
2010-10-15 23:40:38 -05:00
|
|
|
var values = result['krbprincipalname'];
|
|
|
|
return values ? values[0] : null;
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_name = function(result) {
|
|
|
|
var value = that.get_entity_pkey(result);
|
2010-10-15 23:40:38 -05:00
|
|
|
return value ? value.replace(/@.*$/, '') : null;
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_principal = function(result) {
|
|
|
|
return that.get_entity_pkey(result);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_certificate = function(result) {
|
2010-10-15 23:40:38 -05:00
|
|
|
var values = result['usercertificate'];
|
|
|
|
return values ? values[0].__base64__ : null;
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
};
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
return that;
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
}
|
2010-11-19 23:52:33 -06:00
|
|
|
|
|
|
|
function ipa_service_managedby_host_facet(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = ipa_association_facet(spec);
|
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
var column = that.create_column({
|
|
|
|
name: 'fqdn',
|
|
|
|
primary_key: true
|
|
|
|
});
|
|
|
|
|
|
|
|
column.setup = function(container, record) {
|
|
|
|
container.empty();
|
|
|
|
|
|
|
|
var value = record[column.name];
|
|
|
|
value = value ? value.toString() : '';
|
|
|
|
|
|
|
|
$('<a/>', {
|
|
|
|
'href': '#'+value,
|
|
|
|
'html': value,
|
|
|
|
'click': function (value) {
|
|
|
|
return function() {
|
|
|
|
var state = IPA.tab_state(that.other_entity);
|
|
|
|
state[that.other_entity + '-facet'] = 'details';
|
|
|
|
state[that.other_entity + '-pkey'] = value;
|
|
|
|
$.bbq.pushState(state);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}(value)
|
|
|
|
}).appendTo(container);
|
|
|
|
};
|
|
|
|
|
2010-12-06 13:51:49 -06:00
|
|
|
that.create_column({name: 'description'});
|
2010-11-19 23:52:33 -06:00
|
|
|
|
2010-12-01 14:51:39 -06:00
|
|
|
that.create_adder_column({
|
|
|
|
name: 'fqdn',
|
|
|
|
primary_key: true,
|
|
|
|
width: '100px'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_adder_column({
|
|
|
|
name: 'description',
|
|
|
|
width: '100px'
|
|
|
|
});
|
|
|
|
|
2010-11-19 23:52:33 -06:00
|
|
|
that.association_facet_init();
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
|
|
|
}
|