mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Remove WebUI identifiers from global namespace
Many WebUI identifiers were defined in a global namespace. This is not a good programming practice and may result in name clashes, for example with other libraries. This patch moves these variables to IPA namespace or its sub-namespaces, when meaningful. https://fedorahosted.org/freeipa/ticket/212
This commit is contained in:
@@ -20,377 +20,379 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----';
|
||||
var END_CERTIFICATE = '-----END CERTIFICATE-----';
|
||||
|
||||
var BEGIN_CERTIFICATE_REQUEST = '-----BEGIN CERTIFICATE REQUEST-----';
|
||||
var END_CERTIFICATE_REQUEST = '-----END CERTIFICATE REQUEST-----';
|
||||
IPA.cert = {
|
||||
BEGIN_CERTIFICATE : '-----BEGIN CERTIFICATE-----',
|
||||
END_CERTIFICATE : '-----END CERTIFICATE-----',
|
||||
BEGIN_CERTIFICATE_REQUEST : '-----BEGIN CERTIFICATE REQUEST-----',
|
||||
END_CERTIFICATE_REQUEST : '-----END CERTIFICATE REQUEST-----',
|
||||
CRL_REASON : [
|
||||
'Unspecified',
|
||||
'Key Compromise',
|
||||
'CA Compromise',
|
||||
'Affiliation Changed',
|
||||
'Superseded',
|
||||
'Cessation of Operation',
|
||||
'Certificate Hold',
|
||||
null,
|
||||
'Remove from CRL',
|
||||
'Privilege Withdrawn',
|
||||
'AA Compromise'
|
||||
],
|
||||
CERTIFICATE_STATUS_MISSING : 0,
|
||||
CERTIFICATE_STATUS_VALID : 1,
|
||||
CERTIFICATE_STATUS_REVOKED : 2,
|
||||
|
||||
var CRL_REASON = [
|
||||
'Unspecified',
|
||||
'Key Compromise',
|
||||
'CA Compromise',
|
||||
'Affiliation Changed',
|
||||
'Superseded',
|
||||
'Cessation of Operation',
|
||||
'Certificate Hold',
|
||||
null,
|
||||
'Remove from CRL',
|
||||
'Privilege Withdrawn',
|
||||
'AA Compromise'
|
||||
];
|
||||
parse_dn : function (dn) {
|
||||
|
||||
var CERTIFICATE_STATUS_MISSING = 0;
|
||||
var CERTIFICATE_STATUS_VALID = 1;
|
||||
var CERTIFICATE_STATUS_REVOKED = 2;
|
||||
var result = {};
|
||||
if (!dn) return result;
|
||||
|
||||
function certificate_parse_dn(dn) {
|
||||
// TODO: Use proper LDAP DN parser
|
||||
var rdns = dn.split(',');
|
||||
for (var i=0; i<rdns.length; i++) {
|
||||
var rdn = rdns[i];
|
||||
if (!rdn) continue;
|
||||
|
||||
var result = {};
|
||||
if (!dn) return result;
|
||||
var parts = rdn.split('=');
|
||||
var name = $.trim(parts[0].toLowerCase());
|
||||
var value = $.trim(parts[1]);
|
||||
|
||||
// TODO: Use proper LDAP DN parser
|
||||
var rdns = dn.split(',');
|
||||
for (var i=0; i<rdns.length; i++) {
|
||||
var rdn = rdns[i];
|
||||
if (!rdn) continue;
|
||||
|
||||
var parts = rdn.split('=');
|
||||
var name = $.trim(parts[0].toLowerCase());
|
||||
var value = $.trim(parts[1]);
|
||||
|
||||
var old_value = result[name];
|
||||
if (!old_value) {
|
||||
result[name] = value;
|
||||
} else if (typeof old_value == "string") {
|
||||
result[name] = [old_value, value];
|
||||
} else {
|
||||
result[name].push(value);
|
||||
var old_value = result[name];
|
||||
if (!old_value) {
|
||||
result[name] = value;
|
||||
} else if (typeof old_value == "string") {
|
||||
result[name] = [old_value, value];
|
||||
} else {
|
||||
result[name].push(value);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
get_dialog: function (spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.usercertificate = spec.usercertificate || '';
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var textarea = $('<textarea/>', {
|
||||
readonly: 'yes',
|
||||
style: 'width: 100%; height: 275px;'
|
||||
}).appendTo(dialog);
|
||||
|
||||
textarea.val(
|
||||
IPA.cert.BEGIN_CERTIFICATE+'\n'+
|
||||
that.usercertificate+'\n'+
|
||||
IPA.cert.END_CERTIFICATE );
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 400,
|
||||
buttons: {
|
||||
'Close': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
},
|
||||
|
||||
|
||||
revoke_dialog: function (spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.revoke = spec.revoke;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var table = $('<table/>').appendTo(dialog);
|
||||
|
||||
var tr = $('<tr/>').appendTo(table);
|
||||
|
||||
var td = $('<td/>').appendTo(tr);
|
||||
td.append('Note:');
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
td.append(
|
||||
'To confirm your intention to revoke this certificate, '+
|
||||
'select a reason from the pull-down list, and click '+
|
||||
'the "Revoke" button.');
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
td.append('Reason for Revocation:');
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
|
||||
var select = $('<select/>').appendTo(td);
|
||||
for (var i=0; i<IPA.cert.CRL_REASON.length; i++) {
|
||||
if (!IPA.cert.CRL_REASON[i]) continue;
|
||||
$('<option/>', {
|
||||
'value': i,
|
||||
'html': IPA.cert.CRL_REASON[i]
|
||||
}).appendTo(select);
|
||||
}
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 300,
|
||||
buttons: {
|
||||
'Revoke': function() {
|
||||
var values = {};
|
||||
values['reason'] = select.val();
|
||||
if (that.revoke) {
|
||||
that.revoke(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
},
|
||||
|
||||
restore_dialog: function (spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.restore = spec.restore;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
dialog.append(
|
||||
'To confirm your intention to restore this certificate, '+
|
||||
'click the "Restore" button.');
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 400,
|
||||
height: 200,
|
||||
buttons: {
|
||||
'Restore': function() {
|
||||
var values = {};
|
||||
if (that.restore) {
|
||||
that.restore(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
},
|
||||
|
||||
view_dialog: function (spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.subject = IPA.cert.parse_dn(spec.subject);
|
||||
that.serial_number = spec.serial_number || '';
|
||||
that.issuer = IPA.cert.parse_dn(spec.issuer);
|
||||
that.issued_on = spec.issued_on || '';
|
||||
that.expires_on = spec.expires_on || '';
|
||||
that.md5_fingerprint = spec.md5_fingerprint || '';
|
||||
that.sha1_fingerprint = spec.sha1_fingerprint || '';
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var table = $('<table/>').appendTo(dialog);
|
||||
|
||||
var tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Issued To</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Common Name:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.cn
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organization:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.o
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organizational Unit:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.ou
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Serial Number:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.serial_number
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Issued By</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Common Name:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.cn
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organization:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.o
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organizational Unit:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.ou
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Validity</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Issued On:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issued_on
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Expires On:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.expires_on
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Fingerprints</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>SHA1 Fingerprint:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.sha1_fingerprint
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>MD5 Fingerprint:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.md5_fingerprint
|
||||
}).appendTo(tr);
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 600,
|
||||
height: 500,
|
||||
buttons: {
|
||||
'Close': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
},
|
||||
|
||||
request_dialog: function (spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.request = spec.request;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
dialog.append('Copy and paste the Base64-encoded CSR below:');
|
||||
dialog.append('<br/>');
|
||||
dialog.append('<br/>');
|
||||
|
||||
dialog.append(IPA.cert.BEGIN_CERTIFICATE_REQUEST);
|
||||
dialog.append('<br/>');
|
||||
|
||||
var textarea = $('<textarea/>', {
|
||||
style: 'width: 100%; height: 225px;'
|
||||
}).appendTo(dialog);
|
||||
|
||||
dialog.append('<br/>');
|
||||
dialog.append(IPA.cert.END_CERTIFICATE_REQUEST);
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 400,
|
||||
buttons: {
|
||||
'Issue': function() {
|
||||
var values = {};
|
||||
var request = textarea.val();
|
||||
request =
|
||||
IPA.cert.BEGIN_CERTIFICATE_REQUEST+'\n'+
|
||||
$.trim(request)+'\n'+
|
||||
IPA.cert.END_CERTIFICATE_REQUEST+'\n';
|
||||
values['request'] = request;
|
||||
if (that.request) {
|
||||
that.request(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function certificate_get_dialog(spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.usercertificate = spec.usercertificate || '';
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var textarea = $('<textarea/>', {
|
||||
readonly: 'yes',
|
||||
style: 'width: 100%; height: 275px;'
|
||||
}).appendTo(dialog);
|
||||
|
||||
textarea.val(
|
||||
BEGIN_CERTIFICATE+'\n'+
|
||||
that.usercertificate+'\n'+
|
||||
END_CERTIFICATE );
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 400,
|
||||
buttons: {
|
||||
'Close': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
function certificate_revoke_dialog(spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.revoke = spec.revoke;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var table = $('<table/>').appendTo(dialog);
|
||||
|
||||
var tr = $('<tr/>').appendTo(table);
|
||||
|
||||
var td = $('<td/>').appendTo(tr);
|
||||
td.append('Note:');
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
td.append(
|
||||
'To confirm your intention to revoke this certificate, '+
|
||||
'select a reason from the pull-down list, and click '+
|
||||
'the "Revoke" button.');
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
td.append('Reason for Revocation:');
|
||||
|
||||
td = $('<td/>').appendTo(tr);
|
||||
|
||||
var select = $('<select/>').appendTo(td);
|
||||
for (var i=0; i<CRL_REASON.length; i++) {
|
||||
if (!CRL_REASON[i]) continue;
|
||||
$('<option/>', {
|
||||
'value': i,
|
||||
'html': CRL_REASON[i]
|
||||
}).appendTo(select);
|
||||
}
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 300,
|
||||
buttons: {
|
||||
'Revoke': function() {
|
||||
var values = {};
|
||||
values['reason'] = select.val();
|
||||
if (that.revoke) {
|
||||
that.revoke(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
function certificate_restore_dialog(spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.restore = spec.restore;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
dialog.append(
|
||||
'To confirm your intention to restore this certificate, '+
|
||||
'click the "Restore" button.');
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 400,
|
||||
height: 200,
|
||||
buttons: {
|
||||
'Restore': function() {
|
||||
var values = {};
|
||||
if (that.restore) {
|
||||
that.restore(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
function certificate_view_dialog(spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.subject = certificate_parse_dn(spec.subject);
|
||||
that.serial_number = spec.serial_number || '';
|
||||
that.issuer = certificate_parse_dn(spec.issuer);
|
||||
that.issued_on = spec.issued_on || '';
|
||||
that.expires_on = spec.expires_on || '';
|
||||
that.md5_fingerprint = spec.md5_fingerprint || '';
|
||||
that.sha1_fingerprint = spec.sha1_fingerprint || '';
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
var table = $('<table/>').appendTo(dialog);
|
||||
|
||||
var tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Issued To</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Common Name:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.cn
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organization:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.o
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organizational Unit:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.subject.ou
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Serial Number:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.serial_number
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Issued By</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Common Name:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.cn
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organization:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.o
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Organizational Unit:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issuer.ou
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Validity</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Issued On:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.issued_on
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>Expires On:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.expires_on
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td/>', {
|
||||
'colspan': 2,
|
||||
'html': '<h3>Fingerprints</h3>'
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>SHA1 Fingerprint:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.sha1_fingerprint
|
||||
}).appendTo(tr);
|
||||
|
||||
tr = $('<tr/>').appendTo(table);
|
||||
$('<td>MD5 Fingerprint:</td>').appendTo(tr);
|
||||
$('<td/>', {
|
||||
'html': that.md5_fingerprint
|
||||
}).appendTo(tr);
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 600,
|
||||
height: 500,
|
||||
buttons: {
|
||||
'Close': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
function certificate_request_dialog(spec) {
|
||||
var that = {};
|
||||
spec = spec || {};
|
||||
|
||||
that.title = spec.title || '';
|
||||
that.request = spec.request;
|
||||
|
||||
var dialog = $('<div/>', {
|
||||
'title': that.title
|
||||
});
|
||||
|
||||
dialog.append('Copy and paste the Base64-encoded CSR below:');
|
||||
dialog.append('<br/>');
|
||||
dialog.append('<br/>');
|
||||
|
||||
dialog.append(BEGIN_CERTIFICATE_REQUEST);
|
||||
dialog.append('<br/>');
|
||||
|
||||
var textarea = $('<textarea/>', {
|
||||
style: 'width: 100%; height: 225px;'
|
||||
}).appendTo(dialog);
|
||||
|
||||
dialog.append('<br/>');
|
||||
dialog.append(END_CERTIFICATE_REQUEST);
|
||||
|
||||
that.open = function() {
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
width: 500,
|
||||
height: 400,
|
||||
buttons: {
|
||||
'Issue': function() {
|
||||
var values = {};
|
||||
var request = textarea.val();
|
||||
request =
|
||||
BEGIN_CERTIFICATE_REQUEST+'\n'+
|
||||
$.trim(request)+'\n'+
|
||||
END_CERTIFICATE_REQUEST+'\n';
|
||||
values['request'] = request;
|
||||
if (that.request) {
|
||||
that.request(values);
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
},
|
||||
'Cancel': function() {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
function certificate_status_widget(spec) {
|
||||
IPA.certificate_status_widget = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -614,18 +616,18 @@ function certificate_status_widget(spec) {
|
||||
if (entity_certificate) {
|
||||
check_status(that.result.serial_number);
|
||||
} else {
|
||||
set_status(CERTIFICATE_STATUS_MISSING);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
|
||||
}
|
||||
};
|
||||
|
||||
function set_status(status, revocation_reason) {
|
||||
that.status_valid.css('display', status == CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
|
||||
that.status_missing.css('display', status == CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
|
||||
that.status_valid.css('display', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
|
||||
that.status_missing.css('display', status == IPA.cert.CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
|
||||
|
||||
if (!that.is_selfsign()) {
|
||||
that.status_revoked.css('display', status == CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
|
||||
that.revoke_button.css('visibility', status == CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden');
|
||||
that.revocation_reason.html(revocation_reason == undefined ? '' : CRL_REASON[revocation_reason]);
|
||||
that.status_revoked.css('display', status == IPA.cert.CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
|
||||
that.revoke_button.css('visibility', status == IPA.cert.CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden');
|
||||
that.revocation_reason.html(revocation_reason == undefined ? '' : IPA.cert.CRL_REASON[revocation_reason]);
|
||||
that.restore_button.css('visibility', revocation_reason == 6 ? 'visible' : 'hidden');
|
||||
}
|
||||
}
|
||||
@@ -633,7 +635,7 @@ function certificate_status_widget(spec) {
|
||||
function check_status(serial_number) {
|
||||
|
||||
if (that.is_selfsign()) {
|
||||
set_status(CERTIFICATE_STATUS_VALID);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_VALID);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -644,9 +646,9 @@ function certificate_status_widget(spec) {
|
||||
function(data, text_status, xhr) {
|
||||
var revocation_reason = data.result.result.revocation_reason;
|
||||
if (revocation_reason == undefined) {
|
||||
set_status(CERTIFICATE_STATUS_VALID);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_VALID);
|
||||
} else {
|
||||
set_status(CERTIFICATE_STATUS_REVOKED, revocation_reason);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_REVOKED, revocation_reason);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -656,13 +658,13 @@ function certificate_status_widget(spec) {
|
||||
|
||||
var entity_certificate = that.get_entity_certificate(result);
|
||||
if (!entity_certificate) {
|
||||
set_status(CERTIFICATE_STATUS_MISSING);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
|
||||
return;
|
||||
}
|
||||
|
||||
var entity_name = that.get_entity_name(result);
|
||||
|
||||
var dialog = certificate_view_dialog({
|
||||
var dialog = IPA.cert.view_dialog({
|
||||
'title': 'Certificate for '+that.entity_label+' '+entity_name,
|
||||
'subject': result['subject'],
|
||||
'serial_number': result['serial_number'],
|
||||
@@ -680,13 +682,13 @@ function certificate_status_widget(spec) {
|
||||
|
||||
var entity_certificate = that.get_entity_certificate(result);
|
||||
if (!entity_certificate) {
|
||||
set_status(CERTIFICATE_STATUS_MISSING);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
|
||||
return;
|
||||
}
|
||||
|
||||
var entity_name = that.get_entity_name(result);
|
||||
|
||||
var dialog = certificate_get_dialog({
|
||||
var dialog = IPA.cert.get_dialog({
|
||||
'title': 'Certificate for '+that.entity_label+' '+entity_name,
|
||||
'usercertificate': entity_certificate
|
||||
});
|
||||
@@ -699,7 +701,7 @@ function certificate_status_widget(spec) {
|
||||
var entity_name = that.get_entity_name(result);
|
||||
var entity_principal = that.get_entity_principal(result);
|
||||
|
||||
var dialog = certificate_request_dialog({
|
||||
var dialog = IPA.cert.request_dialog({
|
||||
'title': 'Issue New Certificate for '+that.entity_label+' '+entity_name,
|
||||
'request': function(values) {
|
||||
var request = values['request'];
|
||||
@@ -724,14 +726,14 @@ function certificate_status_widget(spec) {
|
||||
|
||||
var entity_certificate = that.get_entity_certificate(result);
|
||||
if (!entity_certificate) {
|
||||
set_status(CERTIFICATE_STATUS_MISSING);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
|
||||
return;
|
||||
}
|
||||
|
||||
var entity_name = that.get_entity_name(result);
|
||||
var serial_number = result['serial_number'];
|
||||
|
||||
var dialog = certificate_revoke_dialog({
|
||||
var dialog = IPA.cert.revoke_dialog({
|
||||
'title': 'Revoke Certificate for '+that.entity_label+' '+entity_name,
|
||||
'revoke': function(values) {
|
||||
var reason = values['reason'];
|
||||
@@ -756,14 +758,14 @@ function certificate_status_widget(spec) {
|
||||
|
||||
var entity_certificate = that.get_entity_certificate(result);
|
||||
if (!entity_certificate) {
|
||||
set_status(CERTIFICATE_STATUS_MISSING);
|
||||
set_status(IPA.cert.CERTIFICATE_STATUS_MISSING);
|
||||
return;
|
||||
}
|
||||
|
||||
var entity_name = that.get_entity_name(result);
|
||||
var serial_number = result['serial_number'];
|
||||
|
||||
var dialog = certificate_restore_dialog({
|
||||
var dialog = IPA.cert.restore_dialog({
|
||||
'title': 'Restore Certificate for '+that.entity_label+' '+entity_name,
|
||||
'restore': function(values) {
|
||||
IPA.cmd(
|
||||
@@ -781,4 +783,4 @@ function certificate_status_widget(spec) {
|
||||
}
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -242,9 +242,6 @@ IPA.entity = function (spec) {
|
||||
};
|
||||
|
||||
|
||||
/* use this to track individual changes between two hashchange events */
|
||||
var window_hash_cache = {};
|
||||
|
||||
/*renamed to avoid clash with IPA.get_entity*/
|
||||
IPA.fetch_entity = function (entity_name) {
|
||||
|
||||
@@ -609,7 +606,7 @@ IPA. facet_create_action_panel = function(container) {
|
||||
var state = {};
|
||||
state[nested_tabs[0]+'-entity'] =
|
||||
this.title;
|
||||
nav_push_state(state);
|
||||
IPA.nav.push_state(state);
|
||||
return false;
|
||||
}
|
||||
}).appendTo(ul);
|
||||
|
||||
@@ -198,7 +198,7 @@ IPA.host_details_facet = function (spec) {
|
||||
that.add_section(section);
|
||||
|
||||
//TODO add label to messages
|
||||
section.add_field(host_provisioning_status_widget({
|
||||
section.add_field(IPA.host_provisioning_status_widget({
|
||||
'name': 'provisioning_status',
|
||||
'label': 'Status',
|
||||
'facet': that
|
||||
@@ -210,7 +210,7 @@ IPA.host_details_facet = function (spec) {
|
||||
});
|
||||
that.add_section(section);
|
||||
|
||||
section.add_field(host_certificate_status_widget({
|
||||
section.add_field(IPA.host_certificate_status_widget({
|
||||
'name': 'certificate_status',
|
||||
'label': 'Status'
|
||||
}));
|
||||
@@ -247,7 +247,7 @@ IPA.host_details_facet = function (spec) {
|
||||
};
|
||||
|
||||
|
||||
function host_provisioning_status_widget(spec) {
|
||||
IPA.host_provisioning_status_widget = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -430,13 +430,13 @@ function host_provisioning_status_widget(spec) {
|
||||
}
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
function host_certificate_status_widget(spec) {
|
||||
IPA.host_certificate_status_widget = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = certificate_status_widget(spec);
|
||||
var that = IPA.certificate_status_widget(spec);
|
||||
|
||||
that.init = function() {
|
||||
|
||||
@@ -463,7 +463,7 @@ function host_certificate_status_widget(spec) {
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
IPA.host_managedby_host_facet = function (spec) {
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ var IPA = ( function () {
|
||||
that.metadata = {};
|
||||
that.whoami = {};
|
||||
|
||||
|
||||
that.entities = [];
|
||||
that.entity_factories = {};
|
||||
|
||||
@@ -332,8 +331,7 @@ IPA.batch_command = function (spec) {
|
||||
* win_callback - function to call if the JSON request succeeds
|
||||
* fail_callback - function to call if the JSON request fails
|
||||
* objname - name of an IPA object (optional) */
|
||||
IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, command_name)
|
||||
{
|
||||
IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, command_name) {
|
||||
var default_json_url = '/ipa/json';
|
||||
|
||||
var network_call_count = 0;
|
||||
@@ -490,8 +488,7 @@ IPA.cmd = function (name, args, options, win_callback, fail_callback, objname, c
|
||||
|
||||
|
||||
/* helper function used to retrieve information about an attribute */
|
||||
IPA.get_param_info = function(obj_name, attr)
|
||||
{
|
||||
IPA.get_param_info = function(obj_name, attr) {
|
||||
var obj = IPA.metadata[obj_name];
|
||||
if (!obj) {
|
||||
return null;
|
||||
@@ -512,8 +509,7 @@ IPA.get_param_info = function(obj_name, attr)
|
||||
};
|
||||
|
||||
/* helper function used to retrieve attr name with members of type `member` */
|
||||
IPA.get_member_attribute = function (obj_name, member)
|
||||
{
|
||||
IPA.get_member_attribute = function (obj_name, member) {
|
||||
var obj = IPA.metadata[obj_name];
|
||||
if (!obj) {
|
||||
return null;
|
||||
|
||||
@@ -20,138 +20,129 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
var nav_tabs_lists;
|
||||
var nav_container;
|
||||
IPA.nav = {
|
||||
tabs_lists : {},
|
||||
nav_container : {},
|
||||
|
||||
|
||||
|
||||
function nav_push_state(params)
|
||||
{
|
||||
if (!IPA.test_dirty()){
|
||||
return false;
|
||||
}
|
||||
$.bbq.pushState(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
function nav_get_state(key)
|
||||
{
|
||||
return $.bbq.getState(key, true);
|
||||
}
|
||||
|
||||
function nav_remove_state(key)
|
||||
{
|
||||
$.bbq.removeState(key);
|
||||
}
|
||||
|
||||
function nav_create(nls, container, tabclass)
|
||||
{
|
||||
if (!container)
|
||||
container = $('#navigation');
|
||||
if (!tabclass)
|
||||
tabclass = 'tabs';
|
||||
|
||||
nav_tabs_lists = nls;
|
||||
nav_container = container;
|
||||
|
||||
nav_generate_tabs(nls, container, tabclass, 1);
|
||||
|
||||
var tabs = $('.' + tabclass);
|
||||
tabs.tabs({
|
||||
select: function(event, ui) {
|
||||
var panel = $(ui.panel);
|
||||
var parent = panel.parent();
|
||||
var id = parent.attr('id');
|
||||
var state = {};
|
||||
state[id] = ui.index;
|
||||
return nav_push_state(state);
|
||||
push_state : function (params) {
|
||||
if (!IPA.test_dirty()){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$.bbq.pushState(params);
|
||||
return true;
|
||||
},
|
||||
|
||||
nav_update_tabs();
|
||||
}
|
||||
get_state : function (key) {
|
||||
return $.bbq.getState(key, true);
|
||||
},
|
||||
|
||||
function nav_generate_tabs(nls, container, tabclass, depth)
|
||||
{
|
||||
container.addClass(tabclass);
|
||||
container.addClass('tabs'+depth);
|
||||
remove_state : function (key) {
|
||||
$.bbq.removeState(key);
|
||||
},
|
||||
|
||||
var ul = $('<ul/>');
|
||||
container.append(ul);
|
||||
create : function (nls, container, tabclass) {
|
||||
if (!container)
|
||||
container = $('#navigation');
|
||||
if (!tabclass)
|
||||
tabclass = 'tabs';
|
||||
|
||||
for (var i = 0; i < nls.length; ++i) {
|
||||
var tab = nls[i];
|
||||
IPA.nav.tabs_lists = nls;
|
||||
IPA.nav.nav_container = container;
|
||||
|
||||
var label = tab.name;
|
||||
if (tab.entity) {
|
||||
var entity = IPA.get_entity(tab.entity);
|
||||
label = entity.label;
|
||||
}
|
||||
if (tab.label){
|
||||
label = tab.label;
|
||||
IPA.nav.generate_tabs(nls, container, tabclass, 1);
|
||||
|
||||
var tabs = $('.' + tabclass);
|
||||
tabs.tabs({
|
||||
select: function(event, ui) {
|
||||
var panel = $(ui.panel);
|
||||
var parent = panel.parent();
|
||||
var id = parent.attr('id');
|
||||
var state = {};
|
||||
state[id] = ui.index;
|
||||
return IPA.nav.push_state(state);
|
||||
}
|
||||
});
|
||||
|
||||
IPA.nav.update_tabs();
|
||||
},
|
||||
|
||||
generate_tabs : function (nls, container, tabclass, depth) {
|
||||
container.addClass(tabclass);
|
||||
container.addClass('tabs'+depth);
|
||||
|
||||
var ul = $('<ul/>');
|
||||
container.append(ul);
|
||||
|
||||
for (var i = 0; i < nls.length; ++i) {
|
||||
var tab = nls[i];
|
||||
|
||||
var label = tab.name;
|
||||
if (tab.entity) {
|
||||
var entity = IPA.get_entity(tab.entity);
|
||||
label = entity.label;
|
||||
}
|
||||
if (tab.label){
|
||||
label = tab.label;
|
||||
}
|
||||
|
||||
var li = IPA.nav.create_tab_li(tab.name, label);
|
||||
ul.append(li);
|
||||
|
||||
var div = IPA.nav.create_tab_div(tab.name);
|
||||
container.append(div);
|
||||
|
||||
if (tab.entity) {
|
||||
div.addClass('entity-container');
|
||||
}
|
||||
|
||||
if (tab.children && depth === 1) {
|
||||
IPA.nav.generate_tabs(tab.children, div, tabclass, depth +1 );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
var li = nav_create_tab_li(tab.name, label);
|
||||
ul.append(li);
|
||||
create_tab_li : function (id, name) {
|
||||
return $('<li/>').append($('<a/>', {
|
||||
href: '#'+id,
|
||||
title: id,
|
||||
html: name
|
||||
}));
|
||||
},
|
||||
|
||||
var div = nav_create_tab_div(tab.name);
|
||||
container.append(div);
|
||||
create_tab_div : function (id) {
|
||||
return $('<div/>', {
|
||||
id: id
|
||||
});
|
||||
},
|
||||
|
||||
if (tab.entity) {
|
||||
div.addClass('entity-container');
|
||||
}
|
||||
update_tabs : function () {
|
||||
IPA.nav._update_tabs(IPA.nav.tabs_lists, IPA.nav.nav_container,1);
|
||||
},
|
||||
|
||||
if (tab.children && depth === 1) {
|
||||
nav_generate_tabs(tab.children, div, tabclass, depth +1 );
|
||||
_update_tabs : function (nls, container,depth) {
|
||||
var id = container.attr('id');
|
||||
var index = IPA.nav.get_state(id);
|
||||
if (!index || index >= nls.length) index = 0;
|
||||
|
||||
container.tabs('select', index);
|
||||
|
||||
var tab = nls[index];
|
||||
var container2 = $('#' + tab.name);
|
||||
|
||||
if (tab.children && depth === 1 ) {
|
||||
IPA.nav._update_tabs(tab.children, container2,depth+1);
|
||||
|
||||
} else if (tab.entity) {
|
||||
var entity_name = tab.entity;
|
||||
|
||||
var nested_entity = IPA.nav.get_state(entity_name+'-entity');
|
||||
|
||||
if (nested_entity){
|
||||
entity_name = nested_entity;
|
||||
}
|
||||
|
||||
var entity = IPA.get_entity(entity_name);
|
||||
entity.setup(container2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function nav_create_tab_li(id, name)
|
||||
{
|
||||
return $('<li/>').append($('<a/>', {
|
||||
href: '#'+id,
|
||||
title: id,
|
||||
html: name
|
||||
}));
|
||||
}
|
||||
|
||||
function nav_create_tab_div(id)
|
||||
{
|
||||
return $('<div/>', {
|
||||
id: id
|
||||
});
|
||||
}
|
||||
|
||||
function nav_update_tabs()
|
||||
{
|
||||
_nav_update_tabs(nav_tabs_lists, nav_container,1);
|
||||
}
|
||||
|
||||
function _nav_update_tabs(nls, container,depth)
|
||||
{
|
||||
var id = container.attr('id');
|
||||
var index = nav_get_state(id);
|
||||
if (!index || index >= nls.length) index = 0;
|
||||
|
||||
container.tabs('select', index);
|
||||
|
||||
var tab = nls[index];
|
||||
var container2 = $('#' + tab.name);
|
||||
|
||||
if (tab.children && depth === 1 ) {
|
||||
_nav_update_tabs(tab.children, container2,depth+1);
|
||||
|
||||
} else if (tab.entity) {
|
||||
var entity_name = tab.entity;
|
||||
|
||||
var nested_entity = nav_get_state(entity_name+'-entity');
|
||||
|
||||
if (nested_entity){
|
||||
entity_name = nested_entity;
|
||||
}
|
||||
|
||||
var entity = IPA.get_entity(entity_name);
|
||||
entity.setup(container2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -429,9 +429,22 @@ IPA.records_facet = function (spec){
|
||||
|
||||
|
||||
function generate_tr(thead, tbody, result){
|
||||
function generate_checkbox_td(tr, pkey) {
|
||||
var checkbox = $('<input />', {
|
||||
name: pkey,
|
||||
title: pkey,
|
||||
type: 'checkbox',
|
||||
'class': 'search-selector'
|
||||
});
|
||||
var td = $('<td></td>');
|
||||
|
||||
td.append(checkbox);
|
||||
tr.append(td);
|
||||
}
|
||||
|
||||
var tr = $('<tr></tr>').appendTo(tbody);
|
||||
|
||||
search_generate_checkbox_td(tr, /*pkey_value*/ '');
|
||||
generate_checkbox_td(tr, /*pkey_value*/ '');
|
||||
|
||||
//TODO get this fixed on the back end. For now, workaround
|
||||
|
||||
|
||||
@@ -396,74 +396,3 @@ IPA.search_facet = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
function search_generate_tr(thead, tbody, entry_attrs)
|
||||
{
|
||||
var obj_name = tbody.closest('.entity-container').attr('title');
|
||||
var pkey = IPA.metadata[obj_name].primary_key;
|
||||
var pkey_value = entry_attrs[pkey];
|
||||
|
||||
var entity = IPA.get_entity(obj_name);
|
||||
var facet = entity ? entity.get_facet('search') : null;
|
||||
|
||||
tbody.append('<tr></tr>');
|
||||
var tr = tbody.children().last();
|
||||
search_generate_checkbox_td(tr, pkey_value);
|
||||
|
||||
var ths = thead.find('th');
|
||||
for (var i = 1; i < ths.length; ++i) {
|
||||
var jobj = $(ths[i]);
|
||||
var attr = jobj.attr('abbr');
|
||||
var value = entry_attrs[attr];
|
||||
|
||||
var column = facet ? facet.get_column(attr) : null;
|
||||
var render_call = window[jobj.attr('title')];
|
||||
|
||||
if (column && column.setup) {
|
||||
column.setup(tr, attr, value, entry_attrs);
|
||||
|
||||
} else if (typeof render_call == 'function') {
|
||||
render_call(tr, attr, value, entry_attrs);
|
||||
|
||||
} else
|
||||
search_generate_td(tr, attr, value, entry_attrs);
|
||||
}
|
||||
|
||||
tbody.find('.search-a-pkey').click(function () {
|
||||
var jobj = $(this);
|
||||
|
||||
var state = {};
|
||||
state[obj_name + '-facet'] = 'details';
|
||||
state[obj_name + '-pkey'] = $(this).text();
|
||||
$.bbq.pushState(state);
|
||||
|
||||
return (false);
|
||||
});
|
||||
}
|
||||
|
||||
function search_generate_checkbox_td(tr, pkey)
|
||||
{
|
||||
var checkbox = $('<input />', {
|
||||
name: pkey,
|
||||
title: pkey,
|
||||
type: 'checkbox',
|
||||
'class': 'search-selector'
|
||||
});
|
||||
var td = $('<td></td>');
|
||||
|
||||
td.append(checkbox);
|
||||
tr.append(td);
|
||||
}
|
||||
|
||||
var _search_td_template = '<td title="A">V</td>';
|
||||
var _search_a_pkey_template = '<a href="jslink" class="search-a-pkey">V</a>';
|
||||
|
||||
function search_generate_td(tr, attr, value, entry_attrs)
|
||||
{
|
||||
var obj_name = tr.closest('.entity-container').attr('title');
|
||||
|
||||
var param_info = IPA.get_param_info(obj_name, attr);
|
||||
if (param_info && param_info['primary_key'])
|
||||
value = _search_a_pkey_template.replace('V', value);
|
||||
|
||||
tr.append(_search_td_template.replace('A', attr).replace('V', value));
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ IPA.service_details_facet = function(spec) {
|
||||
name: 'provisioning',
|
||||
label: 'Provisioning'
|
||||
}).
|
||||
custom_input(service_provisioning_status_widget({
|
||||
custom_input(IPA.service_provisioning_status_widget({
|
||||
name: 'provisioning_status',
|
||||
label: 'Status'
|
||||
}))).
|
||||
@@ -160,7 +160,7 @@ IPA.service_details_facet = function(spec) {
|
||||
name: 'certificate',
|
||||
label: 'Service Certificate'
|
||||
}).
|
||||
custom_input((service_certificate_status_widget({
|
||||
custom_input((IPA.service_certificate_status_widget({
|
||||
name: 'certificate_status',
|
||||
label: 'Status'
|
||||
}))));
|
||||
@@ -210,7 +210,7 @@ IPA.service_host_widget = function(spec) {
|
||||
};
|
||||
|
||||
|
||||
function service_provisioning_status_widget(spec) {
|
||||
IPA.service_provisioning_status_widget = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -322,13 +322,13 @@ function service_provisioning_status_widget(spec) {
|
||||
}
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
function service_certificate_status_widget(spec) {
|
||||
IPA.service_certificate_status_widget = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = certificate_status_widget(spec);
|
||||
var that = IPA.certificate_status_widget(spec);
|
||||
|
||||
that.init = function() {
|
||||
|
||||
@@ -355,7 +355,7 @@ function service_certificate_status_widget(spec) {
|
||||
};
|
||||
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
||||
IPA.service_managedby_host_facet = function(spec) {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js, sudorule.js */
|
||||
|
||||
IPA.entity_factories.sudocmd = function () {
|
||||
|
||||
@@ -35,7 +35,7 @@ IPA.entity_factories.sudocmd = function () {
|
||||
'label': 'Search'
|
||||
});
|
||||
|
||||
var dialog = IPA.sudocmd_add_dialog({
|
||||
var dialog = IPA.sudo.cmd_add_dialog({
|
||||
'name': 'add',
|
||||
'title': 'Add New SUDO Command'
|
||||
});
|
||||
@@ -55,7 +55,7 @@ IPA.entity_factories.sudocmd = function () {
|
||||
};
|
||||
|
||||
|
||||
IPA.sudocmd_add_dialog = function (spec) {
|
||||
IPA.sudo.cmd_add_dialog = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js, sudorule.js */
|
||||
|
||||
IPA.entity_factories.sudocmdgroup = function () {
|
||||
|
||||
@@ -35,7 +35,7 @@ IPA.entity_factories.sudocmdgroup = function () {
|
||||
'label': 'Search'
|
||||
});
|
||||
|
||||
var dialog = IPA.sudocmdgroup_add_dialog({
|
||||
var dialog = IPA.sudo.cmdgroup_add_dialog({
|
||||
'name': 'add',
|
||||
'title': 'Add New SUDO Command Group'
|
||||
});
|
||||
@@ -55,7 +55,7 @@ IPA.entity_factories.sudocmdgroup = function () {
|
||||
};
|
||||
|
||||
|
||||
IPA.sudocmdgroup_add_dialog = function (spec) {
|
||||
IPA.sudo.cmdgroup_add_dialog = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||
|
||||
IPA.sudo = {};
|
||||
|
||||
IPA.entity_factories.sudorule = function () {
|
||||
|
||||
var that = IPA.entity({
|
||||
@@ -35,7 +37,7 @@ IPA.entity_factories.sudorule = function () {
|
||||
'label': 'Search'
|
||||
});
|
||||
|
||||
var dialog = IPA.sudorule_add_dialog({
|
||||
var dialog = IPA.sudo.rule_add_dialog({
|
||||
'name': 'add',
|
||||
'title': 'Add New Rule'
|
||||
});
|
||||
@@ -55,7 +57,7 @@ IPA.entity_factories.sudorule = function () {
|
||||
};
|
||||
|
||||
|
||||
IPA.sudorule_add_dialog = function (spec) {
|
||||
IPA.sudo.rule_add_dialog = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -109,7 +111,7 @@ IPA.sudorule_details_facet = function (spec) {
|
||||
});
|
||||
|
||||
} else {
|
||||
section = IPA.sudorule_details_general_section({
|
||||
section = IPA.sudo.rule_details_general_section({
|
||||
'name': 'general',
|
||||
'label': 'General'
|
||||
});
|
||||
@@ -176,13 +178,13 @@ IPA.sudorule_details_facet = function (spec) {
|
||||
'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host'
|
||||
}));
|
||||
|
||||
section = IPA.sudorule_details_command_section({
|
||||
section = IPA.sudo.rule_details_command_section({
|
||||
'name': 'command',
|
||||
'label': 'Run Commands'
|
||||
});
|
||||
that.add_section(section);
|
||||
|
||||
section = IPA.sudorule_details_runas_section({
|
||||
section = IPA.sudo.rule_details_runas_section({
|
||||
'name': 'runas',
|
||||
'label': 'As Whom'
|
||||
});
|
||||
@@ -377,7 +379,7 @@ IPA.sudorule_details_facet = function (spec) {
|
||||
};
|
||||
|
||||
|
||||
IPA.sudorule_details_general_section = function (spec){
|
||||
IPA.sudo.rule_details_general_section = function (spec){
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -514,7 +516,7 @@ IPA.sudorule_details_general_section = function (spec){
|
||||
};
|
||||
|
||||
|
||||
IPA.sudorule_details_command_section = function (spec){
|
||||
IPA.sudo.rule_details_command_section = function (spec){
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -686,7 +688,7 @@ IPA.sudorule_details_command_section = function (spec){
|
||||
};
|
||||
|
||||
|
||||
IPA.sudorule_details_runas_section = function (spec){
|
||||
IPA.sudo.rule_details_runas_section = function (spec){
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
@@ -913,7 +915,7 @@ IPA.sudorule_association_table_widget = function (spec) {
|
||||
template = 'sudorule-'+that.other_entity+'-dialog.html #contents';
|
||||
}
|
||||
|
||||
return IPA.sudorule_association_adder_dialog({
|
||||
return IPA.sudo.rule_association_adder_dialog({
|
||||
'title': title,
|
||||
'entity_name': that.entity_name,
|
||||
'pkey': pkey,
|
||||
@@ -936,7 +938,7 @@ IPA.sudorule_association_table_widget = function (spec) {
|
||||
};
|
||||
|
||||
|
||||
IPA.sudorule_association_adder_dialog = function (spec) {
|
||||
IPA.sudo.rule_association_adder_dialog = function (spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
|
||||
@@ -23,42 +23,42 @@ module('certificate');
|
||||
test("Testing certificate_parse_dn().", function() {
|
||||
|
||||
same(
|
||||
certificate_parse_dn(), {},
|
||||
"Checking certificate_parse_dn()"
|
||||
IPA.cert.parse_dn(), {},
|
||||
"Checking IPA.cert.parse_dn()"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn(''), {},
|
||||
"Checking certificate_parse_dn('')"
|
||||
IPA.cert.parse_dn(''), {},
|
||||
"Checking IPA.cert.parse_dn('')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('c=US'), {'c': 'US'},
|
||||
"Checking certificate_parse_dn('c=US')"
|
||||
IPA.cert.parse_dn('c=US'), {'c': 'US'},
|
||||
"Checking IPA.cert.parse_dn('c=US')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('st=TX,c=US'), {'st': 'TX','c': 'US'},
|
||||
"Checking certificate_parse_dn('st=TX,c=US')"
|
||||
IPA.cert.parse_dn('st=TX,c=US'), {'st': 'TX','c': 'US'},
|
||||
"Checking IPA.cert.parse_dn('st=TX,c=US')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('c=US,st=TX'), {'st': 'TX','c': 'US'},
|
||||
"Checking certificate_parse_dn('c=US,st=TX')"
|
||||
IPA.cert.parse_dn('c=US,st=TX'), {'st': 'TX','c': 'US'},
|
||||
"Checking IPA.cert.parse_dn('c=US,st=TX')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn(' st = New Mexico , c = US '), {'st': 'New Mexico','c': 'US'},
|
||||
"Checking certificate_parse_dn(' st = New Mexico , c = US ')"
|
||||
IPA.cert.parse_dn(' st = New Mexico , c = US '), {'st': 'New Mexico','c': 'US'},
|
||||
"Checking IPA.cert.parse_dn(' st = New Mexico , c = US ')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('ST=TX,C=US'), {'st': 'TX','c': 'US'},
|
||||
"Checking certificate_parse_dn('ST=TX,C=US')"
|
||||
IPA.cert.parse_dn('ST=TX,C=US'), {'st': 'TX','c': 'US'},
|
||||
"Checking IPA.cert.parse_dn('ST=TX,C=US')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US'),
|
||||
IPA.cert.parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US'),
|
||||
{ 'cn': 'dev.example.com',
|
||||
'ou': 'Engineering',
|
||||
'o': 'Example',
|
||||
@@ -66,16 +66,16 @@ test("Testing certificate_parse_dn().", function() {
|
||||
'st': 'TX',
|
||||
'c': 'US'
|
||||
},
|
||||
"Checking certificate_parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US')"
|
||||
"Checking IPA.cert.parse_dn('cn=dev.example.com,ou=Engineering,o=Example,l=Austin,ST=TX,C=US')"
|
||||
);
|
||||
|
||||
same(
|
||||
certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com'),
|
||||
IPA.cert.parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com'),
|
||||
{
|
||||
'cn': 'John Smith',
|
||||
'ou': ['Developers','Users'],
|
||||
'dc': ['example', 'com']
|
||||
},
|
||||
"Checking certificate_parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com')"
|
||||
"Checking IPA.cert.parse_dn('cn=John Smith,ou=Developers,ou=Users,dc=example,dc=com')"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
module('navigation');
|
||||
|
||||
test("Testing nav_create().", function() {
|
||||
test("Testing IPA.nav.create().", function() {
|
||||
|
||||
var mock_tabs_lists = [
|
||||
{ name:'identity', label:'IDENTITY', children: [
|
||||
@@ -56,7 +56,7 @@ test("Testing nav_create().", function() {
|
||||
var navigation = $('<div id="navigation"/>').appendTo(document.body);
|
||||
var user_mock_called = false;
|
||||
var group_mock_called = false;
|
||||
nav_create(mock_tabs_lists, navigation, 'tabs');
|
||||
IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
|
||||
ok(user_mock_called, "mock user setup was called");
|
||||
ok(!group_mock_called, "mock group setup was not called because the tab is inactive");
|
||||
same( navigation[0].children.length, 2, "Two Child tabs");
|
||||
@@ -66,21 +66,21 @@ test("Testing nav_create().", function() {
|
||||
navigation.remove();
|
||||
});
|
||||
|
||||
test("Testing nav_update_tabs() with valid index.", function() {
|
||||
test("Testing IPA.nav.update_tabs() with valid index.", function() {
|
||||
|
||||
var orig_push_state = nav_push_state;
|
||||
var orig_get_state = nav_get_state;
|
||||
var orig_remove_state = nav_remove_state;
|
||||
var orig_push_state = IPA.nav.push_state;
|
||||
var orig_get_state = IPA.nav.get_state;
|
||||
var orig_remove_state = IPA.nav.remove_state;
|
||||
|
||||
var state = {};
|
||||
|
||||
nav_push_state = function(params) {
|
||||
IPA.nav.push_state = function(params) {
|
||||
$.extend(state, params);
|
||||
};
|
||||
nav_get_state = function(key) {
|
||||
IPA.nav.get_state = function(key) {
|
||||
return state[key];
|
||||
};
|
||||
nav_remove_state = function(key) {
|
||||
IPA.nav.remove_state = function(key) {
|
||||
delete state[key];
|
||||
};
|
||||
|
||||
@@ -93,10 +93,10 @@ test("Testing nav_update_tabs() with valid index.", function() {
|
||||
|
||||
var navigation = $('<div id="navigation"/>').appendTo(document.body);
|
||||
|
||||
nav_create(mock_tabs_lists, navigation, 'tabs');
|
||||
IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
|
||||
|
||||
nav_push_state({"identity":1});
|
||||
nav_update_tabs();
|
||||
IPA.nav.push_state({"identity":1});
|
||||
IPA.nav.update_tabs();
|
||||
|
||||
same(
|
||||
navigation.tabs('option', 'selected'), 0,
|
||||
@@ -108,30 +108,30 @@ test("Testing nav_update_tabs() with valid index.", function() {
|
||||
"Active tab at level 2"
|
||||
);
|
||||
|
||||
nav_remove_state("identity");
|
||||
IPA.nav.remove_state("identity");
|
||||
|
||||
navigation.remove();
|
||||
|
||||
nav_push_state = orig_push_state;
|
||||
nav_get_state = orig_get_state;
|
||||
nav_remove_state = orig_remove_state;
|
||||
IPA.nav.push_state = orig_push_state;
|
||||
IPA.nav.get_state = orig_get_state;
|
||||
IPA.nav.remove_state = orig_remove_state;
|
||||
});
|
||||
|
||||
test("Testing nav_update_tabs() with out-of-range index.", function() {
|
||||
test("Testing IPA.nav.update_tabs() with out-of-range index.", function() {
|
||||
|
||||
var orig_push_state = nav_push_state;
|
||||
var orig_get_state = nav_get_state;
|
||||
var orig_remove_state = nav_remove_state;
|
||||
var orig_push_state = IPA.nav.push_state;
|
||||
var orig_get_state = IPA.nav.get_state;
|
||||
var orig_remove_state = IPA.nav.remove_state;
|
||||
|
||||
var state = {};
|
||||
|
||||
nav_push_state = function(params) {
|
||||
IPA.nav.push_state = function(params) {
|
||||
$.extend(state, params);
|
||||
};
|
||||
nav_get_state = function(key) {
|
||||
IPA.nav.get_state = function(key) {
|
||||
return state[key];
|
||||
};
|
||||
nav_remove_state = function(key) {
|
||||
IPA.nav.remove_state = function(key) {
|
||||
delete state[key];
|
||||
};
|
||||
|
||||
@@ -144,10 +144,10 @@ test("Testing nav_update_tabs() with out-of-range index.", function() {
|
||||
|
||||
var navigation = $('<div id="navigation"/>').appendTo(document.body);
|
||||
|
||||
nav_create(mock_tabs_lists, navigation, 'tabs');
|
||||
IPA.nav.create(mock_tabs_lists, navigation, 'tabs');
|
||||
|
||||
nav_push_state({"identity":2});
|
||||
nav_update_tabs();
|
||||
IPA.nav.push_state({"identity":2});
|
||||
IPA.nav.update_tabs();
|
||||
|
||||
same(
|
||||
navigation.tabs('option', 'selected'), 0,
|
||||
@@ -159,11 +159,11 @@ test("Testing nav_update_tabs() with out-of-range index.", function() {
|
||||
"Active tab at level 2"
|
||||
);
|
||||
|
||||
nav_remove_state("identity");
|
||||
IPA.nav.remove_state("identity");
|
||||
|
||||
navigation.remove();
|
||||
|
||||
nav_push_state = orig_push_state;
|
||||
nav_get_state = orig_get_state;
|
||||
nav_remove_state = orig_remove_state;
|
||||
IPA.nav.push_state = orig_push_state;
|
||||
IPA.nav.get_state = orig_get_state;
|
||||
IPA.nav.remove_state = orig_remove_state;
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ $(function() {
|
||||
|
||||
/* main loop (hashchange event handler) */
|
||||
function window_hashchange(evt){
|
||||
nav_update_tabs();
|
||||
IPA.nav.update_tabs();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,10 +148,10 @@ $(function() {
|
||||
|
||||
if (should_show_all_ui()){
|
||||
IPA.tab_set = IPA.admin_tab_set();
|
||||
nav_create(IPA.tab_set, navigation, 'tabs');
|
||||
IPA.nav.create(IPA.tab_set, navigation, 'tabs');
|
||||
} else {
|
||||
IPA.tab_set = IPA.self_serv_tab_set();
|
||||
nav_create(IPA.tab_set, navigation, 'tabs');
|
||||
IPA.nav.create(IPA.tab_set, navigation, 'tabs');
|
||||
|
||||
var state = {'user-pkey':IPA.whoami_pkey ,
|
||||
'user-facet': $.bbq.getState('user-facet') ||
|
||||
|
||||
Reference in New Issue
Block a user