diff options
22 files changed, 1751 insertions, 1634 deletions
diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js index c98edd168..8bde8a0e2 100644 --- a/install/ui/src/freeipa/aci.js +++ b/install/ui/src/freeipa/aci.js @@ -31,21 +31,21 @@ define([ './entity'], function(IPA, $, phases, reg, text) { -IPA.aci = {}; +var exp = IPA.aci = {}; -IPA.aci.permission_entity = function(spec) { +var make_permission_spec = function() { - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups(['settings', 'privilege']). - search_facet({ +return { + name: 'permission', + facet_groups: ['settings', 'privilege'], + facets: [ + { + $type: 'search', columns: [ 'cn' ] - }). - details_facet({ + }, + { $factory: IPA.aci.permission_details_facet, + $type: 'details', fields: [ { name:'cn', @@ -137,99 +137,98 @@ IPA.aci.permission_entity = function(spec) { widget_name: 'target' } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'member_privilege', facet_group: 'privilege' - }). - adder_dialog({ - height: 450, - fields: [ - { - name:'cn', - widget: 'general.cn' - }, - { - $type: 'rights', - name: 'permissions', - widget: 'general.permissions' - }, - { - $type: 'select', - name: 'target', - widget: 'target.target', - enabled: false - }, - { - name: 'filter', - widget: 'target.filter', - enabled: false - }, - { - $type: 'entity_select', - name: 'memberof', - widget: 'target.memberof', - enabled: false - }, - { - name: 'subtree', - widget: 'target.subtree', - enabled: false - }, - { - $type: 'entity_select', - name: 'targetgroup', - widget: 'target.targetgroup', - enabled: false - }, - { - $type: 'select', - name: 'type', - widget: 'target.type', - enabled: false - }, - { - name: 'attrs', - widget: 'target.attrs', - enabled: false - }, - { - name: 'attrs_multi', - $type: 'multivalued', - param: 'attrs', - widget: 'target.attrs_multi', - enabled: false - } - ], - widgets: [ - { - $type: 'details_table_section_nc', - name: 'general', - widgets: [ - 'cn', - { - $type: 'rights', - name: 'permissions' - } - ] - }, - { - $type: 'permission_target', - name:'target', - show_target: true - } - ], - policies: [ - { - $factory: IPA.permission_target_policy, - widget_name: 'target' - } - ] - }); - }; - - return that; -}; + } + ], + adder_dialog: { + height: 450, + fields: [ + { + name:'cn', + widget: 'general.cn' + }, + { + $type: 'rights', + name: 'permissions', + widget: 'general.permissions' + }, + { + $type: 'select', + name: 'target', + widget: 'target.target', + enabled: false + }, + { + name: 'filter', + widget: 'target.filter', + enabled: false + }, + { + $type: 'entity_select', + name: 'memberof', + widget: 'target.memberof', + enabled: false + }, + { + name: 'subtree', + widget: 'target.subtree', + enabled: false + }, + { + $type: 'entity_select', + name: 'targetgroup', + widget: 'target.targetgroup', + enabled: false + }, + { + $type: 'select', + name: 'type', + widget: 'target.type', + enabled: false + }, + { + name: 'attrs', + widget: 'target.attrs', + enabled: false + }, + { + name: 'attrs_multi', + $type: 'multivalued', + param: 'attrs', + widget: 'target.attrs_multi', + enabled: false + } + ], + widgets: [ + { + $type: 'details_table_section_nc', + name: 'general', + widgets: [ + 'cn', + { + $type: 'rights', + name: 'permissions' + } + ] + }, + { + $type: 'permission_target', + name:'target', + show_target: true + } + ], + policies: [ + { + $factory: IPA.permission_target_policy, + widget_name: 'target' + } + ] + } +};}; IPA.aci.permission_details_facet = function(spec) { @@ -242,21 +241,20 @@ IPA.aci.permission_details_facet = function(spec) { return that; }; -IPA.aci.privilege_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups(['permission', 'settings', 'role']). - search_facet({ +var make_privilege_spec = function() { +return { + name: 'privilege', + facet_groups: ['permission', 'settings', 'role'], + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'identity', @@ -270,50 +268,49 @@ IPA.aci.privilege_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'member_role', facet_group: 'role', add_method: 'add_privilege', remove_method: 'remove_privilege', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_permission', facet_group: 'permission', add_method: 'add_permission', remove_method: 'remove_permission' - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; - -IPA.aci.role_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups(['member', 'privilege', 'settings']). - search_facet({ + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; + +var make_role_spec = function() { +return { + name: 'role', + facet_groups: ['member', 'privilege', 'settings'], + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'identity', @@ -327,40 +324,38 @@ IPA.aci.role_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_privilege', facet_group: 'privilege', add_method: 'add_privilege', remove_method: 'remove_privilege' - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; - -IPA.aci.selfservice_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; + +var make_selfservice_spec = function() { +return { + name: 'selfservice', + facets: [ + { + $type: 'search', columns: [ 'aciname' ], pagination: false - }). - details_facet({ + }, + { + $type: 'details', check_rights: false, sections: [ { @@ -376,36 +371,32 @@ IPA.aci.selfservice_entity = function(spec) { ] } ] - }). - adder_dialog({ - fields: [ - 'aciname', - { - $type: 'attributes', - object_type: 'user', - name: 'attrs' - } - ] - }); - }; - - return that; -}; - -IPA.aci.delegation_entity = function(spec) { - - var that = IPA.entity(spec); - - that.group_entity = IPA.get_entity(spec.group_entity || 'group'); + } + ], + adder_dialog: { + fields: [ + 'aciname', + { + $type: 'attributes', + object_type: 'user', + name: 'attrs' + } + ] + } +};}; - that.init = function() { - that.entity_init(); - that.builder.search_facet({ +var make_delegation_spec = function() { +return { + name: 'delegation', + facets: [ + { + $type: 'search', columns: [ 'aciname' ], pagination: false - }). - details_facet({ + }, + { + $type: 'details', check_rights: false, sections: [ { @@ -422,13 +413,13 @@ IPA.aci.delegation_entity = function(spec) { { $type: 'entity_select', name: 'group', - other_entity: that.group_entity, + other_entity: 'group', other_field: 'cn' }, { $type: 'entity_select', name: 'memberof', - other_entity: that.group_entity, + other_entity: 'group', other_field: 'cn' }, { @@ -439,39 +430,37 @@ IPA.aci.delegation_entity = function(spec) { ] } ] - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'aciname', - { - $type: 'checkboxes', - name: 'permissions', - options: IPA.create_options(['read', 'write']) - }, - { - $type: 'entity_select', - name: 'group', - other_entity: that.group_entity, - other_field: 'cn' - }, - { - $type: 'entity_select', - name: 'memberof', - other_entity: that.group_entity, - other_field: 'cn' - }, - { - $type: 'attributes', - name: 'attrs', - object_type: 'user' - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: false, + adder_dialog: { + fields: [ + 'aciname', + { + $type: 'checkboxes', + name: 'permissions', + options: IPA.create_options(['read', 'write']) + }, + { + $type: 'entity_select', + name: 'group', + other_entity: 'group', + other_field: 'cn' + }, + { + $type: 'entity_select', + name: 'memberof', + other_entity: 'group', + other_field: 'cn' + }, + { + $type: 'attributes', + name: 'attrs', + object_type: 'user' + } + ] + } +};}; IPA.attributes_widget = function(spec) { @@ -903,17 +892,23 @@ IPA.permission_target_policy = function (spec) { return that; }; +exp.permission_entity_spec = make_permission_spec(); +exp.privilege_entity_spec = make_privilege_spec(); +exp.role_entity_spec = make_role_spec(); +exp.selfservice_entity_spec = make_selfservice_spec(); +exp.delegation_entity_spec = make_delegation_spec(); -IPA.register('permission', IPA.aci.permission_entity); -IPA.register('privilege', IPA.aci.privilege_entity); -IPA.register('role', IPA.aci.role_entity); -IPA.register('selfservice', IPA.aci.selfservice_entity); -IPA.register('delegation', IPA.aci.delegation_entity); - -IPA.aci.register = function() { +exp.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; + e.register({ type: 'permission', spec: exp.permission_entity_spec }); + e.register({ type: 'privilege', spec: exp.privilege_entity_spec }); + e.register({ type: 'role', spec: exp.role_entity_spec }); + e.register({ type: 'selfservice', spec: exp.selfservice_entity_spec }); + e.register({ type: 'delegation', spec: exp.delegation_entity_spec }); + w.register('attributes', IPA.attributes_widget); f.register('attributes', IPA.checkboxes_field); w.register('rights', IPA.rights_widget); @@ -921,7 +916,7 @@ IPA.aci.register = function() { w.register('permission_target', IPA.permission_target_widget); }; -phases.on('registration', IPA.aci.register); +phases.on('registration', exp.register); -return IPA.aci; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index c163e188e..997799e00 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -31,20 +31,14 @@ define([ './entity'], function(IPA, $, navigation, phases, reg, text) { -IPA.automember = {}; +var exp = IPA.automember = {}; -IPA.automember.entity = function(spec) { +var make_spec = function() { +return { - //HACK: Automember takes_params is missing a cn attribute. This hack - //copies cn from mod command. Also it is set as pkey. - var pkey_attr = IPA.metadata.commands.automember_mod.takes_args[0]; - pkey_attr.primary_key = true; - IPA.metadata.objects.automember.takes_params.push(pkey_attr); - IPA.metadata.objects.automember.primary_key = pkey_attr.name; + name: 'automember', - spec = spec || {}; - - spec.policies = spec.policies || [ + policies:[ { $factory: IPA.facet_update_policy, source_facet: 'usergrouprule', @@ -55,16 +49,11 @@ IPA.automember.entity = function(spec) { source_facet: 'hostgrouprule', dest_facet: 'searchhostgroup' } - ]; - - var that = IPA.entity(spec); - - that.init = function() { - - that.entity_init(); - - that.builder.search_facet({ + ], + facets: [ + { $factory: IPA.automember.rule_search_facet, + $type: 'search', name: 'searchgroup', group_type: 'group', label: '@i18n:objects.automember.usergrouprules', @@ -74,9 +63,10 @@ IPA.automember.entity = function(spec) { 'cn', 'description' ] - }). - search_facet({ + }, + { $factory: IPA.automember.rule_search_facet, + $type: 'search', name: 'searchhostgroup', group_type: 'hostgroup', label: '@i18n:objects.automember.hostgrouprules', @@ -86,47 +76,56 @@ IPA.automember.entity = function(spec) { 'cn', 'description' ] - }). - details_facet({ + }, + { $factory: IPA.automember.rule_details_facet, + $type: 'details', name: 'usergrouprule', group_type: 'group', label: '@i18n:objects.automember.usergrouprule', disable_facet_tabs: true, check_rights: false, redirect_info: { facet: 'searchgroup' } - }). - details_facet({ + }, + { $factory: IPA.automember.rule_details_facet, + $type: 'details', name: 'hostgrouprule', group_type: 'hostgroup', label: '@i18n:objects.automember.hostgrouprule', disable_facet_tabs: true, check_rights: false, redirect_info: { facet: 'searchhostgroup' } - }). - adder_dialog({ - $factory: IPA.automember.rule_adder_dialog, - title: '@i18n:objects.automember.add_rule', - fields: [ - { - $type: 'entity_select', - name: 'cn', - other_entity: 'group', - other_field: 'cn' - } - ], - height: '300' - }). - deleter_dialog({ - $factory: IPA.automember.rule_deleter_dialog - }); - }; + } + ], + adder_dialog: { + $factory: IPA.automember.rule_adder_dialog, + title: '@i18n:objects.automember.add_rule', + fields: [ + { + $type: 'entity_select', + name: 'cn', + other_entity: 'group', + other_field: 'cn' + } + ], + height: '300' + }, + deleter_dialog: { + $factory: IPA.automember.rule_deleter_dialog + } +};}; - return that; +exp.metadata_extension_pre_op = function(spec, context) { + //HACK: Automember takes_params is missing a cn attribute. This hack + //copies cn from mod command. Also it is set as pkey. + var pkey_attr = IPA.metadata.commands.automember_mod.takes_args[0]; + pkey_attr.primary_key = true; + IPA.metadata.objects.automember.takes_params.push(pkey_attr); + IPA.metadata.objects.automember.primary_key = pkey_attr.name; + return spec; }; - IPA.automember.rule_search_facet = function(spec) { spec = spec || {}; @@ -698,16 +697,23 @@ IPA.automember.default_group_widget = function(spec) { return that; }; +exp.entity_spec = make_spec(); -IPA.register('automember', IPA.automember.entity); - -phases.on('registration', function() { +exp.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; + e.register({ + type: 'automember', + spec: exp.entity_spec, + pre_ops: [ exp.metadata_extension_pre_op ] + }); w.register('automember_condition', IPA.automember.condition_widget); f.register('automember_condition', IPA.automember.condition_field); -}); +}; + +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/automount.js b/install/ui/src/freeipa/automount.js index 202bac1c1..ac2c21c14 100644 --- a/install/ui/src/freeipa/automount.js +++ b/install/ui/src/freeipa/automount.js @@ -18,32 +18,41 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './navigation', './details', './search', './association', - './entity'], function(IPA, $, navigation) { - -IPA.automount = {}; - -IPA.automount.location_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups([ 'automountmap', 'settings' ]). - search_facet({ +define([ + './ipa', + './jquery', + './navigation', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, navigation, phases, reg) { + +var exp = IPA.automount = {}; + +var make_location_spec = function() { +return { + name: 'automountlocation', + facet_groups: [ 'automountmap', 'settings' ], + facets: [ + { + $type: 'search', title: IPA.metadata.objects.automountlocation.label, columns:['cn'] - }). - nested_search_facet({ + }, + { + $type: 'nested_search', facet_group: 'automountmap', nested_entity: 'automountmap', label: IPA.metadata.objects.automountmap.label, tab_label: IPA.metadata.objects.automountmap.label, name: 'maps', columns: [ 'automountmapname' ] - }). - details_facet({ + }, + { + $type: 'details', sections:[ { name: 'identity', @@ -51,25 +60,21 @@ IPA.automount.location_entity = function(spec) { fields: [ 'cn' ] } ] - }). - adder_dialog({ - fields: [ 'cn' ] - }); - }; - - return that; -}; - -IPA.automount.map_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.containing_entity('automountlocation'). - facet_groups([ 'automountkey', 'settings' ]). - nested_search_facet({ + } + ], + adder_dialog: { + fields: [ 'cn' ] + } +};}; + +var make_map_spec = function() { +return { + name: 'automountmap', + containing_entity: 'automountlocation', + facet_groups: [ 'automountkey', 'settings' ], + facets: [ + { + $type: 'nested_search', $factory: IPA.automount.key_search_facet, facet_group: 'automountkey', nested_entity: 'automountkey', @@ -85,8 +90,9 @@ IPA.automount.map_entity = function(spec) { }, 'automountinformation' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'identity', @@ -100,76 +106,69 @@ IPA.automount.map_entity = function(spec) { ] } ] - }). - adder_dialog({ - $factory: IPA.automountmap_adder_dialog, - sections: [ - { - name: 'general', - fields: [ - { - $type: 'radio', - name: 'method', - enabled: false, //don't use value in add command - label: '@i18n:objects.automountmap.map_type', - options: [ - { - value: 'add', - label: '@i18n:objects.automountmap.direct' - }, - { - value: 'add_indirect', - label: '@i18n:objects.automountmap.indirect' - } - ] - }, - 'automountmapname', - { - $type: 'textarea', - name: 'description' - } - ] - }, - { - name: 'indirect', - fields: [ - { - name: 'key', - label: '@mc-opt:automountmap_add_indirect:key:label' - }, - { - name: 'parentmap', - label: '@mc-opt:automountmap_add_indirect:parentmap:label' - } - ] - } - ] - }); - }; - - return that; -}; - -IPA.automount.key_entity = function(spec) { - - spec = spec || {}; - - spec.policies = spec.policies || [ + } + ], + adder_dialog: { + $factory: IPA.automountmap_adder_dialog, + sections: [ + { + name: 'general', + fields: [ + { + $type: 'radio', + name: 'method', + enabled: false, //don't use value in add command + label: '@i18n:objects.automountmap.map_type', + options: [ + { + value: 'add', + label: '@i18n:objects.automountmap.direct' + }, + { + value: 'add_indirect', + label: '@i18n:objects.automountmap.indirect' + } + ] + }, + 'automountmapname', + { + $type: 'textarea', + name: 'description' + } + ] + }, + { + name: 'indirect', + fields: [ + { + name: 'key', + label: '@mc-opt:automountmap_add_indirect:key:label' + }, + { + name: 'parentmap', + label: '@mc-opt:automountmap_add_indirect:parentmap:label' + } + ] + } + ] + } +};}; + +var make_key_spec = function() { +return { + name: 'automountkey', + policies:[ { $factory: IPA.facet_update_policy, source_facet: 'details', dest_entity: 'automountmap', dest_facet: 'keys' } - ]; - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.containing_entity('automountmap'). - details_facet({ + ], + containing_entity: 'automountmap', + facets: [ + { + $type: 'details', $factory: IPA.automount.key_details_facet, sections: [ { @@ -185,28 +184,26 @@ IPA.automount.key_entity = function(spec) { } ], disable_breadcrumb: false - }). - adder_dialog({ - show_edit_page : function(entity, result){ - var key = result.automountkey[0]; - var info = result.automountinformation[0]; - var pkeys = this.pkey_prefix.slice(0); - pkeys.push(key); - - var args = { - info: info, - key: key - }; - - navigation.show_entity(entity.name, 'details', pkeys, args); - return false; - }, - fields:['automountkey','automountinformation'] - }); - }; - - return that; -}; + } + ], + adder_dialog: { + show_edit_page : function(entity, result){ + var key = result.automountkey[0]; + var info = result.automountinformation[0]; + var pkeys = this.pkey_prefix.slice(0); + pkeys.push(key); + + var args = { + info: info, + key: key + }; + + navigation.show_entity(entity.name, 'details', pkeys, args); + return false; + }, + fields:['automountkey','automountinformation'] + } +};}; IPA.automount.key_details_facet = function(spec) { @@ -355,9 +352,19 @@ IPA.automount.key_search_facet = function(spec) { return that; }; -IPA.register('automountlocation', IPA.automount.location_entity); -IPA.register('automountmap', IPA.automount.map_entity); -IPA.register('automountkey', IPA.automount.key_entity); +exp.location_spec = make_location_spec(); +exp.map_spec = make_map_spec(); +exp.key_spec = make_key_spec(); + +exp.register = function() { + var e = reg.entity; + + e.register({type: 'automountlocation', spec: exp.location_spec}); + e.register({type: 'automountmap', spec: exp.map_spec}); + e.register({type: 'automountkey', spec: exp.key_spec}); +}; + +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index b18e2ae50..379ad2d5b 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -29,7 +29,7 @@ define([ './dialog'], function(lang, IPA, $, phases, reg, text) { -IPA.cert = {}; +var exp = IPA.cert = {}; IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----'; IPA.cert.END_CERTIFICATE = '-----END CERTIFICATE-----'; @@ -942,12 +942,92 @@ IPA.cert.status_field = function(spec) { }; +exp.create_cert_metadata = function() { -IPA.cert.entity = function(spec) { + var add_param = function(name, label, doc, primary_key) { + entity.takes_params.push({ + name: name, + label: label, + doc: doc, + primary_key: !!primary_key, + flags: ['no_update'] + }); + }; - spec = spec || {}; + var get_param = function(params, name) { + + for (var i=0;i<params.length;i++) { + if (params[i].name === name) return params[i]; + } + return null; + }; + + var cmd = IPA.metadata.commands['cert_find']; + var entity = lang.clone(cmd); + entity.attribute_members = {}; + entity.label = text.get('@i18n:objects.cert.certificates'); + entity.label_singular = text.get('@i18n:objects.cert.certificate'); + entity.methods = [ + 'find', + 'remove-hold', + 'request', + 'revoke', + 'show', + 'status' + ]; + entity.name = "certificate"; + entity.object_name = "certificate"; + entity.object_name_plural = "certificates"; + entity.parent_object = ""; + entity.primary_key = "serial_number"; + entity.rdn_attribute = ""; + entity.relationships = {}; + entity.takes_params = lang.clone(entity.takes_options); + + get_param(entity.takes_params, 'subject').flags = ['no_update']; + var reason = get_param(entity.takes_params, 'revocation_reason'); + reason.flags = ['no_update']; + reason.label = text.get('@i18n:objects.cert.revocation_reason'); + + add_param('serial_number', + text.get('@i18n:objects.cert.serial_number'), + text.get('@i18n:objects.cert.serial_number'), + true); + add_param('serial_number_hex', + text.get('@i18n:objects.cert.serial_number_hex'), + text.get('@i18n:objects.cert.serial_number_hex')); + add_param('issuer', + text.get('@i18n:objects.cert.issued_by'), + text.get('@i18n:objects.cert.issued_by')); + add_param('status', + text.get('@i18n:objects.cert.status'), + text.get('@i18n:objects.cert.status')); + add_param('valid_not_before', + text.get('@i18n:objects.cert.issued_on'), + text.get('@i18n:objects.cert.issued_on')); + add_param('valid_not_after', + text.get('@i18n:objects.cert.expires_on'), + text.get('@i18n:objects.cert.expires_on')); + add_param('md5_fingerprint', + text.get('@i18n:objects.cert.md5_fingerprint'), + text.get('@i18n:objects.cert.md5_fingerprint')); + add_param('sha1_fingerprint', + text.get('@i18n:objects.cert.sha1_fingerprint'), + text.get('@i18n:objects.cert.sha1_fingerprint')); + add_param('certificate', + text.get('@i18n:objects.cert.certificate'), + text.get('@i18n:objects.cert.certificate')); + + + IPA.metadata.objects.cert = entity; + return entity; +}; + +var make_spec = function() { +return { + name: 'cert', - spec.policies = spec.policies || [ + policies: [ IPA.search_facet_update_policy, IPA.details_facet_update_policy, { @@ -967,102 +1047,13 @@ IPA.cert.entity = function(spec) { dest_entity: 'service', dest_facet: 'details' } - ]; - - var that = IPA.entity(spec); - - that.get_default_metadata = function() { - - var add_param = function(name, label, doc, primary_key) { - entity.takes_params.push({ - name: name, - label: label, - doc: doc, - primary_key: !!primary_key, - flags: ['no_update'] - }); - }; - - var get_param = function(params, name) { - - for (var i=0;i<params.length;i++) { - if (params[i].name === name) return params[i]; - } - return null; - }; - - var cmd = IPA.metadata.commands['cert_find']; - var entity = lang.clone(cmd); - entity.attribute_members = {}; - entity.label = text.get('@i18n:objects.cert.certificates'); - entity.label_singular = text.get('@i18n:objects.cert.certificate'); - entity.methods = [ - 'find', - 'remove-hold', - 'request', - 'revoke', - 'show', - 'status' - ]; - entity.name = "certificate"; - entity.object_name = "certificate"; - entity.object_name_plural = "certificates"; - entity.parent_object = ""; - entity.primary_key = "serial_number"; - entity.rdn_attribute = ""; - entity.relationships = {}; - entity.takes_params = lang.clone(entity.takes_options); - - get_param(entity.takes_params, 'subject').flags = ['no_update']; - var reason = get_param(entity.takes_params, 'revocation_reason'); - reason.flags = ['no_update']; - reason.label = text.get('@i18n:objects.cert.revocation_reason'); - - add_param('serial_number', - text.get('@i18n:objects.cert.serial_number'), - text.get('@i18n:objects.cert.serial_number'), - true); - add_param('serial_number_hex', - text.get('@i18n:objects.cert.serial_number_hex'), - text.get('@i18n:objects.cert.serial_number_hex')); - add_param('issuer', - text.get('@i18n:objects.cert.issued_by'), - text.get('@i18n:objects.cert.issued_by')); - add_param('status', - text.get('@i18n:objects.cert.status'), - text.get('@i18n:objects.cert.status')); - add_param('valid_not_before', - text.get('@i18n:objects.cert.issued_on'), - text.get('@i18n:objects.cert.issued_on')); - add_param('valid_not_after', - text.get('@i18n:objects.cert.expires_on'), - text.get('@i18n:objects.cert.expires_on')); - add_param('md5_fingerprint', - text.get('@i18n:objects.cert.md5_fingerprint'), - text.get('@i18n:objects.cert.md5_fingerprint')); - add_param('sha1_fingerprint', - text.get('@i18n:objects.cert.sha1_fingerprint'), - text.get('@i18n:objects.cert.sha1_fingerprint')); - add_param('certificate', - text.get('@i18n:objects.cert.certificate'), - text.get('@i18n:objects.cert.certificate')); - - - IPA.metadata.objects.cert = entity; - return entity; - }; - - that.init = function() { - - if (!IPA.cert.is_enabled()) { - throw { - expected: true - }; - } - - that.entity_init(); - - that.builder.search_facet({ + ], + enable_test: function() { + return IPA.cert.is_enabled(); + }, + facets: [ + { + $type: 'search', $factory: IPA.cert.search_facet, pagination: false, no_update: true, @@ -1128,8 +1119,9 @@ IPA.cert.entity = function(spec) { label: '@i18n:objects.cert.find_revokedon_to' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.cert.details_facet, no_update: true, actions: [ @@ -1187,11 +1179,9 @@ IPA.cert.entity = function(spec) { section: 'details' } ] - }); - }; - - return that; -}; + } + ] +};}; IPA.cert.search_facet = function(spec) { @@ -1314,13 +1304,16 @@ IPA.cert.cert_update_policy = function(spec) { -IPA.register('cert', IPA.cert.entity); +exp.entity_spec = make_spec(); -phases.on('registration', function() { +exp.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; var a = reg.action; + e.register({type: 'cert', spec: exp.entity_spec}); + w.register('certificate_status', IPA.cert.status_widget); f.register('certificate_status', IPA.cert.status_field); @@ -1332,7 +1325,10 @@ phases.on('registration', function() { a.register('cert_request', IPA.cert.request_action); a.register('cert_revoke', IPA.cert.revoke_action); a.register('cert_restore', IPA.cert.restore_action); -}); +}; + +phases.on('registration', exp.register); +phases.on('post-metadata', exp.create_cert_metadata); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index 5fa6a6578..e7ff60332 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -35,28 +35,20 @@ define([ './entity'], function(IPA, $, NET, navigation, menu, phases, reg, text) { -IPA.dns = { +var exp = IPA.dns = { zone_permission_name: 'Manage DNS zone ${dnszone}' }; -IPA.dns.config_entity = function(spec) { - - spec = spec || {}; - spec.defines_key = false; - - var that = IPA.entity(spec); - - that.init = function() { - - if (!IPA.dns_enabled) { - throw { - expected: true - }; - } - - that.entity_init(); - - that.builder.details_facet({ +var make_config_spec = function() { +return { + name: 'dnsconfig', + defines_key: false, + enable_test: function() { + return IPA.dns_enabled; + }, + facets: [ + { + $type: 'details', title: IPA.metadata.objects.config.label, sections: [ { @@ -96,28 +88,20 @@ IPA.dns.config_entity = function(spec) { } ], needs_update: true - }); - }; - - return that; -}; - -IPA.dns.zone_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - - if (!IPA.dns_enabled) { - throw { - expected: true - }; } - - that.entity_init(); - - that.builder.facet_groups([ 'dnsrecord', 'settings' ]). - search_facet({ + ] +};}; + +var make_zone_spec = function() { +return { + name: 'dnszone', + enable_test: function() { + return IPA.dns_enabled; + }, + facet_groups: [ 'dnsrecord', 'settings' ], + facets: [ + { + $type: 'search', row_enabled_attribute: 'idnszoneactive', title: IPA.metadata.objects.dnszone.label, columns: [ @@ -144,8 +128,9 @@ IPA.dns.zone_entity = function(spec) { icon: 'enabled-icon' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.dnszone_details_facet, command_mode: 'info', sections: [ @@ -259,8 +244,9 @@ IPA.dns.zone_entity = function(spec) { IPA.disabled_summary_cond ] } - }). - nested_search_facet({ + }, + { + $type: 'nested_search', $factory: IPA.dns.record_search_facet, facet_group: 'dnsrecord', nested_entity : 'dnsrecord', @@ -284,54 +270,53 @@ IPA.dns.zone_entity = function(spec) { label: '@i18n:objects.dnsrecord.data' } ] - }). - standard_association_facets(). - adder_dialog({ - $factory: IPA.dnszone_adder_dialog, - height: 300, - sections: [ - { - $factory: IPA.dnszone_name_section, - name: 'name', - fields: [ - { - $type: 'dnszone_name', - name: 'idnsname', - required: false, - radio_name: 'dnszone_name_type' - }, - { - $type: 'dnszone_name', - name: 'name_from_ip', - radio_name: 'dnszone_name_type', - validators: ['network'] - } - ] - }, - { - name: 'other', - fields: [ - 'idnssoamname', - { - name: 'idnssoarname', - required: false - }, - { - $type: 'force_dnszone_add_checkbox', - name: 'force', - metadata: '@mc-opt:dnszone_add:force' - } - ] - } - ], - policies: [ - IPA.add_dns_zone_name_policy - ] - }); - }; + } + ], + standard_association_facets: true, + adder_dialog: { + $factory: IPA.dnszone_adder_dialog, + height: 300, + sections: [ + { + $factory: IPA.dnszone_name_section, + name: 'name', + fields: [ + { + $type: 'dnszone_name', + name: 'idnsname', + required: false, + radio_name: 'dnszone_name_type' + }, + { + $type: 'dnszone_name', + name: 'name_from_ip', + radio_name: 'dnszone_name_type', + validators: ['network'] + } + ] + }, + { + name: 'other', + fields: [ + 'idnssoamname', + { + name: 'idnssoarname', + required: false + }, + { + $type: 'force_dnszone_add_checkbox', + name: 'force', + metadata: '@mc-opt:dnszone_add:force' + } + ] + } + ], + policies: [ + IPA.add_dns_zone_name_policy + ] + } +};}; - return that; -}; IPA.dnszone_details_facet = function(spec, no_init) { @@ -1129,11 +1114,14 @@ IPA.dns.get_record_type = function(type_name) { return null; }; -IPA.dns.record_entity = function(spec) { - - spec = spec || {}; - spec.policies = spec.policies || [ +var make_record_spec = function() { +return { + name: 'dnsrecord', + enable_test: function() { + return IPA.dns_enabled; + }, + policies: [ { $factory: IPA.facet_update_policy, source_facet: 'details', @@ -1141,22 +1129,11 @@ IPA.dns.record_entity = function(spec) { dest_facet: 'records' }, IPA.adder_facet_update_policy - ]; - - var that = IPA.entity(spec); - - that.init = function() { - - if (!IPA.dns_enabled) { - throw { - expected: true - }; - } - - that.entity_init(); - - that.builder.containing_entity('dnszone'). - details_facet({ + ], + containing_entity: 'dnszone', + facets: [ + { + $type: 'details', $factory: IPA.dns.record_details_facet, disable_breadcrumb: false, fields: [ @@ -1182,46 +1159,44 @@ IPA.dns.record_entity = function(spec) { ] } ] - }). - adder_dialog({ - $factory: IPA.dns.record_adder_dialog, - fields: [ - { - name: 'idnsname', - widget: 'general.idnsname' - }, - { - name: 'record_type', - $type: 'dnsrecord_type', - flags: ['no_command'], - widget: 'general.record_type' - } - ], - widgets: [ - { - name: 'general', - $type: 'details_table_section_nc', - widgets: [ - 'idnsname', - { - $type: 'dnsrecord_type', - name: 'record_type', - label: '@i18n:objects.dnsrecord.type' - } - ] - } - ], - policies: [ - { - $factory: IPA.dnsrecord_adder_dialog_type_policy, - type_field: 'record_type' - } - ] - }); - }; - - return that; -}; + } + ], + adder_dialog: { + $factory: IPA.dns.record_adder_dialog, + fields: [ + { + name: 'idnsname', + widget: 'general.idnsname' + }, + { + name: 'record_type', + $type: 'dnsrecord_type', + flags: ['no_command'], + widget: 'general.record_type' + } + ], + widgets: [ + { + name: 'general', + $type: 'details_table_section_nc', + widgets: [ + 'idnsname', + { + $type: 'dnsrecord_type', + name: 'record_type', + label: '@i18n:objects.dnsrecord.type' + } + ] + } + ], + policies: [ + { + $factory: IPA.dnsrecord_adder_dialog_type_policy, + type_field: 'record_type' + } + ] + } +};}; IPA.dns.record_adder_dialog = function(spec) { @@ -2523,22 +2498,26 @@ IPA.network_validator = function(spec) { return that; }; -phases.on('profile', function() { +exp.remove_menu_item = function() { if (!IPA.dns_enabled) { menu.remove_item('identity/dns'); } -}, 20); - -IPA.register('dnsconfig', IPA.dns.config_entity); -IPA.register('dnszone', IPA.dns.zone_entity); -IPA.register('dnsrecord', IPA.dns.record_entity); +}; -phases.on('registration', function() { +exp.config_spec = make_config_spec(); +exp.zone_spec = make_zone_spec(); +exp.record_spec = make_record_spec(); +exp.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; var v = reg.validator; var a = reg.action; + e.register({type: 'dnsconfig', spec: exp.config_spec}); + e.register({type: 'dnszone', spec: exp.zone_spec}); + e.register({type: 'dnsrecord', spec: exp.record_spec}); + w.register('dnszone_name', IPA.dnszone_name_widget); w.register('force_dnszone_add_checkbox', IPA.force_dnszone_add_checkbox_widget); f.register('force_dnszone_add_checkbox', IPA.checkbox_field); @@ -2559,7 +2538,10 @@ phases.on('registration', function() { a.register('dns_add_permission', IPA.dns.add_permission_action); a.register('dns_remove_permission', IPA.dns.remove_permission_action); -}); +}; + +phases.on('registration', exp.register); +phases.on('profile', exp.remove_menu_item, 20); -return {}; +return exp; }); diff --git a/install/ui/src/freeipa/entitle.js b/install/ui/src/freeipa/entitle.js index 2430e2890..77dd0836d 100644 --- a/install/ui/src/freeipa/entitle.js +++ b/install/ui/src/freeipa/entitle.js @@ -18,28 +18,35 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './text', './details', './search', './add', - './facet', './entity', './field', './widget'], function(IPA, $, text) { - -IPA.entitle = {}; +define([ + './ipa', + './jquery', + './phases', + './reg', + './text', + './details', + './search', + './add', + './facet', + './entity', + './field', + './widget'], + function(IPA, $, phases, reg, text) { + +var exp = IPA.entitle = {}; IPA.entitle.unregistered = 'unregistered'; IPA.entitle.online = 'online'; IPA.entitle.offline = 'offline'; -IPA.entitle.entity = function(spec) { - - spec = spec || {}; - - var that = IPA.entity(spec); - - that.status = IPA.entitle.unregistered; - - that.init = function() { - that.entity_init(); - that.builder.facet_groups([ 'account', 'certificates' ]). - details_facet({ +var make_spec = function() { +return { + name: 'entitle', + facet_groups: [ 'account', 'certificates' ], + facets: [ + { + $type: 'details', $factory: IPA.entitle.details_facet, label: '@i18n:objects.entitle.account', facet_group: 'account', @@ -82,8 +89,8 @@ IPA.entitle.entity = function(spec) { ] } ] - }). - facet({ + }, + { $factory: IPA.entitle.certificates_facet, name: 'certificates', label: '@i18n:objects.entitle.certificates', @@ -111,9 +118,11 @@ IPA.entitle.entity = function(spec) { label: '@i18n:objects.entitle.certificate' } ] - }). - standard_association_facets(). - dialog({ + } + ], + standard_association_facets: true, + dialogs: [ + { $factory: IPA.entitle.register_online_dialog, name: 'online_registration', title: '@i18n:objects.entitle.registration', @@ -134,8 +143,8 @@ IPA.entitle.entity = function(spec) { } */ ] - }). - dialog({ + }, + { $factory: IPA.entitle.register_offline_dialog, name: 'offline_registration', title: '@i18n:objects.entitle.import_certificate', @@ -146,8 +155,8 @@ IPA.entitle.entity = function(spec) { label: '@i18n:objects.entitle.certificate' } ] - }). - dialog({ + }, + { $factory: IPA.entitle.consume_dialog, name: 'consume', title: '@i18n:objects.entitle.consume_entitlement', @@ -158,8 +167,8 @@ IPA.entitle.entity = function(spec) { metadata: '@mc-arg:entitle_consume:quantity' } ] - }). - dialog({ + }, + { $factory: IPA.entitle.import_dialog, name: 'import', title: '@i18n:objects.entitle.import_certificate', @@ -170,8 +179,17 @@ IPA.entitle.entity = function(spec) { label: '@i18n:objects.entitle.certificate' } ] - }); - }; + } + ] +};}; + +IPA.entitle.entity = function(spec) { + + spec = spec || {}; + + var that = IPA.entity(spec); + + that.status = spec.status || IPA.entitle.unregistered; that.get_accounts = function(on_success, on_error) { @@ -740,7 +758,12 @@ IPA.entitle.download_widget = function(spec) { return that; }; -IPA.register('entitle', IPA.entitle.entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'entitle', spec: exp.entity_spec}); +}; +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/group.js b/install/ui/src/freeipa/group.js index a3297bd3a..0408d0bc9 100644 --- a/install/ui/src/freeipa/group.js +++ b/install/ui/src/freeipa/group.js @@ -33,21 +33,20 @@ define([ var exp = IPA.group = {}; -IPA.group.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_spec = function() { +return { + name: 'group', + facets: [ + { + $type: 'search', columns: [ 'cn', 'gidnumber', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'details', @@ -84,8 +83,9 @@ IPA.group.entity = function(spec) { IPA.object_class_evaluator ] } - }). - association_facet({ + }, + { + $type: 'association', name: 'member_user', columns:[ 'uid', @@ -105,11 +105,13 @@ IPA.group.entity = function(spec) { width: '100px' } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'member_group' - }). - attribute_facet({ + }, + { + $type: 'attribute', name: 'member_external', attribute: 'ipaexternalmember', tab_label: 'External', @@ -120,69 +122,71 @@ IPA.group.entity = function(spec) { label: '@mc-opt:group_add_member:ipaexternalmember:label' } ] - - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_group', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_netgroup', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_role', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hbacrule', associator: IPA.serial_associator, add_method: 'add_user', remove_method: 'remove_user' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_sudorule', associator: IPA.serial_associator, add_method: 'add_user', remove_method: 'remove_user' - }). - standard_association_facets(). - adder_dialog({ - $factory: IPA.group_adder_dialog, - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - }, - { - $type: 'radio', - name: 'type', - label: '@i18n:objects.group.type', - flags: ['no_command'], - default_value: 'posix', - options: [ - { - value: 'normal', - label: '@i18n:objects.group.normal' - }, - { - value: 'external', - label: '@i18n:objects.group.external' - }, - { - value: 'posix', - label: '@i18n:objects.group.posix' - } - ] - }, - 'gidnumber' - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + $factory: IPA.group_adder_dialog, + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + }, + { + $type: 'radio', + name: 'type', + label: '@i18n:objects.group.type', + flags: ['no_command'], + default_value: 'posix', + options: [ + { + value: 'normal', + label: '@i18n:objects.group.normal' + }, + { + value: 'external', + label: '@i18n:objects.group.external' + }, + { + value: 'posix', + label: '@i18n:objects.group.posix' + } + ] + }, + 'gidnumber' + ] + } +};}; IPA.group_adder_dialog = function(spec) { @@ -262,11 +266,13 @@ IPA.group.make_external_action = function(spec) { return that; }; -IPA.register('group', IPA.group.entity); - +exp.entity_spec = make_spec(); exp.register = function() { + var e = reg.entity; var a = reg.action; + e.register({ type: 'group', spec: exp.entity_spec }); + a.register('make_posix', exp.make_posix_action); a.register('make_external', exp.make_external_action); }; diff --git a/install/ui/src/freeipa/hbac.js b/install/ui/src/freeipa/hbac.js index 852f06ae9..0c7b95c95 100644 --- a/install/ui/src/freeipa/hbac.js +++ b/install/ui/src/freeipa/hbac.js @@ -19,22 +19,28 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { - -IPA.hbac = { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { + +var exp = IPA.hbac = { //priority of commands in details facet remove_method_priority: IPA.config.default_priority - 1 }; -IPA.hbac.rule_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_rule_spec = function() { +return { + name: 'hbacrule', + facets: [ + { + $type: 'search', row_enabled_attribute: 'ipaenabledflag', search_all_attributes: true, columns: [ @@ -62,10 +68,10 @@ IPA.hbac.rule_entity = function(spec) { icon: 'enabled-icon' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.hbacrule_details_facet, - entity: that, command_mode: 'info', actions: [ 'select', @@ -86,29 +92,26 @@ IPA.hbac.rule_entity = function(spec) { IPA.disabled_summary_cond ] } - }). - adder_dialog({ - fields: [ 'cn' ] - }); - }; - - return that; -}; - -IPA.hbac.service_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ + } + ], + adder_dialog: { + fields: [ 'cn' ] + } +};}; + +var make_service_spec = function() { +return { + name: 'hbacsvc', + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'general', @@ -122,8 +125,9 @@ IPA.hbac.service_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hbacsvcgroup', associator: IPA.serial_associator, columns:[ @@ -141,36 +145,33 @@ IPA.hbac.service_entity = function(spec) { width: '100px' } ] - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; - -IPA.hbac.service_group_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; + +var make_service_group_spec = function() { +return { + name: 'hbacsvcgroup', + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'general', @@ -184,8 +185,9 @@ IPA.hbac.service_group_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'member_hbacsvc', columns:[ 'cn', @@ -202,21 +204,19 @@ IPA.hbac.service_group_entity = function(spec) { width: '100px' } ] - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; IPA.hbacrule_details_facet = function(spec) { @@ -480,9 +480,16 @@ IPA.hbacrule_details_facet = function(spec) { return that; }; -IPA.register('hbacrule', IPA.hbac.rule_entity); -IPA.register('hbacsvc', IPA.hbac.service_entity); -IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity); +exp.rule_spec = make_rule_spec(); +exp.svc_spec = make_service_spec(); +exp.svcgroup_spec = make_service_group_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'hbacrule', spec: exp.rule_spec}); + e.register({type: 'hbacsvc', spec: exp.svc_spec}); + e.register({type: 'hbacsvcgroup', spec: exp.svcgroup_spec}); +}; +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/hbactest.js b/install/ui/src/freeipa/hbactest.js index 3f8f64c88..4fc47aab2 100644 --- a/install/ui/src/freeipa/hbactest.js +++ b/install/ui/src/freeipa/hbactest.js @@ -18,24 +18,28 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './navigation', './text', './details', './search', - './association', './entity', './hbac'], function(IPA, $, navigation, text) { - -IPA.hbac.test_entity = function(spec) { - - var that = IPA.entity(spec); - - that.get_default_metadata = function() { - return IPA.metadata.commands[that.name]; - }; - - that.init = function() { - that.entity_init(); - - that.label = text.get('@i18n:objects.hbactest.label'); - - that.builder.facet_groups([ 'default' ]). - facet({ +define([ + './ipa', + './jquery', + './navigation', + './phases', + './reg', + './text', + './details', + './search', + './association', + './entity', + './hbac'], + function(IPA, $, navigation, phases, reg, text) { + +var exp = {}; + +var make_spec = function() { +return { + name: 'hbactest', + facet_groups: [ 'default' ], + facets: [ + { $factory: IPA.hbac.test_select_facet, name: 'user', label: '@i18n:objects.hbacrule.user', @@ -56,8 +60,8 @@ IPA.hbac.test_entity = function(spec) { } } ] - }). - facet({ + }, + { $factory: IPA.hbac.test_select_facet, name: 'targethost', label: '@i18n:objects.hbacrule.host', @@ -73,8 +77,8 @@ IPA.hbac.test_entity = function(spec) { formatter: 'boolean' } ] - }). - facet({ + }, + { $factory: IPA.hbac.test_select_facet, name: 'service', label: '@i18n:objects.hbacrule.service', @@ -85,8 +89,8 @@ IPA.hbac.test_entity = function(spec) { 'cn', 'description' ] - }). - facet({ + }, + { $factory: IPA.hbac.test_rules_facet, name: 'rules', label: '@i18n:objects.hbactest.rules', @@ -103,8 +107,8 @@ IPA.hbac.test_entity = function(spec) { }, 'description' ] - }). - facet({ + }, + { $factory: IPA.hbac.test_run_facet, name: 'run_test', label: '@i18n:objects.hbactest.run_test', @@ -126,7 +130,17 @@ IPA.hbac.test_entity = function(spec) { }, 'description' ] - }); + } + ] +};}; + +IPA.hbac.test_entity = function(spec) { + + var that = IPA.entity(spec); + that.label = text.get('@i18n:objects.hbactest.label'); + + that.get_default_metadata = function() { + return IPA.metadata.commands[that.name]; }; return that; @@ -806,7 +820,16 @@ IPA.hbac.validation_dialog = function(spec) { return that; }; -IPA.register('hbactest', IPA.hbac.test_entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({ + type: 'hbactest', + factory: IPA.hbac.test_entity, + spec: exp.entity_spec + }); +}; +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 3eb54c70c..31e0add63 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -33,11 +33,10 @@ define(['./ipa', var exp = IPA.host = {}; -IPA.host.entity = function(spec) { - - spec = spec || {}; - - spec.policies = spec.policies || [ +var make_spec = function() { +return { + name: 'host', + policies: [ IPA.search_facet_update_policy, IPA.details_facet_update_policy, { @@ -52,14 +51,10 @@ IPA.host.entity = function(spec) { dest_entity: 'cert', dest_facet: 'search' } - ]; - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ + ], + facets: [ + { + $type: 'search', columns: [ 'fqdn', 'description', @@ -69,8 +64,9 @@ IPA.host.entity = function(spec) { formatter: 'boolean' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.host.details_facet, sections: [ { @@ -181,76 +177,80 @@ IPA.host.entity = function(spec) { IPA.host.enrollment_policy, IPA.host.certificate_policy ] - }). - association_facet({ + }, + { + $type: 'association', name: 'managedby_host', add_method: 'add_managedby', remove_method: 'remove_managedby' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hostgroup', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_netgroup', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_role', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hbacrule', associator: IPA.serial_associator, add_method: 'add_host', remove_method: 'remove_host' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_sudorule', associator: IPA.serial_associator, add_method: 'add_host', remove_method: 'remove_host' - }). - standard_association_facets(). - adder_dialog({ - $factory: IPA.host_adder_dialog, - height: 300, - sections: [ - { - $factory: IPA.composite_widget, - name: 'fqdn', - fields: [ - { - $type: 'host_fqdn', - name: 'fqdn', - required: true - } - ] - }, - { - name: 'other', - fields: [ - { - name: 'ip_address', - validators: [ 'ip_address' ], - metadata: '@mc-opt:host_add:ip_address' - }, - { - $type: 'force_host_add_checkbox', - name: 'force', - metadata: '@mc-opt:host_add:force' - } - ] - } - ] - }). - deleter_dialog({ - $factory: IPA.host_deleter_dialog - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + $factory: IPA.host_adder_dialog, + height: 300, + sections: [ + { + $factory: IPA.composite_widget, + name: 'fqdn', + fields: [ + { + $type: 'host_fqdn', + name: 'fqdn', + required: true + } + ] + }, + { + name: 'other', + fields: [ + { + name: 'ip_address', + validators: [ 'ip_address' ], + metadata: '@mc-opt:host_add:ip_address' + }, + { + $type: 'force_host_add_checkbox', + name: 'force', + metadata: '@mc-opt:host_add:force' + } + ] + } + ] + }, + deleter_dialog: { + $factory: IPA.host_deleter_dialog + } +};}; IPA.host.details_facet = function(spec, no_init) { @@ -962,13 +962,15 @@ IPA.host.certificate_policy = function(spec) { return that; }; -IPA.register('host', IPA.host.entity); -phases.on('registration', function() { +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; var a = reg.action; + e.register({type: 'host', spec: exp.entity_spec}); f.register('host_fqdn', IPA.host_fqdn_field); w.register('host_fqdn', IPA.host_fqdn_widget); f.register('dnszone_select', IPA.field); @@ -982,8 +984,8 @@ phases.on('registration', function() { a.register('host_unprovision', exp.unprovision_action); a.register('set_otp', exp.set_otp_action); -}); - +}; +phases.on('registration', exp.register); return exp; }); diff --git a/install/ui/src/freeipa/hostgroup.js b/install/ui/src/freeipa/hostgroup.js index 5059d2ba4..f0d664280 100644 --- a/install/ui/src/freeipa/hostgroup.js +++ b/install/ui/src/freeipa/hostgroup.js @@ -1,5 +1,6 @@ /* Authors: * Pavel Zuna <pzuna@redhat.com> + * Petr Vobornik <pvoborni@redhat.com> * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information @@ -18,25 +19,32 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.hostgroup = {}; +var exp = IPA.hostgroup = {}; -IPA.hostgroup.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_spec = function() { +return { + name: 'hostgroup', + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'identity', @@ -50,43 +58,51 @@ IPA.hostgroup.entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hostgroup', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_netgroup', associator: IPA.serial_associator - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_hbacrule', associator: IPA.serial_associator, add_method: 'add_host', remove_method: 'remove_host' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_sudorule', associator: IPA.serial_associator, add_method: 'add_host', remove_method: 'remove_host' - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; - return that; -}; -IPA.register('hostgroup', IPA.hostgroup.entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'hostgroup', spec: exp.entity_spec}); +}; +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/idrange.js b/install/ui/src/freeipa/idrange.js index f7e195a24..7e419e574 100644 --- a/install/ui/src/freeipa/idrange.js +++ b/install/ui/src/freeipa/idrange.js @@ -18,27 +18,34 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.idrange = {}; +var exp = IPA.idrange = {}; -IPA.idrange.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_spec = function() { +return { + name: 'idrange', + facets: [ + { + $type: 'search', columns: [ 'cn', 'ipabaseid', 'ipaidrangesize', 'iparangetype' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'details', @@ -73,93 +80,96 @@ IPA.idrange.entity = function(spec) { ] } ] - }). - adder_dialog({ - fields: [ - { - name: 'cn', - widget: 'idrange.cn' - }, - { - name: 'ipabaseid', - label: '@i18n:objects.idrange.ipabaseid', - tooltip: '@mo-param:idrange:ipabaseid:label', - widget: 'idrange.ipabaseid' - }, - { - name: 'ipaidrangesize', - label: '@i18n:objects.idrange.ipaidrangesize', - tooltip: '@mo-param:idrange:ipaidrangesize:label', - widget: 'idrange.ipaidrangesize' - }, - { - name: 'ipabaserid', - label: '@i18n:objects.idrange.ipabaserid', - tooltip: '@mo-param:idrange:ipabaserid:label', - widget: 'idrange.ipabaserid' - }, - { - name: 'ipasecondarybaserid', - label: '@i18n:objects.idrange.ipasecondarybaserid', - tooltip: '@mo-param:idrange:ipasecondarybaserid:label', - widget: 'type.ipasecondarybaserid' - }, - { - name: 'ipanttrusteddomainsid', - label: '@i18n:objects.idrange.ipanttrusteddomainsid', - tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label', - widget: 'type.ipanttrusteddomainsid' - } - ], - widgets: [ - { - $type: 'details_table_section_nc', - name: 'idrange', - widgets: [ - 'cn', - 'ipabaseid', - 'ipaidrangesize', - 'ipabaserid' - ] - }, - { - $type: 'multiple_choice_section', - name: 'type', - label: '@i18n:objects.idrange.type', - choices: [ - { - name: 'local', - label: '@i18n:objects.idrange.type_local', - fields: ['ipasecondarybaserid'], - required: ['ipasecondarybaserid'], - enabled: true - }, - { - name: 'ad', - label: '@i18n:objects.idrange.type_ad', - fields: ['ipanttrusteddomainsid'], - required: ['ipanttrusteddomainsid'] - } - ], - widgets: [ - 'ipasecondarybaserid', - 'ipanttrusteddomainsid' - ] - } - ], - policies: [ - { - $factory: IPA.multiple_choice_section_policy, - widget: 'type' - } - ] - }); - }; + } + ], + adder_dialog: { + fields: [ + { + name: 'cn', + widget: 'idrange.cn' + }, + { + name: 'ipabaseid', + label: '@i18n:objects.idrange.ipabaseid', + tooltip: '@mo-param:idrange:ipabaseid:label', + widget: 'idrange.ipabaseid' + }, + { + name: 'ipaidrangesize', + label: '@i18n:objects.idrange.ipaidrangesize', + tooltip: '@mo-param:idrange:ipaidrangesize:label', + widget: 'idrange.ipaidrangesize' + }, + { + name: 'ipabaserid', + label: '@i18n:objects.idrange.ipabaserid', + tooltip: '@mo-param:idrange:ipabaserid:label', + widget: 'idrange.ipabaserid' + }, + { + name: 'ipasecondarybaserid', + label: '@i18n:objects.idrange.ipasecondarybaserid', + tooltip: '@mo-param:idrange:ipasecondarybaserid:label', + widget: 'type.ipasecondarybaserid' + }, + { + name: 'ipanttrusteddomainsid', + label: '@i18n:objects.idrange.ipanttrusteddomainsid', + tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label', + widget: 'type.ipanttrusteddomainsid' + } + ], + widgets: [ + { + $type: 'details_table_section_nc', + name: 'idrange', + widgets: [ + 'cn', + 'ipabaseid', + 'ipaidrangesize', + 'ipabaserid' + ] + }, + { + $type: 'multiple_choice_section', + name: 'type', + label: '@i18n:objects.idrange.type', + choices: [ + { + name: 'local', + label: '@i18n:objects.idrange.type_local', + fields: ['ipasecondarybaserid'], + required: ['ipasecondarybaserid'], + enabled: true + }, + { + name: 'ad', + label: '@i18n:objects.idrange.type_ad', + fields: ['ipanttrusteddomainsid'], + required: ['ipanttrusteddomainsid'] + } + ], + widgets: [ + 'ipasecondarybaserid', + 'ipanttrusteddomainsid' + ] + } + ], + policies: [ + { + $factory: IPA.multiple_choice_section_policy, + widget: 'type' + } + ] + } +};}; - return that; +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'idrange', spec: exp.entity_spec}); }; - -IPA.register('idrange', IPA.idrange.entity); +phases.on('registration', exp.register); return {}; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/netgroup.js b/install/ui/src/freeipa/netgroup.js index 7c7bb9b8d..776872514 100644 --- a/install/ui/src/freeipa/netgroup.js +++ b/install/ui/src/freeipa/netgroup.js @@ -18,51 +18,56 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.netgroup = { +var exp = IPA.netgroup = { remove_method_priority: IPA.config.default_priority - 1, enable_priority: IPA.config.default_priority + 1 }; -IPA.netgroup.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups(['settings', 'member', 'memberof']). - search_facet({ +var make_spec = function() { +return { + name: 'netgroup', + facet_groups: ['settings', 'member', 'memberof'], + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.netgroup.details_facet, - entity: that, command_mode: 'info' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_netgroup', associator: IPA.serial_associator - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; IPA.netgroup.details_facet = function(spec) { @@ -302,7 +307,13 @@ IPA.netgroup.details_facet = function(spec) { return that; }; -IPA.register('netgroup', IPA.netgroup.entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + + e.register({type: 'netgroup', spec: exp.entity_spec}); +}; +phases.on('registration', exp.register); return {}; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/phases.js b/install/ui/src/freeipa/phases.js index e5a23d07f..8c862c86d 100644 --- a/install/ui/src/freeipa/phases.js +++ b/install/ui/src/freeipa/phases.js @@ -38,6 +38,7 @@ define([ 'customization', 'init', 'metadata', + 'post-metadata', 'profile', 'runtime', 'shutdown' diff --git a/install/ui/src/freeipa/policy.js b/install/ui/src/freeipa/policy.js index c0ea20335..38d9e3624 100644 --- a/install/ui/src/freeipa/policy.js +++ b/install/ui/src/freeipa/policy.js @@ -18,23 +18,31 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.pwpolicy = {}; +var exp = {}; +exp.pwpolicy = IPA.pwpolicy = {}; -IPA.pwpolicy.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_pwpolicy_spec = function() { +return { + name: 'pwpolicy', + facets: [ + { + $type: 'search', sort_enabled: false, columns:['cn','cospriority'] - }). - details_facet({ + }, + { + $type: 'details', sections:[ { name : 'identity', @@ -63,36 +71,33 @@ IPA.pwpolicy.entity = function(spec) { }, 'cospriority' ] - }]}). - standard_association_facets(). - adder_dialog({ - fields: [ - { - $type: 'entity_select', - name: 'cn', - other_entity: 'group', - other_field: 'cn', - required: true - }, - 'cospriority' - ], - height: 300 - }); - }; + }] + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + { + $type: 'entity_select', + name: 'cn', + other_entity: 'group', + other_field: 'cn', + required: true + }, + 'cospriority' + ], + height: 300 + } +};}; - return that; -}; +exp.krbtpolicy = IPA.krbtpolicy = {}; -IPA.krbtpolicy = {}; - -IPA.krbtpolicy.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.details_facet({ +var make_krbtpolicy_spec = function() { +return { + name: 'krbtpolicy', + facets: [ + { + $type: 'details', title: IPA.metadata.objects.krbtpolicy.label, sections: [ { @@ -110,14 +115,18 @@ IPA.krbtpolicy.entity = function(spec) { } ], needs_update: true - }); - }; + } + ] +};}; - return that; +exp.pwpolicy_spec = make_pwpolicy_spec(); +exp.krbtpolicy_spec = make_krbtpolicy_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'pwpolicy', spec: exp.pwpolicy_spec}); + e.register({type: 'krbtpolicy', spec: exp.krbtpolicy_spec}); }; +phases.on('registration', exp.register); -IPA.register('pwpolicy', IPA.pwpolicy.entity); -IPA.register('krbtpolicy', IPA.krbtpolicy.entity); - -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/realmdomains.js b/install/ui/src/freeipa/realmdomains.js index c5914a284..82f104cad 100644 --- a/install/ui/src/freeipa/realmdomains.js +++ b/install/ui/src/freeipa/realmdomains.js @@ -18,20 +18,24 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { - - IPA.realmdomains = {}; - - IPA.realmdomains.entity = function (spec) { - - spec = spec || {}; - spec.defines_key = false; - var that = IPA.entity(spec); - - that.init = function () { - that.entity_init(); - - that.builder.details_facet({ +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './entity'], + function (IPA, $, phases, reg) { + + var exp = IPA.realmdomains = {}; + + var make_spec = function() { + return { + name: 'realmdomains', + defines_key: false, + facets: [ + { + $type: 'details', $factory: IPA.realmdomains_details_facet, title: IPA.metadata.objects.realmdomains.label, sections: [ @@ -47,10 +51,9 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { } ], needs_update: true - }); - }; - return that; - }; + } + ] + };}; IPA.realmdomains_details_facet = function (spec) { spec = spec || {}; @@ -99,7 +102,12 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { return that; }; - IPA.register('realmdomains', IPA.realmdomains.entity); + exp.entity_spec = make_spec(); + exp.register = function() { + var e = reg.entity; + e.register({type: 'realmdomains', spec: exp.entity_spec}); + }; + phases.on('registration', exp.register); - return {}; + return exp; }); diff --git a/install/ui/src/freeipa/selinux.js b/install/ui/src/freeipa/selinux.js index c27195d4d..faf0d4cb7 100644 --- a/install/ui/src/freeipa/selinux.js +++ b/install/ui/src/freeipa/selinux.js @@ -18,21 +18,27 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.selinux = { +var exp = IPA.selinux = { remove_method_priority: IPA.config.default_priority - 1 }; -IPA.selinux.selinuxusermap_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_spec = function() { +return { + name: 'selinuxusermap', + facets: [ + { + $type: 'search', row_enabled_attribute: 'ipaenabledflag', search_all_attributes: true, columns: [ @@ -61,10 +67,10 @@ IPA.selinux.selinuxusermap_entity = function(spec) { icon: 'enabled-icon' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.selinux_details_facet, - entity: that, command_mode: 'info', actions: [ 'select', @@ -85,17 +91,15 @@ IPA.selinux.selinuxusermap_entity = function(spec) { IPA.disabled_summary_cond ] } - }). - adder_dialog({ - fields: [ - 'cn', - 'ipaselinuxuser' - ] - }); - }; - - return that; -}; + } + ], + adder_dialog: { + fields: [ + 'cn', + 'ipaselinuxuser' + ] + } +};}; IPA.selinux_details_facet = function(spec) { @@ -311,7 +315,12 @@ IPA.selinux_details_facet = function(spec) { return that; }; -IPA.register('selinuxusermap', IPA.selinux.selinuxusermap_entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'selinuxusermap', spec: exp.entity_spec}); +}; +phases.on('registration', exp.register); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/serverconfig.js b/install/ui/src/freeipa/serverconfig.js index 2838bc840..97aac5413 100644 --- a/install/ui/src/freeipa/serverconfig.js +++ b/install/ui/src/freeipa/serverconfig.js @@ -19,21 +19,26 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.serverconfig = {}; +var exp = IPA.serverconfig = {}; -IPA.serverconfig.entity = function(spec) { - - spec = spec || {}; - spec.defines_key = false; - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.details_facet({ +var make_spec = function() { +return { + name: 'config', + defines_key: false, + facets: [ + { + $type: 'details', title: IPA.metadata.objects.config.label, sections: [ { @@ -110,13 +115,16 @@ IPA.serverconfig.entity = function(spec) { } ], needs_update: true - }); - }; + } + ] +};}; - return that; +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + e.register({type: 'config', spec: exp.entity_spec}); }; - -IPA.register('config', IPA.serverconfig.entity); +phases.on('registration', exp.register); return {}; }); diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js index 1d6043901..318670733 100644 --- a/install/ui/src/freeipa/service.js +++ b/install/ui/src/freeipa/service.js @@ -30,13 +30,12 @@ define([ './entity'], function(IPA, $, phases, reg, text) { -IPA.service = {}; +var exp =IPA.service = {}; -IPA.service.entity = function(spec) { - - spec = spec || {}; - - spec.policies = spec.policies || [ +var make_spec = function() { +return { + name: 'service', + policies: [ IPA.search_facet_update_policy, IPA.details_facet_update_policy, { @@ -51,17 +50,14 @@ IPA.service.entity = function(spec) { dest_entity: 'cert', dest_facet: 'search' } - ]; - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ + ], + facets: [ + { + $type: 'search', columns: [ 'krbprincipalname' ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.service.details_facet, sections: [ { @@ -168,62 +164,61 @@ IPA.service.entity = function(spec) { policies: [ IPA.service.certificate_policy ] - }). - association_facet({ + }, + { + $type: 'association', name: 'managedby_host', add_method: 'add_host', remove_method: 'remove_host' - }). - standard_association_facets(). - adder_dialog({ - $factory: IPA.service_adder_dialog, - height: 350, - sections: [ - { - fields: [ - { - $type: 'combobox', - name: 'service', - label: '@i18n:objects.service.service', - options: [ - 'cifs', - 'DNS', - 'ftp', - 'HTTP', - 'imap', - 'ldap', - 'libvirt', - 'nfs', - 'smtp', - 'qpidd' - ], - editable: true, - size: 10, - required: true, - z_index: 2 - }, - { - $type: 'entity_select', - name: 'host', - other_entity: 'host', - other_field: 'fqdn', - label: '@i18n:objects.service.host', - required: true, - z_index: 1 - }, - { - $type: 'checkbox', - name: 'force', - metadata: '@mc-opt:service_add:force' - } - ] - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + $factory: IPA.service_adder_dialog, + height: 350, + sections: [ + { + fields: [ + { + $type: 'combobox', + name: 'service', + label: '@i18n:objects.service.service', + options: [ + 'cifs', + 'DNS', + 'ftp', + 'HTTP', + 'imap', + 'ldap', + 'libvirt', + 'nfs', + 'smtp', + 'qpidd' + ], + editable: true, + size: 10, + required: true, + z_index: 2 + }, + { + $type: 'entity_select', + name: 'host', + other_entity: 'host', + other_field: 'fqdn', + label: '@i18n:objects.service.host', + required: true, + z_index: 1 + }, + { + $type: 'checkbox', + name: 'force', + metadata: '@mc-opt:service_add:force' + } + ] + } + ] + } +};}; IPA.service.details_facet = function(spec, no_init) { @@ -509,13 +504,15 @@ IPA.service.certificate_policy = function(spec) { return that; }; -IPA.register('service', IPA.service.entity); - +exp.entity_spec = make_spec(); phases.on('registration', function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; var a = reg.action; + e.register({type: 'service', spec: exp.entity_spec}); + f.register('service_name', IPA.service_name_field); w.register('service_name', IPA.text_widget); f.register('service_host', IPA.service_host_field); @@ -526,5 +523,5 @@ phases.on('registration', function() { }); -return {}; +return exp; }); diff --git a/install/ui/src/freeipa/sudo.js b/install/ui/src/freeipa/sudo.js index 9cbd345af..d97cde300 100644 --- a/install/ui/src/freeipa/sudo.js +++ b/install/ui/src/freeipa/sudo.js @@ -18,22 +18,29 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define(['./ipa', './jquery', './text', './details', './search', './association', - './entity'], function(IPA, $, text) { - -IPA.sudo = { +define([ + './ipa', + './jquery', + './phases', + './reg', + './text', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg, text) { + +var exp = IPA.sudo = { //priority of commands in details facet remove_method_priority: IPA.config.default_priority - 1 }; -IPA.sudo.rule_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.search_facet({ +var make_rule_spec = function() { +return { + name: 'sudorule', + facets: [ + { + $type: 'search', row_enabled_attribute: 'ipaenabledflag', columns: [ 'cn', @@ -60,10 +67,10 @@ IPA.sudo.rule_entity = function(spec) { icon: 'enabled-icon' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.sudorule_details_facet, - entity: that, command_mode: 'info', actions: [ 'select', @@ -84,29 +91,27 @@ IPA.sudo.rule_entity = function(spec) { IPA.disabled_summary_cond ] } - }). - adder_dialog({ - fields: [ 'cn' ] - }); - }; - - return that; -}; - -IPA.sudo.command_entity = function(spec) { - - var that = IPA.entity(spec); + } + ], + adder_dialog: { + fields: [ 'cn' ] + } +};}; - that.init = function() { - that.entity_init(); - that.builder.search_facet({ +var make_cmd_spec = function() { +return { + name: 'sudocmd', + facets: [ + { + $type: 'search', columns: [ 'sudocmd', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'general', @@ -120,8 +125,9 @@ IPA.sudo.command_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_sudocmdgroup', associator: IPA.serial_associator, columns:[ @@ -139,36 +145,34 @@ IPA.sudo.command_entity = function(spec) { width: '100px' } ] - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'sudocmd', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; - -IPA.sudo.command_group_entity = function(spec) { - - var that = IPA.entity(spec); + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'sudocmd', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; - that.init = function() { - that.entity_init(); - that.builder.search_facet({ +var make_cmd_group_spec = function() { +return { + name: 'sudocmdgroup', + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'general', @@ -182,8 +186,9 @@ IPA.sudo.command_group_entity = function(spec) { ] } ] - }). - association_facet({ + }, + { + $type: 'association', name: 'member_sudocmd', columns: [ 'sudocmd', @@ -200,21 +205,19 @@ IPA.sudo.command_group_entity = function(spec) { width: '100px' } ] - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; IPA.sudorule_details_facet = function(spec) { @@ -924,9 +927,17 @@ IPA.sudo.options_section = function(spec) { return that; }; -IPA.register('sudorule', IPA.sudo.rule_entity); -IPA.register('sudocmd', IPA.sudo.command_entity); -IPA.register('sudocmdgroup', IPA.sudo.command_group_entity); +exp.rule_spec = make_rule_spec(); +exp.cmd_spec = make_cmd_spec(); +exp.cmdgroup_spec = make_cmd_group_spec(); +exp.register = function() { + var e = reg.entity; + + e.register({type: 'sudorule', spec: exp.rule_spec}); + e.register({type: 'sudocmd', spec: exp.cmd_spec}); + e.register({type: 'sudocmdgroup', spec: exp.cmdgroup_spec}); +}; +phases.on('registration', exp.register); -return {}; -}); +return exp; +});
\ No newline at end of file diff --git a/install/ui/src/freeipa/trust.js b/install/ui/src/freeipa/trust.js index da69d7776..91ef819ae 100644 --- a/install/ui/src/freeipa/trust.js +++ b/install/ui/src/freeipa/trust.js @@ -19,38 +19,34 @@ */ define([ - './ipa', - './jquery', - './phases', - './reg', - './details', - './search', - './association', - './entity'], - function(IPA, $, phases, reg) { - -IPA.trust = {}; - -IPA.trust.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - - if (!IPA.trust_enabled) { - throw { - expected: true - }; - } - - that.entity_init(); - - that.builder.search_facet({ + './ipa', + './jquery', + './menu', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, menu, phases, reg) { + +var exp = IPA.trust = {}; + +var make_trust_spec = function() { +return { + name: 'trust', + enable_test: function() { + return IPA.trust_enabled; + }, + facets: [ + { + $type: 'search', columns: [ 'cn' ] - }). - details_facet({ + }, + { + $type: 'details', sections: [ { name: 'details', @@ -97,101 +93,99 @@ IPA.trust.entity = function(spec) { ] } ] - }). - adder_dialog({ - $factory: IPA.trust.adder_dialog, - fields: [ - { - name: 'cn', - label: '@i18n:objects.trust.domain', - widget: 'realm.realm_server' - }, - { - name: 'realm_admin', - label: '@i18n:objects.trust.account', - widget: 'method.realm_admin' - }, - { - $type: 'password', - name: 'realm_passwd', - label: '@i18n:password.password', - widget: 'method.realm_passwd' - }, - { - $type: 'password', - name: 'trust_secret', - label: '@i18n:password.password', - widget: 'method.trust_secret' - }, - { - $type: 'password', - name: 'trust_secret_verify', - label: '@i18n:password.verify_password', - widget: 'method.trust_secret_verify', - flags: ['no_command'], - validators: [{ - $type: 'same_password', - other_field: 'trust_secret' - }] - } - ], - widgets: [ - { - $type: 'details_table_section_nc', - name: 'realm', - widgets: [ - 'realm_server' - ] - }, - { - $type: 'multiple_choice_section', - name: 'method', - label: '@i18n:objects.trust.establish_using', - choices: [ - { - name: 'admin-account', - label: '@i18n:objects.trust.admin_account', - fields: ['realm_admin', 'realm_passwd'], - required: ['realm_admin', 'realm_passwd'], - enabled: true - }, - { - name: 'preshared_password', - label: '@i18n:objects.trust.preshared_password', - fields: ['trust_secret', 'trust_secret_verify'], - required: ['trust_secret', 'trust_secret_verify'] - } - ], - widgets: [ - { - name: 'realm_admin' - }, - { - $type: 'password', - name: 'realm_passwd' - }, - { - $type: 'password', - name: 'trust_secret' - }, - { - $type: 'password', - name: 'trust_secret_verify' - } - ] - } - ], - policies: [ - { - $factory: IPA.multiple_choice_section_policy, - widget: 'method' - } - ] - }); - }; - - return that; -}; + } + ], + adder_dialog: { + $factory: IPA.trust.adder_dialog, + fields: [ + { + name: 'cn', + label: '@i18n:objects.trust.domain', + widget: 'realm.realm_server' + }, + { + name: 'realm_admin', + label: '@i18n:objects.trust.account', + widget: 'method.realm_admin' + }, + { + $type: 'password', + name: 'realm_passwd', + label: '@i18n:password.password', + widget: 'method.realm_passwd' + }, + { + $type: 'password', + name: 'trust_secret', + label: '@i18n:password.password', + widget: 'method.trust_secret' + }, + { + $type: 'password', + name: 'trust_secret_verify', + label: '@i18n:password.verify_password', + widget: 'method.trust_secret_verify', + flags: ['no_command'], + validators: [{ + $type: 'same_password', + other_field: 'trust_secret' + }] + } + ], + widgets: [ + { + $type: 'details_table_section_nc', + name: 'realm', + widgets: [ + 'realm_server' + ] + }, + { + $type: 'multiple_choice_section', + name: 'method', + label: '@i18n:objects.trust.establish_using', + choices: [ + { + name: 'admin-account', + label: '@i18n:objects.trust.admin_account', + fields: ['realm_admin', 'realm_passwd'], + required: ['realm_admin', 'realm_passwd'], + enabled: true + }, + { + name: 'preshared_password', + label: '@i18n:objects.trust.preshared_password', + fields: ['trust_secret', 'trust_secret_verify'], + required: ['trust_secret', 'trust_secret_verify'] + } + ], + widgets: [ + { + name: 'realm_admin' + }, + { + $type: 'password', + name: 'realm_passwd' + }, + { + $type: 'password', + name: 'trust_secret' + }, + { + $type: 'password', + name: 'trust_secret_verify' + } + ] + } + ], + policies: [ + { + $factory: IPA.multiple_choice_section_policy, + widget: 'method' + } + ] + } +};}; IPA.trust.adder_dialog = function(spec) { @@ -210,21 +204,15 @@ IPA.trust.adder_dialog = function(spec) { return that; }; -IPA.trust.config_entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - - if (!IPA.trust_enabled) { - throw { - expected: true - }; - } - - that.entity_init(); - - that.builder.details_facet({ +var make_trustconfig_spec = function() { +return { + name: 'trust', + enable_test: function() { + return IPA.trust_enabled; + }, + facets: [ + { + $type: 'details', $factory: IPA.trust.config_details_facet, trust_type: 'ad', sections: [ @@ -249,11 +237,9 @@ IPA.trust.config_entity = function(spec) { ] } ] - }); - }; - - return that; -}; + } + ] +};}; IPA.trust.config_details_facet = function(spec) { @@ -298,19 +284,29 @@ IPA.trust.fallbackgroup_select_widget = function(spec) { return that; }; -IPA.register('trust', IPA.trust.entity); -IPA.register('trustconfig', IPA.trust.config_entity); +exp.remove_menu_item = function() { + if (!IPA.trust_enabled) { + menu.remove_item('ipaserver/trusts'); + } +}; -IPA.trust.register = function() { +exp.trust_spec = make_trust_spec(); +exp.trustconfig_spec = make_trustconfig_spec(); +IPA.trust.register = function() { + var e = reg.entity; var w = reg.widget; var f = reg.field; + e.register({type: 'trust', spec: exp.trust_spec}); + e.register({type: 'trustconfig', spec: exp.trustconfig_spec}); + w.register('trust_fallbackgroup_select', IPA.trust.fallbackgroup_select_widget); f.register('trust_fallbackgroup_select', IPA.field); }; phases.on('registration', IPA.trust.register); +phases.on('profile', exp.remove_menu_item, 20); -return {}; +return exp; });
\ No newline at end of file diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index fe2ea683f..2fa0b0641 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -36,17 +36,12 @@ define([ var exp = IPA.user = {}; -IPA.user.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - var self_service = IPA.is_selfservice; - var link = self_service ? false : undefined; - - that.builder.search_facet({ +var make_spec = function() { +return { + name: 'user', + facets: [ + { + $type: 'search', row_disabled_attribute: 'nsaccountlock', columns: [ 'uid', @@ -87,8 +82,9 @@ IPA.user.entity = function(spec) { icon: 'enabled-icon' } ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.user.details_facet, sections: [ { @@ -255,77 +251,75 @@ IPA.user.entity = function(spec) { IPA.disabled_summary_cond ] } - }). - association_facet({ + }, + { + $type: 'association', + $post_ops: [ IPA.user.association_facet_ss_post_op ], name: 'memberof_group', - associator: IPA.serial_associator, - link: link, - read_only: self_service - }). - association_facet({ + associator: IPA.serial_associator + }, + { + $type: 'association', + $post_ops: [ IPA.user.association_facet_ss_post_op ], name: 'memberof_netgroup', - associator: IPA.serial_associator, - link: link, - read_only: self_service - }). - association_facet({ + associator: IPA.serial_associator + }, + { + $type: 'association', + $post_ops: [ IPA.user.association_facet_ss_post_op ], name: 'memberof_role', - associator: IPA.serial_associator, - link: link, - read_only: self_service - }). - association_facet({ + associator: IPA.serial_associator + }, + { + $type: 'association', + $post_ops: [ IPA.user.association_facet_ss_post_op ], name: 'memberof_hbacrule', associator: IPA.serial_associator, add_method: 'add_user', - remove_method: 'remove_user', - link: link, - read_only: self_service - }). - association_facet({ + remove_method: 'remove_user' + }, + { + $type: 'association', + $post_ops: [ IPA.user.association_facet_ss_post_op ], name: 'memberof_sudorule', associator: IPA.serial_associator, add_method: 'add_user', - remove_method: 'remove_user', - link: link, - read_only: self_service - }). - standard_association_facets({ - link: link - }). - adder_dialog({ - $factory: IPA.user_adder_dialog, - sections: [ - { - fields: [ - { - name: 'uid', - required: false - }, - 'givenname', - 'sn' - ] - }, - { - fields: [ - { - name: 'userpassword', - label: '@i18n:password.new_password', - $type: 'password' - }, - { - name: 'userpassword2', - label: '@i18n:password.verify_password', - $type: 'password' - } - ] - } - ] - }); - }; - - return that; -}; + remove_method: 'remove_user' + } + ], + standard_association_facets: { + $post_ops: [ IPA.user.association_facet_ss_post_op ] + }, + adder_dialog: { + $factory: IPA.user_adder_dialog, + sections: [ + { + fields: [ + { + name: 'uid', + required: false + }, + 'givenname', + 'sn' + ] + }, + { + fields: [ + { + name: 'userpassword', + label: '@i18n:password.new_password', + $type: 'password' + }, + { + name: 'userpassword2', + label: '@i18n:password.verify_password', + $type: 'password' + } + ] + } + ] + } +};}; IPA.user.details_facet = function(spec) { @@ -676,13 +670,13 @@ IPA.user.reset_password_acl_evaluator = function(spec) { return that; }; -IPA.register('user', IPA.user.entity); - +exp.entity_spec = make_spec(); exp.register = function() { + var e = reg.entity; var a = reg.action; + e.register({type: 'user', spec: exp.entity_spec}); a.register('reset_password', IPA.user.reset_password_action); }; - phases.on('registration', exp.register); return exp; |