Convert definitions of entities to spec objects

https://fedorahosted.org/freeipa/ticket/3235
This commit is contained in:
Petr Vobornik
2013-04-18 12:38:38 +02:00
parent a513673f04
commit 14c276d218
22 changed files with 1731 additions and 1614 deletions

View File

@@ -31,21 +31,21 @@ define([
'./entity'], './entity'],
function(IPA, $, phases, reg, text) { 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); return {
name: 'permission',
that.init = function() { facet_groups: ['settings', 'privilege'],
that.entity_init(); facets: [
{
that.builder.facet_groups(['settings', 'privilege']). $type: 'search',
search_facet({
columns: [ 'cn' ] columns: [ 'cn' ]
}). },
details_facet({ {
$factory: IPA.aci.permission_details_facet, $factory: IPA.aci.permission_details_facet,
$type: 'details',
fields: [ fields: [
{ {
name:'cn', name:'cn',
@@ -137,99 +137,98 @@ IPA.aci.permission_entity = function(spec) {
widget_name: 'target' widget_name: 'target'
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'member_privilege', name: 'member_privilege',
facet_group: 'privilege' facet_group: 'privilege'
}). }
adder_dialog({ ],
height: 450, adder_dialog: {
fields: [ height: 450,
{ fields: [
name:'cn', {
widget: 'general.cn' name:'cn',
}, widget: 'general.cn'
{ },
$type: 'rights', {
name: 'permissions', $type: 'rights',
widget: 'general.permissions' name: 'permissions',
}, widget: 'general.permissions'
{ },
$type: 'select', {
name: 'target', $type: 'select',
widget: 'target.target', name: 'target',
enabled: false widget: 'target.target',
}, enabled: false
{ },
name: 'filter', {
widget: 'target.filter', name: 'filter',
enabled: false widget: 'target.filter',
}, enabled: false
{ },
$type: 'entity_select', {
name: 'memberof', $type: 'entity_select',
widget: 'target.memberof', name: 'memberof',
enabled: false widget: 'target.memberof',
}, enabled: false
{ },
name: 'subtree', {
widget: 'target.subtree', name: 'subtree',
enabled: false widget: 'target.subtree',
}, enabled: false
{ },
$type: 'entity_select', {
name: 'targetgroup', $type: 'entity_select',
widget: 'target.targetgroup', name: 'targetgroup',
enabled: false widget: 'target.targetgroup',
}, enabled: false
{ },
$type: 'select', {
name: 'type', $type: 'select',
widget: 'target.type', name: 'type',
enabled: false widget: 'target.type',
}, enabled: false
{ },
name: 'attrs', {
widget: 'target.attrs', name: 'attrs',
enabled: false widget: 'target.attrs',
}, enabled: false
{ },
name: 'attrs_multi', {
$type: 'multivalued', name: 'attrs_multi',
param: 'attrs', $type: 'multivalued',
widget: 'target.attrs_multi', param: 'attrs',
enabled: false widget: 'target.attrs_multi',
} enabled: false
], }
widgets: [ ],
{ widgets: [
$type: 'details_table_section_nc', {
name: 'general', $type: 'details_table_section_nc',
widgets: [ name: 'general',
'cn', widgets: [
{ 'cn',
$type: 'rights', {
name: 'permissions' $type: 'rights',
} name: 'permissions'
] }
}, ]
{ },
$type: 'permission_target', {
name:'target', $type: 'permission_target',
show_target: true name:'target',
} show_target: true
], }
policies: [ ],
{ policies: [
$factory: IPA.permission_target_policy, {
widget_name: 'target' $factory: IPA.permission_target_policy,
} widget_name: 'target'
] }
}); ]
}; }
};};
return that;
};
IPA.aci.permission_details_facet = function(spec) { IPA.aci.permission_details_facet = function(spec) {
@@ -242,21 +241,20 @@ IPA.aci.permission_details_facet = function(spec) {
return that; return that;
}; };
IPA.aci.privilege_entity = function(spec) { var make_privilege_spec = function() {
return {
var that = IPA.entity(spec); name: 'privilege',
facet_groups: ['permission', 'settings', 'role'],
that.init = function() { facets: [
that.entity_init(); {
$type: 'search',
that.builder.facet_groups(['permission', 'settings', 'role']).
search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'identity', name: 'identity',
@@ -270,50 +268,49 @@ IPA.aci.privilege_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'member_role', name: 'member_role',
facet_group: 'role', facet_group: 'role',
add_method: 'add_privilege', add_method: 'add_privilege',
remove_method: 'remove_privilege', remove_method: 'remove_privilege',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_permission', name: 'memberof_permission',
facet_group: 'permission', facet_group: 'permission',
add_method: 'add_permission', add_method: 'add_permission',
remove_method: 'remove_permission' remove_method: 'remove_permission'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that; var make_role_spec = function() {
}; return {
name: 'role',
IPA.aci.role_entity = function(spec) { facet_groups: ['member', 'privilege', 'settings'],
facets: [
var that = IPA.entity(spec); {
$type: 'search',
that.init = function() {
that.entity_init();
that.builder.facet_groups(['member', 'privilege', 'settings']).
search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'identity', name: 'identity',
@@ -327,40 +324,38 @@ IPA.aci.role_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'memberof_privilege', name: 'memberof_privilege',
facet_group: 'privilege', facet_group: 'privilege',
add_method: 'add_privilege', add_method: 'add_privilege',
remove_method: 'remove_privilege' remove_method: 'remove_privilege'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that; var make_selfservice_spec = function() {
}; return {
name: 'selfservice',
IPA.aci.selfservice_entity = function(spec) { facets: [
{
var that = IPA.entity(spec); $type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ 'aciname' ], columns: [ 'aciname' ],
pagination: false pagination: false
}). },
details_facet({ {
$type: 'details',
check_rights: false, check_rights: false,
sections: [ sections: [
{ {
@@ -376,36 +371,32 @@ IPA.aci.selfservice_entity = function(spec) {
] ]
} }
] ]
}). }
adder_dialog({ ],
fields: [ adder_dialog: {
'aciname', fields: [
{ 'aciname',
$type: 'attributes', {
object_type: 'user', $type: 'attributes',
name: 'attrs' object_type: 'user',
} name: 'attrs'
] }
}); ]
}; }
};};
return that;
};
IPA.aci.delegation_entity = function(spec) { var make_delegation_spec = function() {
return {
var that = IPA.entity(spec); name: 'delegation',
facets: [
that.group_entity = IPA.get_entity(spec.group_entity || 'group'); {
$type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ 'aciname' ], columns: [ 'aciname' ],
pagination: false pagination: false
}). },
details_facet({ {
$type: 'details',
check_rights: false, check_rights: false,
sections: [ sections: [
{ {
@@ -422,13 +413,13 @@ IPA.aci.delegation_entity = function(spec) {
{ {
$type: 'entity_select', $type: 'entity_select',
name: 'group', name: 'group',
other_entity: that.group_entity, other_entity: 'group',
other_field: 'cn' other_field: 'cn'
}, },
{ {
$type: 'entity_select', $type: 'entity_select',
name: 'memberof', name: 'memberof',
other_entity: that.group_entity, other_entity: 'group',
other_field: 'cn' other_field: 'cn'
}, },
{ {
@@ -439,39 +430,37 @@ IPA.aci.delegation_entity = function(spec) {
] ]
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: false,
fields: [ adder_dialog: {
'aciname', fields: [
{ 'aciname',
$type: 'checkboxes', {
name: 'permissions', $type: 'checkboxes',
options: IPA.create_options(['read', 'write']) name: 'permissions',
}, options: IPA.create_options(['read', 'write'])
{ },
$type: 'entity_select', {
name: 'group', $type: 'entity_select',
other_entity: that.group_entity, name: 'group',
other_field: 'cn' other_entity: 'group',
}, other_field: 'cn'
{ },
$type: 'entity_select', {
name: 'memberof', $type: 'entity_select',
other_entity: that.group_entity, name: 'memberof',
other_field: 'cn' other_entity: 'group',
}, other_field: 'cn'
{ },
$type: 'attributes', {
name: 'attrs', $type: 'attributes',
object_type: 'user' name: 'attrs',
} object_type: 'user'
] }
}); ]
}; }
};};
return that;
};
IPA.attributes_widget = function(spec) { IPA.attributes_widget = function(spec) {
@@ -903,17 +892,23 @@ IPA.permission_target_policy = function (spec) {
return that; 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); exp.register = function() {
IPA.register('privilege', IPA.aci.privilege_entity); var e = reg.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() {
var w = reg.widget; var w = reg.widget;
var f = reg.field; 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); w.register('attributes', IPA.attributes_widget);
f.register('attributes', IPA.checkboxes_field); f.register('attributes', IPA.checkboxes_field);
w.register('rights', IPA.rights_widget); w.register('rights', IPA.rights_widget);
@@ -921,7 +916,7 @@ IPA.aci.register = function() {
w.register('permission_target', IPA.permission_target_widget); w.register('permission_target', IPA.permission_target_widget);
}; };
phases.on('registration', IPA.aci.register); phases.on('registration', exp.register);
return IPA.aci; return exp;
}); });

View File

@@ -31,20 +31,14 @@ define([
'./entity'], './entity'],
function(IPA, $, navigation, phases, reg, text) { 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 name: 'automember',
//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;
spec = spec || {}; policies:[
spec.policies = spec.policies || [
{ {
$factory: IPA.facet_update_policy, $factory: IPA.facet_update_policy,
source_facet: 'usergrouprule', source_facet: 'usergrouprule',
@@ -55,16 +49,11 @@ IPA.automember.entity = function(spec) {
source_facet: 'hostgrouprule', source_facet: 'hostgrouprule',
dest_facet: 'searchhostgroup' dest_facet: 'searchhostgroup'
} }
]; ],
facets: [
var that = IPA.entity(spec); {
that.init = function() {
that.entity_init();
that.builder.search_facet({
$factory: IPA.automember.rule_search_facet, $factory: IPA.automember.rule_search_facet,
$type: 'search',
name: 'searchgroup', name: 'searchgroup',
group_type: 'group', group_type: 'group',
label: '@i18n:objects.automember.usergrouprules', label: '@i18n:objects.automember.usergrouprules',
@@ -74,9 +63,10 @@ IPA.automember.entity = function(spec) {
'cn', 'cn',
'description' 'description'
] ]
}). },
search_facet({ {
$factory: IPA.automember.rule_search_facet, $factory: IPA.automember.rule_search_facet,
$type: 'search',
name: 'searchhostgroup', name: 'searchhostgroup',
group_type: 'hostgroup', group_type: 'hostgroup',
label: '@i18n:objects.automember.hostgrouprules', label: '@i18n:objects.automember.hostgrouprules',
@@ -86,47 +76,56 @@ IPA.automember.entity = function(spec) {
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$factory: IPA.automember.rule_details_facet, $factory: IPA.automember.rule_details_facet,
$type: 'details',
name: 'usergrouprule', name: 'usergrouprule',
group_type: 'group', group_type: 'group',
label: '@i18n:objects.automember.usergrouprule', label: '@i18n:objects.automember.usergrouprule',
disable_facet_tabs: true, disable_facet_tabs: true,
check_rights: false, check_rights: false,
redirect_info: { facet: 'searchgroup' } redirect_info: { facet: 'searchgroup' }
}). },
details_facet({ {
$factory: IPA.automember.rule_details_facet, $factory: IPA.automember.rule_details_facet,
$type: 'details',
name: 'hostgrouprule', name: 'hostgrouprule',
group_type: 'hostgroup', group_type: 'hostgroup',
label: '@i18n:objects.automember.hostgrouprule', label: '@i18n:objects.automember.hostgrouprule',
disable_facet_tabs: true, disable_facet_tabs: true,
check_rights: false, check_rights: false,
redirect_info: { facet: 'searchhostgroup' } redirect_info: { facet: 'searchhostgroup' }
}). }
adder_dialog({ ],
$factory: IPA.automember.rule_adder_dialog, adder_dialog: {
title: '@i18n:objects.automember.add_rule', $factory: IPA.automember.rule_adder_dialog,
fields: [ title: '@i18n:objects.automember.add_rule',
{ fields: [
$type: 'entity_select', {
name: 'cn', $type: 'entity_select',
other_entity: 'group', name: 'cn',
other_field: 'cn' other_entity: 'group',
} other_field: 'cn'
], }
height: '300' ],
}). height: '300'
deleter_dialog({ },
$factory: IPA.automember.rule_deleter_dialog 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) { IPA.automember.rule_search_facet = function(spec) {
spec = spec || {}; spec = spec || {};
@@ -698,16 +697,23 @@ IPA.automember.default_group_widget = function(spec) {
return that; return that;
}; };
exp.entity_spec = make_spec();
IPA.register('automember', IPA.automember.entity); exp.register = function() {
var e = reg.entity;
phases.on('registration', function() {
var w = reg.widget; var w = reg.widget;
var f = reg.field; 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); w.register('automember_condition', IPA.automember.condition_widget);
f.register('automember_condition', IPA.automember.condition_field); f.register('automember_condition', IPA.automember.condition_field);
}); };
return {}; phases.on('registration', exp.register);
return exp;
}); });

View File

@@ -18,32 +18,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './navigation', './details', './search', './association', define([
'./entity'], function(IPA, $, navigation) { './ipa',
'./jquery',
'./navigation',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, navigation, phases, reg) {
IPA.automount = {}; var exp = IPA.automount = {};
IPA.automount.location_entity = function(spec) { var make_location_spec = function() {
return {
var that = IPA.entity(spec); name: 'automountlocation',
facet_groups: [ 'automountmap', 'settings' ],
that.init = function() { facets: [
that.entity_init(); {
$type: 'search',
that.builder.facet_groups([ 'automountmap', 'settings' ]).
search_facet({
title: IPA.metadata.objects.automountlocation.label, title: IPA.metadata.objects.automountlocation.label,
columns:['cn'] columns:['cn']
}). },
nested_search_facet({ {
$type: 'nested_search',
facet_group: 'automountmap', facet_group: 'automountmap',
nested_entity: 'automountmap', nested_entity: 'automountmap',
label: IPA.metadata.objects.automountmap.label, label: IPA.metadata.objects.automountmap.label,
tab_label: IPA.metadata.objects.automountmap.label, tab_label: IPA.metadata.objects.automountmap.label,
name: 'maps', name: 'maps',
columns: [ 'automountmapname' ] columns: [ 'automountmapname' ]
}). },
details_facet({ {
$type: 'details',
sections:[ sections:[
{ {
name: 'identity', name: 'identity',
@@ -51,25 +60,21 @@ IPA.automount.location_entity = function(spec) {
fields: [ 'cn' ] fields: [ 'cn' ]
} }
] ]
}). }
adder_dialog({ ],
fields: [ 'cn' ] adder_dialog: {
}); fields: [ 'cn' ]
}; }
};};
return that; var make_map_spec = function() {
}; return {
name: 'automountmap',
IPA.automount.map_entity = function(spec) { containing_entity: 'automountlocation',
facet_groups: [ 'automountkey', 'settings' ],
var that = IPA.entity(spec); facets: [
{
that.init = function() { $type: 'nested_search',
that.entity_init();
that.builder.containing_entity('automountlocation').
facet_groups([ 'automountkey', 'settings' ]).
nested_search_facet({
$factory: IPA.automount.key_search_facet, $factory: IPA.automount.key_search_facet,
facet_group: 'automountkey', facet_group: 'automountkey',
nested_entity: 'automountkey', nested_entity: 'automountkey',
@@ -85,8 +90,9 @@ IPA.automount.map_entity = function(spec) {
}, },
'automountinformation' 'automountinformation'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'identity', name: 'identity',
@@ -100,76 +106,69 @@ IPA.automount.map_entity = function(spec) {
] ]
} }
] ]
}). }
adder_dialog({ ],
$factory: IPA.automountmap_adder_dialog, adder_dialog: {
sections: [ $factory: IPA.automountmap_adder_dialog,
{ sections: [
name: 'general', {
fields: [ name: 'general',
{ fields: [
$type: 'radio', {
name: 'method', $type: 'radio',
enabled: false, //don't use value in add command name: 'method',
label: '@i18n:objects.automountmap.map_type', enabled: false, //don't use value in add command
options: [ label: '@i18n:objects.automountmap.map_type',
{ options: [
value: 'add', {
label: '@i18n:objects.automountmap.direct' value: 'add',
}, label: '@i18n:objects.automountmap.direct'
{ },
value: 'add_indirect', {
label: '@i18n:objects.automountmap.indirect' value: 'add_indirect',
} label: '@i18n:objects.automountmap.indirect'
] }
}, ]
'automountmapname', },
{ 'automountmapname',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}, ]
{ },
name: 'indirect', {
fields: [ name: 'indirect',
{ fields: [
name: 'key', {
label: '@mc-opt:automountmap_add_indirect:key:label' name: 'key',
}, label: '@mc-opt:automountmap_add_indirect:key:label'
{ },
name: 'parentmap', {
label: '@mc-opt:automountmap_add_indirect:parentmap:label' name: 'parentmap',
} label: '@mc-opt:automountmap_add_indirect:parentmap:label'
] }
} ]
] }
}); ]
}; }
};};
return that; var make_key_spec = function() {
}; return {
name: 'automountkey',
IPA.automount.key_entity = function(spec) { policies:[
spec = spec || {};
spec.policies = spec.policies || [
{ {
$factory: IPA.facet_update_policy, $factory: IPA.facet_update_policy,
source_facet: 'details', source_facet: 'details',
dest_entity: 'automountmap', dest_entity: 'automountmap',
dest_facet: 'keys' dest_facet: 'keys'
} }
]; ],
containing_entity: 'automountmap',
var that = IPA.entity(spec); facets: [
{
that.init = function() { $type: 'details',
that.entity_init();
that.builder.containing_entity('automountmap').
details_facet({
$factory: IPA.automount.key_details_facet, $factory: IPA.automount.key_details_facet,
sections: [ sections: [
{ {
@@ -185,28 +184,26 @@ IPA.automount.key_entity = function(spec) {
} }
], ],
disable_breadcrumb: false disable_breadcrumb: false
}). }
adder_dialog({ ],
show_edit_page : function(entity, result){ adder_dialog: {
var key = result.automountkey[0]; show_edit_page : function(entity, result){
var info = result.automountinformation[0]; var key = result.automountkey[0];
var pkeys = this.pkey_prefix.slice(0); var info = result.automountinformation[0];
pkeys.push(key); var pkeys = this.pkey_prefix.slice(0);
pkeys.push(key);
var args = { var args = {
info: info, info: info,
key: key key: key
}; };
navigation.show_entity(entity.name, 'details', pkeys, args); navigation.show_entity(entity.name, 'details', pkeys, args);
return false; return false;
}, },
fields:['automountkey','automountinformation'] fields:['automountkey','automountinformation']
}); }
}; };};
return that;
};
IPA.automount.key_details_facet = function(spec) { IPA.automount.key_details_facet = function(spec) {
@@ -355,9 +352,19 @@ IPA.automount.key_search_facet = function(spec) {
return that; return that;
}; };
IPA.register('automountlocation', IPA.automount.location_entity); exp.location_spec = make_location_spec();
IPA.register('automountmap', IPA.automount.map_entity); exp.map_spec = make_map_spec();
IPA.register('automountkey', IPA.automount.key_entity); exp.key_spec = make_key_spec();
return {}; 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 exp;
}); });

View File

@@ -29,7 +29,7 @@ define([
'./dialog'], './dialog'],
function(lang, IPA, $, phases, reg, text) { function(lang, IPA, $, phases, reg, text) {
IPA.cert = {}; var exp = IPA.cert = {};
IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----'; IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----';
IPA.cert.END_CERTIFICATE = '-----END 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) {
spec.policies = spec.policies || [ 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',
policies: [
IPA.search_facet_update_policy, IPA.search_facet_update_policy,
IPA.details_facet_update_policy, IPA.details_facet_update_policy,
{ {
@@ -967,102 +1047,13 @@ IPA.cert.entity = function(spec) {
dest_entity: 'service', dest_entity: 'service',
dest_facet: 'details' dest_facet: 'details'
} }
]; ],
enable_test: function() {
var that = IPA.entity(spec); return IPA.cert.is_enabled();
},
that.get_default_metadata = function() { facets: [
{
var add_param = function(name, label, doc, primary_key) { $type: 'search',
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({
$factory: IPA.cert.search_facet, $factory: IPA.cert.search_facet,
pagination: false, pagination: false,
no_update: true, no_update: true,
@@ -1128,8 +1119,9 @@ IPA.cert.entity = function(spec) {
label: '@i18n:objects.cert.find_revokedon_to' label: '@i18n:objects.cert.find_revokedon_to'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.cert.details_facet, $factory: IPA.cert.details_facet,
no_update: true, no_update: true,
actions: [ actions: [
@@ -1187,11 +1179,9 @@ IPA.cert.entity = function(spec) {
section: 'details' section: 'details'
} }
] ]
}); }
}; ]
};};
return that;
};
IPA.cert.search_facet = function(spec) { 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 w = reg.widget;
var f = reg.field; var f = reg.field;
var a = reg.action; var a = reg.action;
e.register({type: 'cert', spec: exp.entity_spec});
w.register('certificate_status', IPA.cert.status_widget); w.register('certificate_status', IPA.cert.status_widget);
f.register('certificate_status', IPA.cert.status_field); 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_request', IPA.cert.request_action);
a.register('cert_revoke', IPA.cert.revoke_action); a.register('cert_revoke', IPA.cert.revoke_action);
a.register('cert_restore', IPA.cert.restore_action); a.register('cert_restore', IPA.cert.restore_action);
}); };
return {}; phases.on('registration', exp.register);
phases.on('post-metadata', exp.create_cert_metadata);
return exp;
}); });

View File

@@ -35,28 +35,20 @@ define([
'./entity'], './entity'],
function(IPA, $, NET, navigation, menu, phases, reg, text) { function(IPA, $, NET, navigation, menu, phases, reg, text) {
IPA.dns = { var exp = IPA.dns = {
zone_permission_name: 'Manage DNS zone ${dnszone}' zone_permission_name: 'Manage DNS zone ${dnszone}'
}; };
IPA.dns.config_entity = function(spec) { var make_config_spec = function() {
return {
spec = spec || {}; name: 'dnsconfig',
spec.defines_key = false; defines_key: false,
enable_test: function() {
var that = IPA.entity(spec); return IPA.dns_enabled;
},
that.init = function() { facets: [
{
if (!IPA.dns_enabled) { $type: 'details',
throw {
expected: true
};
}
that.entity_init();
that.builder.details_facet({
title: IPA.metadata.objects.config.label, title: IPA.metadata.objects.config.label,
sections: [ sections: [
{ {
@@ -96,28 +88,20 @@ IPA.dns.config_entity = function(spec) {
} }
], ],
needs_update: true 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(); var make_zone_spec = function() {
return {
that.builder.facet_groups([ 'dnsrecord', 'settings' ]). name: 'dnszone',
search_facet({ enable_test: function() {
return IPA.dns_enabled;
},
facet_groups: [ 'dnsrecord', 'settings' ],
facets: [
{
$type: 'search',
row_enabled_attribute: 'idnszoneactive', row_enabled_attribute: 'idnszoneactive',
title: IPA.metadata.objects.dnszone.label, title: IPA.metadata.objects.dnszone.label,
columns: [ columns: [
@@ -144,8 +128,9 @@ IPA.dns.zone_entity = function(spec) {
icon: 'enabled-icon' icon: 'enabled-icon'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.dnszone_details_facet, $factory: IPA.dnszone_details_facet,
command_mode: 'info', command_mode: 'info',
sections: [ sections: [
@@ -259,8 +244,9 @@ IPA.dns.zone_entity = function(spec) {
IPA.disabled_summary_cond IPA.disabled_summary_cond
] ]
} }
}). },
nested_search_facet({ {
$type: 'nested_search',
$factory: IPA.dns.record_search_facet, $factory: IPA.dns.record_search_facet,
facet_group: 'dnsrecord', facet_group: 'dnsrecord',
nested_entity : 'dnsrecord', nested_entity : 'dnsrecord',
@@ -284,54 +270,53 @@ IPA.dns.zone_entity = function(spec) {
label: '@i18n:objects.dnsrecord.data' label: '@i18n:objects.dnsrecord.data'
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
$factory: IPA.dnszone_adder_dialog, adder_dialog: {
height: 300, $factory: IPA.dnszone_adder_dialog,
sections: [ height: 300,
{ sections: [
$factory: IPA.dnszone_name_section, {
name: 'name', $factory: IPA.dnszone_name_section,
fields: [ name: 'name',
{ fields: [
$type: 'dnszone_name', {
name: 'idnsname', $type: 'dnszone_name',
required: false, name: 'idnsname',
radio_name: 'dnszone_name_type' required: false,
}, radio_name: 'dnszone_name_type'
{ },
$type: 'dnszone_name', {
name: 'name_from_ip', $type: 'dnszone_name',
radio_name: 'dnszone_name_type', name: 'name_from_ip',
validators: ['network'] radio_name: 'dnszone_name_type',
} validators: ['network']
] }
}, ]
{ },
name: 'other', {
fields: [ name: 'other',
'idnssoamname', fields: [
{ 'idnssoamname',
name: 'idnssoarname', {
required: false name: 'idnssoarname',
}, required: false
{ },
$type: 'force_dnszone_add_checkbox', {
name: 'force', $type: 'force_dnszone_add_checkbox',
metadata: '@mc-opt:dnszone_add:force' name: 'force',
} metadata: '@mc-opt:dnszone_add:force'
] }
} ]
], }
policies: [ ],
IPA.add_dns_zone_name_policy policies: [
] IPA.add_dns_zone_name_policy
}); ]
}; }
};};
return that;
};
IPA.dnszone_details_facet = function(spec, no_init) { IPA.dnszone_details_facet = function(spec, no_init) {
@@ -1129,11 +1114,14 @@ IPA.dns.get_record_type = function(type_name) {
return null; return null;
}; };
IPA.dns.record_entity = function(spec) {
spec = spec || {}; var make_record_spec = function() {
return {
spec.policies = spec.policies || [ name: 'dnsrecord',
enable_test: function() {
return IPA.dns_enabled;
},
policies: [
{ {
$factory: IPA.facet_update_policy, $factory: IPA.facet_update_policy,
source_facet: 'details', source_facet: 'details',
@@ -1141,22 +1129,11 @@ IPA.dns.record_entity = function(spec) {
dest_facet: 'records' dest_facet: 'records'
}, },
IPA.adder_facet_update_policy IPA.adder_facet_update_policy
]; ],
containing_entity: 'dnszone',
var that = IPA.entity(spec); facets: [
{
that.init = function() { $type: 'details',
if (!IPA.dns_enabled) {
throw {
expected: true
};
}
that.entity_init();
that.builder.containing_entity('dnszone').
details_facet({
$factory: IPA.dns.record_details_facet, $factory: IPA.dns.record_details_facet,
disable_breadcrumb: false, disable_breadcrumb: false,
fields: [ fields: [
@@ -1182,46 +1159,44 @@ IPA.dns.record_entity = function(spec) {
] ]
} }
] ]
}). }
adder_dialog({ ],
$factory: IPA.dns.record_adder_dialog, adder_dialog: {
fields: [ $factory: IPA.dns.record_adder_dialog,
{ fields: [
name: 'idnsname', {
widget: 'general.idnsname' name: 'idnsname',
}, widget: 'general.idnsname'
{ },
name: 'record_type', {
$type: 'dnsrecord_type', name: 'record_type',
flags: ['no_command'], $type: 'dnsrecord_type',
widget: 'general.record_type' flags: ['no_command'],
} widget: 'general.record_type'
], }
widgets: [ ],
{ widgets: [
name: 'general', {
$type: 'details_table_section_nc', name: 'general',
widgets: [ $type: 'details_table_section_nc',
'idnsname', widgets: [
{ 'idnsname',
$type: 'dnsrecord_type', {
name: 'record_type', $type: 'dnsrecord_type',
label: '@i18n:objects.dnsrecord.type' name: 'record_type',
} label: '@i18n:objects.dnsrecord.type'
] }
} ]
], }
policies: [ ],
{ policies: [
$factory: IPA.dnsrecord_adder_dialog_type_policy, {
type_field: 'record_type' $factory: IPA.dnsrecord_adder_dialog_type_policy,
} type_field: 'record_type'
] }
}); ]
}; }
};};
return that;
};
IPA.dns.record_adder_dialog = function(spec) { IPA.dns.record_adder_dialog = function(spec) {
@@ -2523,22 +2498,26 @@ IPA.network_validator = function(spec) {
return that; return that;
}; };
phases.on('profile', function() { exp.remove_menu_item = function() {
if (!IPA.dns_enabled) { if (!IPA.dns_enabled) {
menu.remove_item('identity/dns'); menu.remove_item('identity/dns');
} }
}, 20); };
IPA.register('dnsconfig', IPA.dns.config_entity); exp.config_spec = make_config_spec();
IPA.register('dnszone', IPA.dns.zone_entity); exp.zone_spec = make_zone_spec();
IPA.register('dnsrecord', IPA.dns.record_entity); exp.record_spec = make_record_spec();
exp.register = function() {
phases.on('registration', function() { var e = reg.entity;
var w = reg.widget; var w = reg.widget;
var f = reg.field; var f = reg.field;
var v = reg.validator; var v = reg.validator;
var a = reg.action; 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('dnszone_name', IPA.dnszone_name_widget);
w.register('force_dnszone_add_checkbox', IPA.force_dnszone_add_checkbox_widget); w.register('force_dnszone_add_checkbox', IPA.force_dnszone_add_checkbox_widget);
f.register('force_dnszone_add_checkbox', IPA.checkbox_field); 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_add_permission', IPA.dns.add_permission_action);
a.register('dns_remove_permission', IPA.dns.remove_permission_action); a.register('dns_remove_permission', IPA.dns.remove_permission_action);
}); };
return {}; phases.on('registration', exp.register);
phases.on('profile', exp.remove_menu_item, 20);
return exp;
}); });

View File

@@ -18,28 +18,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './text', './details', './search', './add', define([
'./facet', './entity', './field', './widget'], function(IPA, $, text) { './ipa',
'./jquery',
'./phases',
'./reg',
'./text',
'./details',
'./search',
'./add',
'./facet',
'./entity',
'./field',
'./widget'],
function(IPA, $, phases, reg, text) {
IPA.entitle = {}; var exp = IPA.entitle = {};
IPA.entitle.unregistered = 'unregistered'; IPA.entitle.unregistered = 'unregistered';
IPA.entitle.online = 'online'; IPA.entitle.online = 'online';
IPA.entitle.offline = 'offline'; IPA.entitle.offline = 'offline';
IPA.entitle.entity = function(spec) {
spec = spec || {}; var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'entitle',
facet_groups: [ 'account', 'certificates' ],
that.status = IPA.entitle.unregistered; facets: [
{
that.init = function() { $type: 'details',
that.entity_init();
that.builder.facet_groups([ 'account', 'certificates' ]).
details_facet({
$factory: IPA.entitle.details_facet, $factory: IPA.entitle.details_facet,
label: '@i18n:objects.entitle.account', label: '@i18n:objects.entitle.account',
facet_group: 'account', facet_group: 'account',
@@ -82,8 +89,8 @@ IPA.entitle.entity = function(spec) {
] ]
} }
] ]
}). },
facet({ {
$factory: IPA.entitle.certificates_facet, $factory: IPA.entitle.certificates_facet,
name: 'certificates', name: 'certificates',
label: '@i18n:objects.entitle.certificates', label: '@i18n:objects.entitle.certificates',
@@ -111,9 +118,11 @@ IPA.entitle.entity = function(spec) {
label: '@i18n:objects.entitle.certificate' label: '@i18n:objects.entitle.certificate'
} }
] ]
}). }
standard_association_facets(). ],
dialog({ standard_association_facets: true,
dialogs: [
{
$factory: IPA.entitle.register_online_dialog, $factory: IPA.entitle.register_online_dialog,
name: 'online_registration', name: 'online_registration',
title: '@i18n:objects.entitle.registration', title: '@i18n:objects.entitle.registration',
@@ -134,8 +143,8 @@ IPA.entitle.entity = function(spec) {
} }
*/ */
] ]
}). },
dialog({ {
$factory: IPA.entitle.register_offline_dialog, $factory: IPA.entitle.register_offline_dialog,
name: 'offline_registration', name: 'offline_registration',
title: '@i18n:objects.entitle.import_certificate', title: '@i18n:objects.entitle.import_certificate',
@@ -146,8 +155,8 @@ IPA.entitle.entity = function(spec) {
label: '@i18n:objects.entitle.certificate' label: '@i18n:objects.entitle.certificate'
} }
] ]
}). },
dialog({ {
$factory: IPA.entitle.consume_dialog, $factory: IPA.entitle.consume_dialog,
name: 'consume', name: 'consume',
title: '@i18n:objects.entitle.consume_entitlement', title: '@i18n:objects.entitle.consume_entitlement',
@@ -158,8 +167,8 @@ IPA.entitle.entity = function(spec) {
metadata: '@mc-arg:entitle_consume:quantity' metadata: '@mc-arg:entitle_consume:quantity'
} }
] ]
}). },
dialog({ {
$factory: IPA.entitle.import_dialog, $factory: IPA.entitle.import_dialog,
name: 'import', name: 'import',
title: '@i18n:objects.entitle.import_certificate', title: '@i18n:objects.entitle.import_certificate',
@@ -170,8 +179,17 @@ IPA.entitle.entity = function(spec) {
label: '@i18n:objects.entitle.certificate' 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) { that.get_accounts = function(on_success, on_error) {
@@ -740,7 +758,12 @@ IPA.entitle.download_widget = function(spec) {
return that; 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;
}); });

View File

@@ -33,21 +33,20 @@ define([
var exp = IPA.group = {}; var exp = IPA.group = {};
IPA.group.entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'group',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'gidnumber', 'gidnumber',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'details', name: 'details',
@@ -84,8 +83,9 @@ IPA.group.entity = function(spec) {
IPA.object_class_evaluator IPA.object_class_evaluator
] ]
} }
}). },
association_facet({ {
$type: 'association',
name: 'member_user', name: 'member_user',
columns:[ columns:[
'uid', 'uid',
@@ -105,11 +105,13 @@ IPA.group.entity = function(spec) {
width: '100px' width: '100px'
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'member_group' name: 'member_group'
}). },
attribute_facet({ {
$type: 'attribute',
name: 'member_external', name: 'member_external',
attribute: 'ipaexternalmember', attribute: 'ipaexternalmember',
tab_label: 'External', tab_label: 'External',
@@ -120,69 +122,71 @@ IPA.group.entity = function(spec) {
label: '@mc-opt:group_add_member:ipaexternalmember:label' label: '@mc-opt:group_add_member:ipaexternalmember:label'
} }
] ]
},
}). {
association_facet({ $type: 'association',
name: 'memberof_group', name: 'memberof_group',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_netgroup', name: 'memberof_netgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_role', name: 'memberof_role',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hbacrule', name: 'memberof_hbacrule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_user', add_method: 'add_user',
remove_method: 'remove_user' remove_method: 'remove_user'
}). },
association_facet({ {
$type: 'association',
name: 'memberof_sudorule', name: 'memberof_sudorule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_user', add_method: 'add_user',
remove_method: 'remove_user' remove_method: 'remove_user'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
$factory: IPA.group_adder_dialog, adder_dialog: {
fields: [ $factory: IPA.group_adder_dialog,
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
}, name: 'description'
{ },
$type: 'radio', {
name: 'type', $type: 'radio',
label: '@i18n:objects.group.type', name: 'type',
flags: ['no_command'], label: '@i18n:objects.group.type',
default_value: 'posix', flags: ['no_command'],
options: [ default_value: 'posix',
{ options: [
value: 'normal', {
label: '@i18n:objects.group.normal' value: 'normal',
}, label: '@i18n:objects.group.normal'
{ },
value: 'external', {
label: '@i18n:objects.group.external' value: 'external',
}, label: '@i18n:objects.group.external'
{ },
value: 'posix', {
label: '@i18n:objects.group.posix' value: 'posix',
} label: '@i18n:objects.group.posix'
] }
}, ]
'gidnumber' },
] 'gidnumber'
}); ]
}; }
};};
return that;
};
IPA.group_adder_dialog = function(spec) { IPA.group_adder_dialog = function(spec) {
@@ -262,11 +266,13 @@ IPA.group.make_external_action = function(spec) {
return that; return that;
}; };
IPA.register('group', IPA.group.entity); exp.entity_spec = make_spec();
exp.register = function() { exp.register = function() {
var e = reg.entity;
var a = reg.action; var a = reg.action;
e.register({ type: 'group', spec: exp.entity_spec });
a.register('make_posix', exp.make_posix_action); a.register('make_posix', exp.make_posix_action);
a.register('make_external', exp.make_external_action); a.register('make_external', exp.make_external_action);
}; };

View File

@@ -19,22 +19,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
IPA.hbac = { var exp = IPA.hbac = {
//priority of commands in details facet //priority of commands in details facet
remove_method_priority: IPA.config.default_priority - 1 remove_method_priority: IPA.config.default_priority - 1
}; };
IPA.hbac.rule_entity = function(spec) { var make_rule_spec = function() {
return {
var that = IPA.entity(spec); name: 'hbacrule',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag', row_enabled_attribute: 'ipaenabledflag',
search_all_attributes: true, search_all_attributes: true,
columns: [ columns: [
@@ -62,10 +68,10 @@ IPA.hbac.rule_entity = function(spec) {
icon: 'enabled-icon' icon: 'enabled-icon'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.hbacrule_details_facet, $factory: IPA.hbacrule_details_facet,
entity: that,
command_mode: 'info', command_mode: 'info',
actions: [ actions: [
'select', 'select',
@@ -86,29 +92,26 @@ IPA.hbac.rule_entity = function(spec) {
IPA.disabled_summary_cond IPA.disabled_summary_cond
] ]
} }
}). }
adder_dialog({ ],
fields: [ 'cn' ] adder_dialog: {
}); fields: [ 'cn' ]
}; }
};};
return that; var make_service_spec = function() {
}; return {
name: 'hbacsvc',
IPA.hbac.service_entity = function(spec) { facets: [
{
var that = IPA.entity(spec); $type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'general', name: 'general',
@@ -122,8 +125,9 @@ IPA.hbac.service_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hbacsvcgroup', name: 'memberof_hbacsvcgroup',
associator: IPA.serial_associator, associator: IPA.serial_associator,
columns:[ columns:[
@@ -141,36 +145,33 @@ IPA.hbac.service_entity = function(spec) {
width: '100px' width: '100px'
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that; var make_service_group_spec = function() {
}; return {
name: 'hbacsvcgroup',
IPA.hbac.service_group_entity = function(spec) { facets: [
{
var that = IPA.entity(spec); $type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'general', name: 'general',
@@ -184,8 +185,9 @@ IPA.hbac.service_group_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'member_hbacsvc', name: 'member_hbacsvc',
columns:[ columns:[
'cn', 'cn',
@@ -202,21 +204,19 @@ IPA.hbac.service_group_entity = function(spec) {
width: '100px' width: '100px'
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that;
};
IPA.hbacrule_details_facet = function(spec) { IPA.hbacrule_details_facet = function(spec) {
@@ -480,9 +480,16 @@ IPA.hbacrule_details_facet = function(spec) {
return that; return that;
}; };
IPA.register('hbacrule', IPA.hbac.rule_entity); exp.rule_spec = make_rule_spec();
IPA.register('hbacsvc', IPA.hbac.service_entity); exp.svc_spec = make_service_spec();
IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity); 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;
}); });

View File

@@ -18,24 +18,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './navigation', './text', './details', './search', define([
'./association', './entity', './hbac'], function(IPA, $, navigation, text) { './ipa',
'./jquery',
'./navigation',
'./phases',
'./reg',
'./text',
'./details',
'./search',
'./association',
'./entity',
'./hbac'],
function(IPA, $, navigation, phases, reg, text) {
IPA.hbac.test_entity = function(spec) { var exp = {};
var that = IPA.entity(spec); var make_spec = function() {
return {
that.get_default_metadata = function() { name: 'hbactest',
return IPA.metadata.commands[that.name]; facet_groups: [ 'default' ],
}; facets: [
{
that.init = function() {
that.entity_init();
that.label = text.get('@i18n:objects.hbactest.label');
that.builder.facet_groups([ 'default' ]).
facet({
$factory: IPA.hbac.test_select_facet, $factory: IPA.hbac.test_select_facet,
name: 'user', name: 'user',
label: '@i18n:objects.hbacrule.user', label: '@i18n:objects.hbacrule.user',
@@ -56,8 +60,8 @@ IPA.hbac.test_entity = function(spec) {
} }
} }
] ]
}). },
facet({ {
$factory: IPA.hbac.test_select_facet, $factory: IPA.hbac.test_select_facet,
name: 'targethost', name: 'targethost',
label: '@i18n:objects.hbacrule.host', label: '@i18n:objects.hbacrule.host',
@@ -73,8 +77,8 @@ IPA.hbac.test_entity = function(spec) {
formatter: 'boolean' formatter: 'boolean'
} }
] ]
}). },
facet({ {
$factory: IPA.hbac.test_select_facet, $factory: IPA.hbac.test_select_facet,
name: 'service', name: 'service',
label: '@i18n:objects.hbacrule.service', label: '@i18n:objects.hbacrule.service',
@@ -85,8 +89,8 @@ IPA.hbac.test_entity = function(spec) {
'cn', 'cn',
'description' 'description'
] ]
}). },
facet({ {
$factory: IPA.hbac.test_rules_facet, $factory: IPA.hbac.test_rules_facet,
name: 'rules', name: 'rules',
label: '@i18n:objects.hbactest.rules', label: '@i18n:objects.hbactest.rules',
@@ -103,8 +107,8 @@ IPA.hbac.test_entity = function(spec) {
}, },
'description' 'description'
] ]
}). },
facet({ {
$factory: IPA.hbac.test_run_facet, $factory: IPA.hbac.test_run_facet,
name: 'run_test', name: 'run_test',
label: '@i18n:objects.hbactest.run_test', label: '@i18n:objects.hbactest.run_test',
@@ -126,7 +130,17 @@ IPA.hbac.test_entity = function(spec) {
}, },
'description' '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; return that;
@@ -806,7 +820,16 @@ IPA.hbac.validation_dialog = function(spec) {
return that; 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;
}); });

View File

@@ -33,11 +33,10 @@ define(['./ipa',
var exp = IPA.host = {}; var exp = IPA.host = {};
IPA.host.entity = function(spec) { var make_spec = function() {
return {
spec = spec || {}; name: 'host',
policies: [
spec.policies = spec.policies || [
IPA.search_facet_update_policy, IPA.search_facet_update_policy,
IPA.details_facet_update_policy, IPA.details_facet_update_policy,
{ {
@@ -52,14 +51,10 @@ IPA.host.entity = function(spec) {
dest_entity: 'cert', dest_entity: 'cert',
dest_facet: 'search' dest_facet: 'search'
} }
]; ],
facets: [
var that = IPA.entity(spec); {
$type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ columns: [
'fqdn', 'fqdn',
'description', 'description',
@@ -69,8 +64,9 @@ IPA.host.entity = function(spec) {
formatter: 'boolean' formatter: 'boolean'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.host.details_facet, $factory: IPA.host.details_facet,
sections: [ sections: [
{ {
@@ -181,76 +177,80 @@ IPA.host.entity = function(spec) {
IPA.host.enrollment_policy, IPA.host.enrollment_policy,
IPA.host.certificate_policy IPA.host.certificate_policy
] ]
}). },
association_facet({ {
$type: 'association',
name: 'managedby_host', name: 'managedby_host',
add_method: 'add_managedby', add_method: 'add_managedby',
remove_method: 'remove_managedby' remove_method: 'remove_managedby'
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hostgroup', name: 'memberof_hostgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_netgroup', name: 'memberof_netgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_role', name: 'memberof_role',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hbacrule', name: 'memberof_hbacrule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_host', add_method: 'add_host',
remove_method: 'remove_host' remove_method: 'remove_host'
}). },
association_facet({ {
$type: 'association',
name: 'memberof_sudorule', name: 'memberof_sudorule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_host', add_method: 'add_host',
remove_method: 'remove_host' remove_method: 'remove_host'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
$factory: IPA.host_adder_dialog, adder_dialog: {
height: 300, $factory: IPA.host_adder_dialog,
sections: [ height: 300,
{ sections: [
$factory: IPA.composite_widget, {
name: 'fqdn', $factory: IPA.composite_widget,
fields: [ name: 'fqdn',
{ fields: [
$type: 'host_fqdn', {
name: 'fqdn', $type: 'host_fqdn',
required: true name: 'fqdn',
} required: true
] }
}, ]
{ },
name: 'other', {
fields: [ name: 'other',
{ fields: [
name: 'ip_address', {
validators: [ 'ip_address' ], name: 'ip_address',
metadata: '@mc-opt:host_add:ip_address' validators: [ 'ip_address' ],
}, metadata: '@mc-opt:host_add:ip_address'
{ },
$type: 'force_host_add_checkbox', {
name: 'force', $type: 'force_host_add_checkbox',
metadata: '@mc-opt:host_add:force' name: 'force',
} metadata: '@mc-opt:host_add:force'
] }
} ]
] }
}). ]
deleter_dialog({ },
$factory: IPA.host_deleter_dialog deleter_dialog: {
}); $factory: IPA.host_deleter_dialog
}; }
};};
return that;
};
IPA.host.details_facet = function(spec, no_init) { IPA.host.details_facet = function(spec, no_init) {
@@ -962,13 +962,15 @@ IPA.host.certificate_policy = function(spec) {
return that; 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 w = reg.widget;
var f = reg.field; var f = reg.field;
var a = reg.action; var a = reg.action;
e.register({type: 'host', spec: exp.entity_spec});
f.register('host_fqdn', IPA.host_fqdn_field); f.register('host_fqdn', IPA.host_fqdn_field);
w.register('host_fqdn', IPA.host_fqdn_widget); w.register('host_fqdn', IPA.host_fqdn_widget);
f.register('dnszone_select', IPA.field); f.register('dnszone_select', IPA.field);
@@ -982,8 +984,8 @@ phases.on('registration', function() {
a.register('host_unprovision', exp.unprovision_action); a.register('host_unprovision', exp.unprovision_action);
a.register('set_otp', exp.set_otp_action); a.register('set_otp', exp.set_otp_action);
}); };
phases.on('registration', exp.register);
return exp; return exp;
}); });

View File

@@ -1,5 +1,6 @@
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Petr Vobornik <pvoborni@redhat.com>
* *
* Copyright (C) 2010 Red Hat * Copyright (C) 2010 Red Hat
* see file 'COPYING' for use and warranty information * see file 'COPYING' for use and warranty information
@@ -18,25 +19,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
IPA.hostgroup = {}; var exp = IPA.hostgroup = {};
IPA.hostgroup.entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'hostgroup',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'identity', name: 'identity',
@@ -50,43 +58,51 @@ IPA.hostgroup.entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hostgroup', name: 'memberof_hostgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_netgroup', name: 'memberof_netgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). },
association_facet({ {
$type: 'association',
name: 'memberof_hbacrule', name: 'memberof_hbacrule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_host', add_method: 'add_host',
remove_method: 'remove_host' remove_method: 'remove_host'
}). },
association_facet({ {
$type: 'association',
name: 'memberof_sudorule', name: 'memberof_sudorule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_host', add_method: 'add_host',
remove_method: 'remove_host' remove_method: 'remove_host'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that;
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);
IPA.register('hostgroup', IPA.hostgroup.entity); return exp;
return {};
}); });

View File

@@ -18,27 +18,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
IPA.idrange = {}; var exp = IPA.idrange = {};
IPA.idrange.entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'idrange',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'ipabaseid', 'ipabaseid',
'ipaidrangesize', 'ipaidrangesize',
'iparangetype' 'iparangetype'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'details', name: 'details',
@@ -73,93 +80,96 @@ IPA.idrange.entity = function(spec) {
] ]
} }
] ]
}). }
adder_dialog({ ],
fields: [ adder_dialog: {
{ fields: [
name: 'cn', {
widget: 'idrange.cn' name: 'cn',
}, widget: 'idrange.cn'
{ },
name: 'ipabaseid', {
label: '@i18n:objects.idrange.ipabaseid', name: 'ipabaseid',
tooltip: '@mo-param:idrange:ipabaseid:label', label: '@i18n:objects.idrange.ipabaseid',
widget: 'idrange.ipabaseid' tooltip: '@mo-param:idrange:ipabaseid:label',
}, widget: 'idrange.ipabaseid'
{ },
name: 'ipaidrangesize', {
label: '@i18n:objects.idrange.ipaidrangesize', name: 'ipaidrangesize',
tooltip: '@mo-param:idrange:ipaidrangesize:label', label: '@i18n:objects.idrange.ipaidrangesize',
widget: 'idrange.ipaidrangesize' tooltip: '@mo-param:idrange:ipaidrangesize:label',
}, widget: 'idrange.ipaidrangesize'
{ },
name: 'ipabaserid', {
label: '@i18n:objects.idrange.ipabaserid', name: 'ipabaserid',
tooltip: '@mo-param:idrange:ipabaserid:label', label: '@i18n:objects.idrange.ipabaserid',
widget: 'idrange.ipabaserid' tooltip: '@mo-param:idrange:ipabaserid:label',
}, widget: 'idrange.ipabaserid'
{ },
name: 'ipasecondarybaserid', {
label: '@i18n:objects.idrange.ipasecondarybaserid', name: 'ipasecondarybaserid',
tooltip: '@mo-param:idrange:ipasecondarybaserid:label', label: '@i18n:objects.idrange.ipasecondarybaserid',
widget: 'type.ipasecondarybaserid' tooltip: '@mo-param:idrange:ipasecondarybaserid:label',
}, widget: 'type.ipasecondarybaserid'
{ },
name: 'ipanttrusteddomainsid', {
label: '@i18n:objects.idrange.ipanttrusteddomainsid', name: 'ipanttrusteddomainsid',
tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label', label: '@i18n:objects.idrange.ipanttrusteddomainsid',
widget: 'type.ipanttrusteddomainsid' tooltip: '@mo-param:idrange:ipanttrusteddomainsid:label',
} widget: 'type.ipanttrusteddomainsid'
], }
widgets: [ ],
{ widgets: [
$type: 'details_table_section_nc', {
name: 'idrange', $type: 'details_table_section_nc',
widgets: [ name: 'idrange',
'cn', widgets: [
'ipabaseid', 'cn',
'ipaidrangesize', 'ipabaseid',
'ipabaserid' 'ipaidrangesize',
] 'ipabaserid'
}, ]
{ },
$type: 'multiple_choice_section', {
name: 'type', $type: 'multiple_choice_section',
label: '@i18n:objects.idrange.type', name: 'type',
choices: [ label: '@i18n:objects.idrange.type',
{ choices: [
name: 'local', {
label: '@i18n:objects.idrange.type_local', name: 'local',
fields: ['ipasecondarybaserid'], label: '@i18n:objects.idrange.type_local',
required: ['ipasecondarybaserid'], fields: ['ipasecondarybaserid'],
enabled: true required: ['ipasecondarybaserid'],
}, enabled: true
{ },
name: 'ad', {
label: '@i18n:objects.idrange.type_ad', name: 'ad',
fields: ['ipanttrusteddomainsid'], label: '@i18n:objects.idrange.type_ad',
required: ['ipanttrusteddomainsid'] fields: ['ipanttrusteddomainsid'],
} required: ['ipanttrusteddomainsid']
], }
widgets: [ ],
'ipasecondarybaserid', widgets: [
'ipanttrusteddomainsid' 'ipasecondarybaserid',
] 'ipanttrusteddomainsid'
} ]
], }
policies: [ ],
{ policies: [
$factory: IPA.multiple_choice_section_policy, {
widget: 'type' $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});
}; };
phases.on('registration', exp.register);
IPA.register('idrange', IPA.idrange.entity);
return {}; return {};
}); });

View File

@@ -18,51 +18,56 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './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, remove_method_priority: IPA.config.default_priority - 1,
enable_priority: IPA.config.default_priority + 1 enable_priority: IPA.config.default_priority + 1
}; };
IPA.netgroup.entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'netgroup',
facet_groups: ['settings', 'member', 'memberof'],
that.init = function() { facets: [
that.entity_init(); {
$type: 'search',
that.builder.facet_groups(['settings', 'member', 'memberof']).
search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.netgroup.details_facet, $factory: IPA.netgroup.details_facet,
entity: that,
command_mode: 'info' command_mode: 'info'
}). },
association_facet({ {
$type: 'association',
name: 'memberof_netgroup', name: 'memberof_netgroup',
associator: IPA.serial_associator associator: IPA.serial_associator
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that;
};
IPA.netgroup.details_facet = function(spec) { IPA.netgroup.details_facet = function(spec) {
@@ -302,7 +307,13 @@ IPA.netgroup.details_facet = function(spec) {
return that; 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 {}; return {};
}); });

View File

@@ -38,6 +38,7 @@ define([
'customization', 'customization',
'init', 'init',
'metadata', 'metadata',
'post-metadata',
'profile', 'profile',
'runtime', 'runtime',
'shutdown' 'shutdown'

View File

@@ -18,23 +18,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './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 make_pwpolicy_spec = function() {
return {
var that = IPA.entity(spec); name: 'pwpolicy',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
sort_enabled: false, sort_enabled: false,
columns:['cn','cospriority'] columns:['cn','cospriority']
}). },
details_facet({ {
$type: 'details',
sections:[ sections:[
{ {
name : 'identity', name : 'identity',
@@ -63,36 +71,33 @@ IPA.pwpolicy.entity = function(spec) {
}, },
'cospriority' 'cospriority'
] ]
}]}). }]
standard_association_facets(). }
adder_dialog({ ],
fields: [ standard_association_facets: true,
{ adder_dialog: {
$type: 'entity_select', fields: [
name: 'cn', {
other_entity: 'group', $type: 'entity_select',
other_field: 'cn', name: 'cn',
required: true other_entity: 'group',
}, other_field: 'cn',
'cospriority' required: true
], },
height: 300 'cospriority'
}); ],
}; height: 300
}
};};
return that; exp.krbtpolicy = IPA.krbtpolicy = {};
};
IPA.krbtpolicy = {}; var make_krbtpolicy_spec = function() {
return {
IPA.krbtpolicy.entity = function(spec) { name: 'krbtpolicy',
facets: [
var that = IPA.entity(spec); {
$type: 'details',
that.init = function() {
that.entity_init();
that.builder.details_facet({
title: IPA.metadata.objects.krbtpolicy.label, title: IPA.metadata.objects.krbtpolicy.label,
sections: [ sections: [
{ {
@@ -110,14 +115,18 @@ IPA.krbtpolicy.entity = function(spec) {
} }
], ],
needs_update: true 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); return exp;
IPA.register('krbtpolicy', IPA.krbtpolicy.entity);
return {};
}); });

View File

@@ -18,20 +18,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './entity'], function (IPA, $) { define([
'./ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./entity'],
function (IPA, $, phases, reg) {
IPA.realmdomains = {}; var exp = IPA.realmdomains = {};
IPA.realmdomains.entity = function (spec) { var make_spec = function() {
return {
spec = spec || {}; name: 'realmdomains',
spec.defines_key = false; defines_key: false,
var that = IPA.entity(spec); facets: [
{
that.init = function () { $type: 'details',
that.entity_init();
that.builder.details_facet({
$factory: IPA.realmdomains_details_facet, $factory: IPA.realmdomains_details_facet,
title: IPA.metadata.objects.realmdomains.label, title: IPA.metadata.objects.realmdomains.label,
sections: [ sections: [
@@ -47,10 +51,9 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) {
} }
], ],
needs_update: true needs_update: true
}); }
}; ]
return that; };};
};
IPA.realmdomains_details_facet = function (spec) { IPA.realmdomains_details_facet = function (spec) {
spec = spec || {}; spec = spec || {};
@@ -99,7 +102,12 @@ define(['./ipa', './jquery', './details', './entity'], function (IPA, $) {
return that; 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;
}); });

View File

@@ -18,21 +18,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './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 remove_method_priority: IPA.config.default_priority - 1
}; };
IPA.selinux.selinuxusermap_entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'selinuxusermap',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag', row_enabled_attribute: 'ipaenabledflag',
search_all_attributes: true, search_all_attributes: true,
columns: [ columns: [
@@ -61,10 +67,10 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
icon: 'enabled-icon' icon: 'enabled-icon'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.selinux_details_facet, $factory: IPA.selinux_details_facet,
entity: that,
command_mode: 'info', command_mode: 'info',
actions: [ actions: [
'select', 'select',
@@ -85,17 +91,15 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
IPA.disabled_summary_cond IPA.disabled_summary_cond
] ]
} }
}). }
adder_dialog({ ],
fields: [ adder_dialog: {
'cn', fields: [
'ipaselinuxuser' 'cn',
] 'ipaselinuxuser'
}); ]
}; }
};};
return that;
};
IPA.selinux_details_facet = function(spec) { IPA.selinux_details_facet = function(spec) {
@@ -311,7 +315,12 @@ IPA.selinux_details_facet = function(spec) {
return that; 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;
}); });

View File

@@ -19,21 +19,26 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './details', './search', './association', define([
'./entity'], function(IPA, $) { './ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
IPA.serverconfig = {}; var exp = IPA.serverconfig = {};
IPA.serverconfig.entity = function(spec) { var make_spec = function() {
return {
spec = spec || {}; name: 'config',
spec.defines_key = false; defines_key: false,
var that = IPA.entity(spec); facets: [
{
that.init = function() { $type: 'details',
that.entity_init();
that.builder.details_facet({
title: IPA.metadata.objects.config.label, title: IPA.metadata.objects.config.label,
sections: [ sections: [
{ {
@@ -110,13 +115,16 @@ IPA.serverconfig.entity = function(spec) {
} }
], ],
needs_update: true 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});
}; };
phases.on('registration', exp.register);
IPA.register('config', IPA.serverconfig.entity);
return {}; return {};
}); });

View File

@@ -30,13 +30,12 @@ define([
'./entity'], './entity'],
function(IPA, $, phases, reg, text) { function(IPA, $, phases, reg, text) {
IPA.service = {}; var exp =IPA.service = {};
IPA.service.entity = function(spec) { var make_spec = function() {
return {
spec = spec || {}; name: 'service',
policies: [
spec.policies = spec.policies || [
IPA.search_facet_update_policy, IPA.search_facet_update_policy,
IPA.details_facet_update_policy, IPA.details_facet_update_policy,
{ {
@@ -51,17 +50,14 @@ IPA.service.entity = function(spec) {
dest_entity: 'cert', dest_entity: 'cert',
dest_facet: 'search' dest_facet: 'search'
} }
]; ],
facets: [
var that = IPA.entity(spec); {
$type: 'search',
that.init = function() {
that.entity_init();
that.builder.search_facet({
columns: [ 'krbprincipalname' ] columns: [ 'krbprincipalname' ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.service.details_facet, $factory: IPA.service.details_facet,
sections: [ sections: [
{ {
@@ -168,62 +164,61 @@ IPA.service.entity = function(spec) {
policies: [ policies: [
IPA.service.certificate_policy IPA.service.certificate_policy
] ]
}). },
association_facet({ {
$type: 'association',
name: 'managedby_host', name: 'managedby_host',
add_method: 'add_host', add_method: 'add_host',
remove_method: 'remove_host' remove_method: 'remove_host'
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
$factory: IPA.service_adder_dialog, adder_dialog: {
height: 350, $factory: IPA.service_adder_dialog,
sections: [ height: 350,
{ sections: [
fields: [ {
{ fields: [
$type: 'combobox', {
name: 'service', $type: 'combobox',
label: '@i18n:objects.service.service', name: 'service',
options: [ label: '@i18n:objects.service.service',
'cifs', options: [
'DNS', 'cifs',
'ftp', 'DNS',
'HTTP', 'ftp',
'imap', 'HTTP',
'ldap', 'imap',
'libvirt', 'ldap',
'nfs', 'libvirt',
'smtp', 'nfs',
'qpidd' 'smtp',
], 'qpidd'
editable: true, ],
size: 10, editable: true,
required: true, size: 10,
z_index: 2 required: true,
}, z_index: 2
{ },
$type: 'entity_select', {
name: 'host', $type: 'entity_select',
other_entity: 'host', name: 'host',
other_field: 'fqdn', other_entity: 'host',
label: '@i18n:objects.service.host', other_field: 'fqdn',
required: true, label: '@i18n:objects.service.host',
z_index: 1 required: true,
}, z_index: 1
{ },
$type: 'checkbox', {
name: 'force', $type: 'checkbox',
metadata: '@mc-opt:service_add:force' name: 'force',
} metadata: '@mc-opt:service_add:force'
] }
} ]
] }
}); ]
}; }
};};
return that;
};
IPA.service.details_facet = function(spec, no_init) { IPA.service.details_facet = function(spec, no_init) {
@@ -509,13 +504,15 @@ IPA.service.certificate_policy = function(spec) {
return that; return that;
}; };
IPA.register('service', IPA.service.entity); exp.entity_spec = make_spec();
phases.on('registration', function() { phases.on('registration', function() {
var e = reg.entity;
var w = reg.widget; var w = reg.widget;
var f = reg.field; var f = reg.field;
var a = reg.action; var a = reg.action;
e.register({type: 'service', spec: exp.entity_spec});
f.register('service_name', IPA.service_name_field); f.register('service_name', IPA.service_name_field);
w.register('service_name', IPA.text_widget); w.register('service_name', IPA.text_widget);
f.register('service_host', IPA.service_host_field); f.register('service_host', IPA.service_host_field);
@@ -526,5 +523,5 @@ phases.on('registration', function() {
}); });
return {}; return exp;
}); });

View File

@@ -18,22 +18,29 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './text', './details', './search', './association', define([
'./entity'], function(IPA, $, text) { './ipa',
'./jquery',
'./phases',
'./reg',
'./text',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg, text) {
IPA.sudo = { var exp = IPA.sudo = {
//priority of commands in details facet //priority of commands in details facet
remove_method_priority: IPA.config.default_priority - 1 remove_method_priority: IPA.config.default_priority - 1
}; };
IPA.sudo.rule_entity = function(spec) { var make_rule_spec = function() {
return {
var that = IPA.entity(spec); name: 'sudorule',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
row_enabled_attribute: 'ipaenabledflag', row_enabled_attribute: 'ipaenabledflag',
columns: [ columns: [
'cn', 'cn',
@@ -60,10 +67,10 @@ IPA.sudo.rule_entity = function(spec) {
icon: 'enabled-icon' icon: 'enabled-icon'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.sudorule_details_facet, $factory: IPA.sudorule_details_facet,
entity: that,
command_mode: 'info', command_mode: 'info',
actions: [ actions: [
'select', 'select',
@@ -84,29 +91,27 @@ IPA.sudo.rule_entity = function(spec) {
IPA.disabled_summary_cond IPA.disabled_summary_cond
] ]
} }
}). }
adder_dialog({ ],
fields: [ 'cn' ] adder_dialog: {
}); fields: [ 'cn' ]
}; }
};};
return that;
};
IPA.sudo.command_entity = function(spec) { var make_cmd_spec = function() {
return {
var that = IPA.entity(spec); name: 'sudocmd',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
columns: [ columns: [
'sudocmd', 'sudocmd',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'general', name: 'general',
@@ -120,8 +125,9 @@ IPA.sudo.command_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'memberof_sudocmdgroup', name: 'memberof_sudocmdgroup',
associator: IPA.serial_associator, associator: IPA.serial_associator,
columns:[ columns:[
@@ -139,36 +145,34 @@ IPA.sudo.command_entity = function(spec) {
width: '100px' width: '100px'
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'sudocmd', fields: [
{ 'sudocmd',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that;
};
IPA.sudo.command_group_entity = function(spec) { var make_cmd_group_spec = function() {
return {
var that = IPA.entity(spec); name: 'sudocmdgroup',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
that.builder.search_facet({
columns: [ columns: [
'cn', 'cn',
'description' 'description'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'general', name: 'general',
@@ -182,8 +186,9 @@ IPA.sudo.command_group_entity = function(spec) {
] ]
} }
] ]
}). },
association_facet({ {
$type: 'association',
name: 'member_sudocmd', name: 'member_sudocmd',
columns: [ columns: [
'sudocmd', 'sudocmd',
@@ -200,21 +205,19 @@ IPA.sudo.command_group_entity = function(spec) {
width: '100px' width: '100px'
} }
] ]
}). }
standard_association_facets(). ],
adder_dialog({ standard_association_facets: true,
fields: [ adder_dialog: {
'cn', fields: [
{ 'cn',
$type: 'textarea', {
name: 'description' $type: 'textarea',
} name: 'description'
] }
}); ]
}; }
};};
return that;
};
IPA.sudorule_details_facet = function(spec) { IPA.sudorule_details_facet = function(spec) {
@@ -924,9 +927,17 @@ IPA.sudo.options_section = function(spec) {
return that; return that;
}; };
IPA.register('sudorule', IPA.sudo.rule_entity); exp.rule_spec = make_rule_spec();
IPA.register('sudocmd', IPA.sudo.command_entity); exp.cmd_spec = make_cmd_spec();
IPA.register('sudocmdgroup', IPA.sudo.command_group_entity); exp.cmdgroup_spec = make_cmd_group_spec();
exp.register = function() {
var e = reg.entity;
return {}; 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 exp;
});

View File

@@ -19,38 +19,34 @@
*/ */
define([ define([
'./ipa', './ipa',
'./jquery', './jquery',
'./phases', './menu',
'./reg', './phases',
'./details', './reg',
'./search', './details',
'./association', './search',
'./entity'], './association',
function(IPA, $, phases, reg) { './entity'],
function(IPA, $, menu, phases, reg) {
IPA.trust = {}; var exp = IPA.trust = {};
IPA.trust.entity = function(spec) { var make_trust_spec = function() {
return {
var that = IPA.entity(spec); name: 'trust',
enable_test: function() {
that.init = function() { return IPA.trust_enabled;
},
if (!IPA.trust_enabled) { facets: [
throw { {
expected: true $type: 'search',
};
}
that.entity_init();
that.builder.search_facet({
columns: [ columns: [
'cn' 'cn'
] ]
}). },
details_facet({ {
$type: 'details',
sections: [ sections: [
{ {
name: 'details', name: 'details',
@@ -97,101 +93,99 @@ IPA.trust.entity = function(spec) {
] ]
} }
] ]
}). }
adder_dialog({ ],
$factory: IPA.trust.adder_dialog, adder_dialog: {
fields: [ $factory: IPA.trust.adder_dialog,
{ fields: [
name: 'cn', {
label: '@i18n:objects.trust.domain', name: 'cn',
widget: 'realm.realm_server' label: '@i18n:objects.trust.domain',
}, widget: 'realm.realm_server'
{ },
name: 'realm_admin', {
label: '@i18n:objects.trust.account', name: 'realm_admin',
widget: 'method.realm_admin' label: '@i18n:objects.trust.account',
}, widget: 'method.realm_admin'
{ },
$type: 'password', {
name: 'realm_passwd', $type: 'password',
label: '@i18n:password.password', name: 'realm_passwd',
widget: 'method.realm_passwd' label: '@i18n:password.password',
}, widget: 'method.realm_passwd'
{ },
$type: 'password', {
name: 'trust_secret', $type: 'password',
label: '@i18n:password.password', name: 'trust_secret',
widget: 'method.trust_secret' label: '@i18n:password.password',
}, widget: 'method.trust_secret'
{ },
$type: 'password', {
name: 'trust_secret_verify', $type: 'password',
label: '@i18n:password.verify_password', name: 'trust_secret_verify',
widget: 'method.trust_secret_verify', label: '@i18n:password.verify_password',
flags: ['no_command'], widget: 'method.trust_secret_verify',
validators: [{ flags: ['no_command'],
$type: 'same_password', validators: [{
other_field: 'trust_secret' $type: 'same_password',
}] other_field: 'trust_secret'
} }]
], }
widgets: [ ],
{ widgets: [
$type: 'details_table_section_nc', {
name: 'realm', $type: 'details_table_section_nc',
widgets: [ name: 'realm',
'realm_server' widgets: [
] 'realm_server'
}, ]
{ },
$type: 'multiple_choice_section', {
name: 'method', $type: 'multiple_choice_section',
label: '@i18n:objects.trust.establish_using', name: 'method',
choices: [ label: '@i18n:objects.trust.establish_using',
{ choices: [
name: 'admin-account', {
label: '@i18n:objects.trust.admin_account', name: 'admin-account',
fields: ['realm_admin', 'realm_passwd'], label: '@i18n:objects.trust.admin_account',
required: ['realm_admin', 'realm_passwd'], fields: ['realm_admin', 'realm_passwd'],
enabled: true required: ['realm_admin', 'realm_passwd'],
}, enabled: true
{ },
name: 'preshared_password', {
label: '@i18n:objects.trust.preshared_password', name: 'preshared_password',
fields: ['trust_secret', 'trust_secret_verify'], label: '@i18n:objects.trust.preshared_password',
required: ['trust_secret', 'trust_secret_verify'] fields: ['trust_secret', 'trust_secret_verify'],
} required: ['trust_secret', 'trust_secret_verify']
], }
widgets: [ ],
{ widgets: [
name: 'realm_admin' {
}, name: 'realm_admin'
{ },
$type: 'password', {
name: 'realm_passwd' $type: 'password',
}, name: 'realm_passwd'
{ },
$type: 'password', {
name: 'trust_secret' $type: 'password',
}, name: 'trust_secret'
{ },
$type: 'password', {
name: 'trust_secret_verify' $type: 'password',
} name: 'trust_secret_verify'
] }
} ]
], }
policies: [ ],
{ policies: [
$factory: IPA.multiple_choice_section_policy, {
widget: 'method' $factory: IPA.multiple_choice_section_policy,
} widget: 'method'
] }
}); ]
}; }
};};
return that;
};
IPA.trust.adder_dialog = function(spec) { IPA.trust.adder_dialog = function(spec) {
@@ -210,21 +204,15 @@ IPA.trust.adder_dialog = function(spec) {
return that; return that;
}; };
IPA.trust.config_entity = function(spec) { var make_trustconfig_spec = function() {
return {
var that = IPA.entity(spec); name: 'trust',
enable_test: function() {
that.init = function() { return IPA.trust_enabled;
},
if (!IPA.trust_enabled) { facets: [
throw { {
expected: true $type: 'details',
};
}
that.entity_init();
that.builder.details_facet({
$factory: IPA.trust.config_details_facet, $factory: IPA.trust.config_details_facet,
trust_type: 'ad', trust_type: 'ad',
sections: [ sections: [
@@ -249,11 +237,9 @@ IPA.trust.config_entity = function(spec) {
] ]
} }
] ]
}); }
}; ]
};};
return that;
};
IPA.trust.config_details_facet = function(spec) { IPA.trust.config_details_facet = function(spec) {
@@ -298,19 +284,29 @@ IPA.trust.fallbackgroup_select_widget = function(spec) {
return that; return that;
}; };
IPA.register('trust', IPA.trust.entity); exp.remove_menu_item = function() {
IPA.register('trustconfig', IPA.trust.config_entity); if (!IPA.trust_enabled) {
menu.remove_item('ipaserver/trusts');
}
};
exp.trust_spec = make_trust_spec();
exp.trustconfig_spec = make_trustconfig_spec();
IPA.trust.register = function() { IPA.trust.register = function() {
var e = reg.entity;
var w = reg.widget; var w = reg.widget;
var f = reg.field; 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); w.register('trust_fallbackgroup_select', IPA.trust.fallbackgroup_select_widget);
f.register('trust_fallbackgroup_select', IPA.field); f.register('trust_fallbackgroup_select', IPA.field);
}; };
phases.on('registration', IPA.trust.register); phases.on('registration', IPA.trust.register);
phases.on('profile', exp.remove_menu_item, 20);
return {}; return exp;
}); });

View File

@@ -36,17 +36,12 @@ define([
var exp = IPA.user = {}; var exp = IPA.user = {};
IPA.user.entity = function(spec) { var make_spec = function() {
return {
var that = IPA.entity(spec); name: 'user',
facets: [
that.init = function() { {
that.entity_init(); $type: 'search',
var self_service = IPA.is_selfservice;
var link = self_service ? false : undefined;
that.builder.search_facet({
row_disabled_attribute: 'nsaccountlock', row_disabled_attribute: 'nsaccountlock',
columns: [ columns: [
'uid', 'uid',
@@ -87,8 +82,9 @@ IPA.user.entity = function(spec) {
icon: 'enabled-icon' icon: 'enabled-icon'
} }
] ]
}). },
details_facet({ {
$type: 'details',
$factory: IPA.user.details_facet, $factory: IPA.user.details_facet,
sections: [ sections: [
{ {
@@ -255,77 +251,75 @@ IPA.user.entity = function(spec) {
IPA.disabled_summary_cond IPA.disabled_summary_cond
] ]
} }
}). },
association_facet({ {
$type: 'association',
$post_ops: [ IPA.user.association_facet_ss_post_op ],
name: 'memberof_group', name: 'memberof_group',
associator: IPA.serial_associator, associator: IPA.serial_associator
link: link, },
read_only: self_service {
}). $type: 'association',
association_facet({ $post_ops: [ IPA.user.association_facet_ss_post_op ],
name: 'memberof_netgroup', name: 'memberof_netgroup',
associator: IPA.serial_associator, associator: IPA.serial_associator
link: link, },
read_only: self_service {
}). $type: 'association',
association_facet({ $post_ops: [ IPA.user.association_facet_ss_post_op ],
name: 'memberof_role', name: 'memberof_role',
associator: IPA.serial_associator, associator: IPA.serial_associator
link: link, },
read_only: self_service {
}). $type: 'association',
association_facet({ $post_ops: [ IPA.user.association_facet_ss_post_op ],
name: 'memberof_hbacrule', name: 'memberof_hbacrule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_user', add_method: 'add_user',
remove_method: 'remove_user', remove_method: 'remove_user'
link: link, },
read_only: self_service {
}). $type: 'association',
association_facet({ $post_ops: [ IPA.user.association_facet_ss_post_op ],
name: 'memberof_sudorule', name: 'memberof_sudorule',
associator: IPA.serial_associator, associator: IPA.serial_associator,
add_method: 'add_user', add_method: 'add_user',
remove_method: 'remove_user', remove_method: 'remove_user'
link: link, }
read_only: self_service ],
}). standard_association_facets: {
standard_association_facets({ $post_ops: [ IPA.user.association_facet_ss_post_op ]
link: link },
}). adder_dialog: {
adder_dialog({ $factory: IPA.user_adder_dialog,
$factory: IPA.user_adder_dialog, sections: [
sections: [ {
{ fields: [
fields: [ {
{ name: 'uid',
name: 'uid', required: false
required: false },
}, 'givenname',
'givenname', 'sn'
'sn' ]
] },
}, {
{ fields: [
fields: [ {
{ name: 'userpassword',
name: 'userpassword', label: '@i18n:password.new_password',
label: '@i18n:password.new_password', $type: 'password'
$type: 'password' },
}, {
{ name: 'userpassword2',
name: 'userpassword2', label: '@i18n:password.verify_password',
label: '@i18n:password.verify_password', $type: 'password'
$type: 'password' }
} ]
] }
} ]
] }
}); };};
};
return that;
};
IPA.user.details_facet = function(spec) { IPA.user.details_facet = function(spec) {
@@ -676,13 +670,13 @@ IPA.user.reset_password_acl_evaluator = function(spec) {
return that; return that;
}; };
IPA.register('user', IPA.user.entity); exp.entity_spec = make_spec();
exp.register = function() { exp.register = function() {
var e = reg.entity;
var a = reg.action; var a = reg.action;
e.register({type: 'user', spec: exp.entity_spec});
a.register('reset_password', IPA.user.reset_password_action); a.register('reset_password', IPA.user.reset_password_action);
}; };
phases.on('registration', exp.register); phases.on('registration', exp.register);
return exp; return exp;