mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Entitlement download.
A Download link has been added to download entitlement certificates.
This commit is contained in:
parent
8f9ddb058f
commit
fc7c1cbb6a
@ -74,7 +74,7 @@ IPA.cert.parse_dn = function(dn) {
|
||||
return result;
|
||||
};
|
||||
|
||||
IPA.cert.get_dialog = function(spec) {
|
||||
IPA.cert.download_dialog = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@ -82,8 +82,9 @@ IPA.cert.get_dialog = function(spec) {
|
||||
|
||||
that.width = spec.width || 500;
|
||||
that.height = spec.height || 400;
|
||||
that.add_pem_delimiters = typeof spec.add_pem_delimiters == 'undefined' ? true : spec.add_pem_delimiters;
|
||||
|
||||
that.usercertificate = spec.usercertificate || '';
|
||||
that.certificate = spec.certificate || '';
|
||||
|
||||
that.add_button(IPA.messages.buttons.close, function() {
|
||||
that.close();
|
||||
@ -95,10 +96,15 @@ IPA.cert.get_dialog = function(spec) {
|
||||
style: 'width: 100%; height: 275px;'
|
||||
}).appendTo(that.container);
|
||||
|
||||
textarea.val(
|
||||
IPA.cert.BEGIN_CERTIFICATE+'\n'+
|
||||
that.usercertificate+'\n'+
|
||||
IPA.cert.END_CERTIFICATE);
|
||||
var certificate = that.certificate;
|
||||
|
||||
if (that.add_pem_delimiters) {
|
||||
certificate = IPA.cert.BEGIN_CERTIFICATE+'\n'+
|
||||
that.certificate+'\n'+
|
||||
IPA.cert.END_CERTIFICATE;
|
||||
}
|
||||
|
||||
textarea.val(certificate);
|
||||
};
|
||||
|
||||
return that;
|
||||
@ -675,9 +681,9 @@ IPA.cert.status_widget = function(spec) {
|
||||
title = title.replace('${entity}', that.entity_label);
|
||||
title = title.replace('${primary_key}', entity_name);
|
||||
|
||||
var dialog = IPA.cert.get_dialog({
|
||||
'title': title,
|
||||
'usercertificate': entity_certificate
|
||||
var dialog = IPA.cert.download_dialog({
|
||||
title: title,
|
||||
certificate: entity_certificate
|
||||
});
|
||||
|
||||
dialog.init();
|
||||
|
@ -274,11 +274,8 @@ IPA.dialog = function(spec) {
|
||||
var field;
|
||||
|
||||
if (field_spec instanceof Object) {
|
||||
if (field_spec.factory) {
|
||||
field = field_spec.factory(field_spec);
|
||||
} else {
|
||||
field = IPA.text_widget(field_spec);
|
||||
}
|
||||
var factory = field_spec.factory || IPA.text_widget;
|
||||
field = factory(field_spec);
|
||||
} else {
|
||||
var field_name = field_spec;
|
||||
field = IPA.text_widget({ name: field_name, undo: false });
|
||||
|
@ -56,6 +56,11 @@ IPA.entity_factories.entitle = function() {
|
||||
{
|
||||
name: 'end',
|
||||
label: 'End'
|
||||
},
|
||||
{
|
||||
factory: IPA.entitle.certificate_column,
|
||||
name: 'certificate',
|
||||
label: 'Certificate'
|
||||
}
|
||||
]
|
||||
}).
|
||||
@ -404,6 +409,36 @@ IPA.entitle.search_facet = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.entitle.certificate_column = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = IPA.column(spec);
|
||||
|
||||
that.setup = function(container, record) {
|
||||
container.empty();
|
||||
|
||||
var certificate = record[that.name];
|
||||
|
||||
$('<a/>', {
|
||||
'href': '#download',
|
||||
'html': 'Download',
|
||||
'click': function() {
|
||||
var dialog = IPA.cert.download_dialog({
|
||||
title: 'Download Certificate',
|
||||
certificate: certificate,
|
||||
add_pem_delimiters: false
|
||||
});
|
||||
dialog.init();
|
||||
dialog.open();
|
||||
return false;
|
||||
}
|
||||
}).appendTo(container);
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.entitle.certificate_dialog = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
@ -542,4 +577,4 @@ IPA.entitle.import_dialog = function(spec) {
|
||||
});
|
||||
|
||||
return that;
|
||||
};
|
||||
};
|
||||
|
@ -559,42 +559,43 @@ IPA.entity_builder = function(){
|
||||
}
|
||||
facet.add_section(current_section);
|
||||
var fields = spec.fields;
|
||||
if (fields){
|
||||
var i;
|
||||
var field;
|
||||
for (i =0; i < fields.length; i += 1){
|
||||
field = fields[i];
|
||||
if (field instanceof Object){
|
||||
field.entity_name = entity.name;
|
||||
current_section.add_field(field.factory(field));
|
||||
}else{
|
||||
if (fields) {
|
||||
for (var i=0; i<fields.length; i++) {
|
||||
var field_spec = fields[i];
|
||||
var field;
|
||||
|
||||
if (field_spec instanceof Object) {
|
||||
field_spec.entity_name = entity.name;
|
||||
var factory = field_spec.factory || IPA.text_widget;
|
||||
field = factory(field_spec);
|
||||
} else {
|
||||
field = IPA.text_widget({
|
||||
name:field,
|
||||
entity_name:entity.name
|
||||
name: field_spec,
|
||||
entity_name: entity.name
|
||||
});
|
||||
current_section.add_field(field);
|
||||
}
|
||||
current_section.add_field(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
that.entity = function(spec) {
|
||||
if (spec instanceof Object){
|
||||
if (spec instanceof Object) {
|
||||
var factory = spec.factory || IPA.entity;
|
||||
entity = factory(spec);
|
||||
} else {
|
||||
var name = spec;
|
||||
entity = IPA.entity({name: name});
|
||||
entity = IPA.entity({ name: spec });
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
that.dialog = function(spec) {
|
||||
var dialog;
|
||||
if (spec.factory) {
|
||||
dialog = spec.factory(spec);
|
||||
if (spec instanceof Object){
|
||||
var factory = spec.factory || IPA.dialog;
|
||||
dialog = factory(spec);
|
||||
} else {
|
||||
dialog = IPA.dialog(spec);
|
||||
dialog = IPA.dialog({ name: spec });
|
||||
}
|
||||
entity.dialog(dialog);
|
||||
return that;
|
||||
|
@ -414,13 +414,16 @@ IPA.search_facet = function(spec) {
|
||||
|
||||
var columns = spec.columns || [];
|
||||
for (var i=0; i<columns.length; i++) {
|
||||
var column = columns[i];
|
||||
if (column instanceof Object) {
|
||||
var factory = column.factory || IPA.column;
|
||||
that.add_column(factory(column));
|
||||
var column_spec = columns[i];
|
||||
var column;
|
||||
|
||||
if (column_spec instanceof Object) {
|
||||
var factory = column_spec.factory || IPA.column;
|
||||
column = factory(column_spec);
|
||||
} else {
|
||||
that.create_column({ name: column });
|
||||
column = IPA.column({ name: column_spec });
|
||||
}
|
||||
that.add_column(column);
|
||||
}
|
||||
|
||||
return that;
|
||||
|
@ -1007,14 +1007,12 @@ IPA.column = function (spec) {
|
||||
|
||||
var that = {};
|
||||
|
||||
if (spec.format){
|
||||
that.format = spec.format;
|
||||
}
|
||||
that.name = spec.name;
|
||||
that.label = spec.label;
|
||||
that.primary_key = spec.primary_key;
|
||||
that.width = spec.width;
|
||||
that.entity_name = spec.entity_name;
|
||||
that.format = spec.format;
|
||||
|
||||
that.setup = spec.setup || setup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user