summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-04-22 11:13:06 +0200
committerPetr Vobornik <pvoborni@redhat.com>2016-06-29 15:41:58 +0200
commit260a00b81ff10dbe05d35741febfffde2e4ef1dc (patch)
tree7b4c276784969537a0066a6a29f5ad184d1fea95
parent06a9a84876345135acac933aca9ada235651997e (diff)
downloadfreeipa-260a00b81ff10dbe05d35741febfffde2e4ef1dc.tar.gz
freeipa-260a00b81ff10dbe05d35741febfffde2e4ef1dc.tar.xz
freeipa-260a00b81ff10dbe05d35741febfffde2e4ef1dc.zip
Changed the way how to handle remove hold and revoke actions
Method calling in actions is moved to another function - these calls may be used by another functions, not only by actions. https://fedorahosted.org/freeipa/ticket/5381 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
-rwxr-xr-xinstall/ui/src/freeipa/certificate.js57
1 files changed, 40 insertions, 17 deletions
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 65c3da723..28b7756c5 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -787,6 +787,25 @@ IPA.cert.request_action = function(spec) {
return that;
};
+IPA.cert.perform_revoke = function(spec, sn, revocation_reason) {
+
+ spec.hide_activity_icon = spec.hide_activity_icon || false;
+
+ rpc.command({
+ entity: 'cert',
+ method: 'revoke',
+ hide_activity_icon: spec.hide_activity_icon,
+ args: [ sn ],
+ options: {
+ 'revocation_reason': revocation_reason
+ },
+ notify_activity_start: spec.notify_activity_start,
+ notify_activity_end: spec.notify_activity_end,
+ on_success: spec.on_success,
+ on_error: spec.on_error
+ }).execute();
+};
+
IPA.cert.revoke_action = function(spec) {
spec = spec || {};
@@ -822,21 +841,17 @@ IPA.cert.revoke_action = function(spec) {
that.execute_action = function(facet) {
- var certificate = facet.certificate;
-
- rpc.command({
- entity: 'cert',
- method: 'revoke',
- args: [certificate.serial_number],
- options: {
- 'revocation_reason': that.dialog.get_reason()
- },
+ var spec = {
on_success: function(data, text_status, xhr) {
facet.refresh();
IPA.notify_success('@i18n:objects.cert.revoked');
facet.certificate_updated.notify([], that.facet);
}
- }).execute();
+ };
+
+ var sn = facet.certificate.serial_number;
+ var revocation_reason = that.dialog.get_reason();
+ IPA.cert.perform_revoke(spec, sn, revocation_reason);
};
return that;
@@ -881,23 +896,31 @@ IPA.cert.remove_hold_action = function(spec) {
that.execute_action = function(facet) {
- var certificate = facet.certificate;
-
- rpc.command({
- entity: 'cert',
- method: 'remove_hold',
- args: [certificate.serial_number],
+ var spec = {
on_success: function(data, text_status, xhr) {
facet.refresh();
IPA.notify_success('@i18n:objects.cert.hold_removed');
facet.certificate_updated.notify([], that.facet);
}
- }).execute();
+ };
+
+ IPA.cert.perform_remove_hold(spec, facet.certificate.serial_number);
+
};
return that;
};
+IPA.cert.perform_remove_hold = function(spec, sn) {
+
+ rpc.command({
+ entity: 'cert',
+ method: 'remove_hold',
+ args: [sn],
+ on_success: spec.on_success
+ }).execute();
+};
+
IPA.cert.certificate_evaluator = function(spec) {
spec.name = spec.name || 'has_certificate_evaluator';