summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-04-22 12:58:22 +0200
committerPetr Vobornik <pvoborni@redhat.com>2016-06-29 15:41:58 +0200
commit79ec965a967ee561fe3ad1363a64fbb06702e358 (patch)
treef280e1a2fc7644780c253093ab16aa1d98132f58 /install
parent0b72571c5ab36dc0a2d93ded9a10a1b7b08d552e (diff)
downloadfreeipa-79ec965a967ee561fe3ad1363a64fbb06702e358.tar.gz
freeipa-79ec965a967ee561fe3ad1363a64fbb06702e358.tar.xz
freeipa-79ec965a967ee561fe3ad1363a64fbb06702e358.zip
Add new certificates widget to the host details page. Also extends evaluator and add support for adapters.
https://fedorahosted.org/freeipa/ticket/5108 https://fedorahosted.org/freeipa/ticket/5381 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Diffstat (limited to 'install')
-rw-r--r--install/ui/src/freeipa/details.js37
-rw-r--r--install/ui/src/freeipa/host.js65
2 files changed, 79 insertions, 23 deletions
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js
index 080df1e7d..e274e6faa 100644
--- a/install/ui/src/freeipa/details.js
+++ b/install/ui/src/freeipa/details.js
@@ -1671,22 +1671,25 @@ exp.value_state_evaluator = IPA.value_state_evaluator = function(spec) {
*/
that.representation = spec.representation;
+ that.adapter = builder.build('adapter',
+ spec.adapter, { context: that });
+
+ that.param = spec.param;
+
/**
* @inheritDoc
*/
that.on_event = function(data) {
- var old_state, record, state, value, loaded_value;
+ var old_state, value, loaded_value;
old_state = that.state;
- record = data.result.result;
value = that.normalize_value(that.value);
- loaded_value = record[that.attribute];
- loaded_value = that.normalize_value(loaded_value);
-
that.state = [];
- if (!IPA.array_diff(value, loaded_value)) {
+ loaded_value = that.adapter.load(data, spec.attribute);
+
+ if(!IPA.array_diff(value, loaded_value)) {
that.state.push(that.get_state_text());
}
@@ -1739,6 +1742,28 @@ exp.value_state_evaluator = IPA.value_state_evaluator = function(spec) {
return that;
};
+
+/**
+ * has_keytab evaluator
+ *
+ * @class details.has_keytab_evaluator
+ * @alternateClassName IPA.has_keytab_evaluator
+ * @extends facet.value_state_evaluator
+ */
+exp.has_keytab_evaluator = IPA.has_keytab_evaluator = function(spec) {
+
+ spec.name = spec.name || 'has_keytab_evaluator';
+ spec.attribute = spec.attribute || 'has_keytab';
+ spec.value = spec.value || [true];
+ spec.representation = spec.representation || 'has_keytab';
+ spec.param = spec.param || 'has_keytab';
+ spec.adapter = spec.adapter || { $type: 'adapter' };
+
+ var that = IPA.value_state_evaluator(spec);
+
+ return that;
+};
+
/**
* Object class evaluator
*
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 80e3db658..677da96f2 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -19,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa',
+define(['./builder',
+ './ipa',
'./jquery',
'./phases',
'./reg',
@@ -30,7 +31,7 @@ define(['./ipa',
'./association',
'./entity',
'./certificate'],
- function(IPA, $, phases, reg, rpc, text) {
+ function(builder, IPA, $, phases, reg, rpc, text) {
var exp = IPA.host = {};
@@ -140,8 +141,12 @@ return {
name: 'certificate',
fields: [
{
- $type: 'certificate',
- name: 'usercertificate'
+ $type: 'certs',
+ adapter: {
+ $type: 'object_adapter',
+ result_index: 1
+ },
+ label: '@i18n:objects.cert.certificates'
}
]
},
@@ -334,8 +339,16 @@ return {
'request_cert'],
state: {
evaluators: [
- IPA.host.has_password_evaluator,
- IPA.host.has_keytab_evaluator,
+ {
+ $factory: IPA.host.has_password_evaluator,
+ param: 'has_password',
+ adapter: { $type: 'batch', result_index: 0 }
+ },
+ {
+ $factory: IPA.has_keytab_evaluator,
+ param: 'has_keytab',
+ adapter: { $type: 'batch', result_index: 0 }
+ },
IPA.host.userpassword_acl_evaluator,
IPA.host.krbprincipalkey_acl_evaluator,
IPA.cert.certificate_evaluator
@@ -433,6 +446,32 @@ IPA.host.details_facet = function(spec, no_init) {
that.certificate_loaded = IPA.observer();
that.certificate_updated = IPA.observer();
+ that.create_refresh_command = function() {
+ var pkey = that.get_pkey();
+
+ var batch = rpc.batch_command({
+ name: 'host_details_refresh'
+ });
+
+ var host_command = that.details_facet_create_refresh_command();
+ batch.add_command(host_command);
+
+ var certificates = rpc.command({
+ entity: 'cert',
+ method: 'find',
+ retry: false,
+ options: {
+ host: [ pkey ],
+ all: true
+ }
+ });
+
+ batch.add_command(certificates);
+
+ return batch;
+
+ };
+
that.get_refresh_command_name = function() {
return that.entity.name+'_show_'+that.get_pkey();
};
@@ -919,17 +958,6 @@ IPA.host.krbprincipalkey_acl_evaluator = function(spec) {
return that;
};
-IPA.host.has_keytab_evaluator = function(spec) {
-
- spec.name = spec.name || 'has_keytab_evaluator';
- spec.attribute = spec.attribute || 'has_keytab';
- spec.value = spec.value || [true];
- spec.representation = spec.representation || 'has_keytab';
-
- var that = IPA.value_state_evaluator(spec);
- return that;
-};
-
IPA.host_password_widget = function(spec) {
spec = spec || {};
@@ -1007,8 +1035,11 @@ IPA.host.has_password_evaluator = function(spec) {
spec.attribute = spec.attribute || 'has_password';
spec.value = spec.value || [true];
spec.representation = spec.representation || 'has_password';
+ spec.param = spec.param || 'has_password';
+ spec.adapter = spec.adapter || { $type: 'adapter' };
var that = IPA.value_state_evaluator(spec);
+
return that;
};