summaryrefslogtreecommitdiffstats
path: root/install/ui/entity.js
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2011-11-16 21:07:20 -0600
committerEndi S. Dewata <edewata@redhat.com>2011-12-06 22:07:52 +0000
commita8ea42bda841c8773d68886614faf9efd38e33bd (patch)
tree92ddaae7ead82784eefb8dde81bc81e91945bfa0 /install/ui/entity.js
parent6f0c16e4289dd1a68bfd673da52a511087d84b9a (diff)
downloadfreeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.tar.gz
freeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.tar.xz
freeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.zip
Fixed entity metadata resolution.
The current code assumes that an entity will always have a corresponding LDAPObject on the server, so it looks for the metadata in a fixed location. This assumption doesn't work for HBAC Test since it is a Command, not an LDAPObject, so the metadata has to be obtained from a different location. A new method get_default_metadata() has been added to allow each entity to find the metadata from the correct location. Ticket #388
Diffstat (limited to 'install/ui/entity.js')
-rw-r--r--install/ui/entity.js33
1 files changed, 21 insertions, 12 deletions
diff --git a/install/ui/entity.js b/install/ui/entity.js
index 4e5c72447..a701009a3 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -32,10 +32,12 @@ IPA.entity = function(spec) {
spec = spec || {};
var that = {};
- that.metadata = spec.metadata;
+
that.name = spec.name;
- that.label = spec.label || spec.metadata.label || spec.name;
- that.title = spec.title || that.label;
+ that.label = spec.label;
+
+ that.metadata = spec.metadata;
+ that.builder = spec.builder;
that.dialogs = $.ordered_map();
that.dialog_specs = spec.dialogs || [];
@@ -52,7 +54,21 @@ IPA.entity = function(spec) {
that.redirect_facet = spec.redirect_facet;
that.containing_entity = null;
- that.init = function(params) {
+ that.init = function() {
+ if (!that.metadata) {
+ that.metadata = that.get_default_metadata();
+ if (!that.metadata) {
+ throw {
+ expected: true,
+ message: "Entity " + that.name + " not supported by server."
+ };
+ }
+ }
+ that.label = that.label || that.metadata.label || that.name;
+ };
+
+ that.get_default_metadata = function() {
+ return IPA.metadata.objects[that.name];
};
that.get_containing_entity = function() {
@@ -210,6 +226,7 @@ IPA.entity = function(spec) {
pkey.unshift(IPA.nav.get_state(current_entity.name+'-pkey'));
return pkey;
};
+
/* most entites only require -pkey for their primary keys, but some
are more specific. This call allows those entites a place
to override the other parameters. */
@@ -305,14 +322,6 @@ IPA.entity_builder = function() {
spec = { name: spec };
}
- spec.metadata = spec.metadata || IPA.metadata.objects[spec.name];
- if (!spec.metadata) {
- throw {
- expected: true,
- message: "Entity " + spec.name + "not supported by server."
- };
- }
-
entity = factory(spec);
that.facet_groups([