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'],
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,12 +137,14 @@ IPA.aci.permission_entity = function(spec) {
widget_name: 'target'
}
]
}).
association_facet({
},
{
$type: 'association',
name: 'member_privilege',
facet_group: 'privilege'
}).
adder_dialog({
}
],
adder_dialog: {
height: 450,
fields: [
{
@@ -225,11 +227,8 @@ IPA.aci.permission_entity = function(spec) {
widget_name: 'target'
}
]
});
};
return that;
};
}
};};
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,22 +268,25 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -293,27 +294,23 @@ IPA.aci.privilege_entity = function(spec) {
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({
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,15 +324,17 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -343,24 +342,20 @@ IPA.aci.role_entity = function(spec) {
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({
var make_selfservice_spec = function() {
return {
name: 'selfservice',
facets: [
{
$type: 'search',
columns: [ 'aciname' ],
pagination: false
}).
details_facet({
},
{
$type: 'details',
check_rights: false,
sections: [
{
@@ -376,8 +371,9 @@ IPA.aci.selfservice_entity = function(spec) {
]
}
]
}).
adder_dialog({
}
],
adder_dialog: {
fields: [
'aciname',
{
@@ -386,26 +382,21 @@ IPA.aci.selfservice_entity = function(spec) {
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');
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,9 +430,10 @@ IPA.aci.delegation_entity = function(spec) {
]
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: false,
adder_dialog: {
fields: [
'aciname',
{
@@ -452,13 +444,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'
},
{
@@ -467,11 +459,8 @@ IPA.aci.delegation_entity = function(spec) {
object_type: 'user'
}
]
});
};
return that;
};
}
};};
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;
});

View File

@@ -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,26 +76,29 @@ 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({
}
],
adder_dialog: {
$factory: IPA.automember.rule_adder_dialog,
title: '@i18n:objects.automember.add_rule',
fields: [
@@ -117,16 +110,22 @@ IPA.automember.entity = function(spec) {
}
],
height: '300'
}).
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) {
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);
});
};
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/>.
*/
define(['./ipa', './jquery', './navigation', './details', './search', './association',
'./entity'], function(IPA, $, navigation) {
define([
'./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 that = IPA.entity(spec);
that.init = function() {
that.entity_init();
that.builder.facet_groups([ 'automountmap', 'settings' ]).
search_facet({
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({
}
],
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({
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,8 +106,9 @@ IPA.automount.map_entity = function(spec) {
]
}
]
}).
adder_dialog({
}
],
adder_dialog: {
$factory: IPA.automountmap_adder_dialog,
sections: [
{
@@ -144,32 +151,24 @@ IPA.automount.map_entity = function(spec) {
]
}
]
});
};
}
};};
return that;
};
IPA.automount.key_entity = function(spec) {
spec = spec || {};
spec.policies = spec.policies || [
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,8 +184,9 @@ IPA.automount.key_entity = function(spec) {
}
],
disable_breadcrumb: false
}).
adder_dialog({
}
],
adder_dialog: {
show_edit_page : function(entity, result){
var key = result.automountkey[0];
var info = result.automountinformation[0];
@@ -202,11 +202,8 @@ IPA.automount.key_entity = function(spec) {
return false;
},
fields:['automountkey','automountinformation']
});
};
return that;
};
}
};};
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();
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'],
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,36 +942,7 @@ IPA.cert.status_field = function(spec) {
};
IPA.cert.entity = function(spec) {
spec = spec || {};
spec.policies = spec.policies || [
IPA.search_facet_update_policy,
IPA.details_facet_update_policy,
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_facet: 'search'
},
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_entity: 'host',
dest_facet: 'details'
},
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_entity: 'service',
dest_facet: 'details'
}
];
var that = IPA.entity(spec);
that.get_default_metadata = function() {
exp.create_cert_metadata = function() {
var add_param = function(name, label, doc, primary_key) {
entity.takes_params.push({
@@ -1052,17 +1023,37 @@ IPA.cert.entity = function(spec) {
return entity;
};
that.init = function() {
var make_spec = function() {
return {
name: 'cert',
if (!IPA.cert.is_enabled()) {
throw {
expected: true
};
policies: [
IPA.search_facet_update_policy,
IPA.details_facet_update_policy,
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_facet: 'search'
},
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_entity: 'host',
dest_facet: 'details'
},
{
$factory: IPA.cert.cert_update_policy,
source_facet: 'details',
dest_entity: 'service',
dest_facet: 'details'
}
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);
});
};
return {};
phases.on('registration', exp.register);
phases.on('post-metadata', exp.create_cert_metadata);
return exp;
});

View File

@@ -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,9 +270,10 @@ IPA.dns.zone_entity = function(spec) {
label: '@i18n:objects.dnsrecord.data'
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: true,
adder_dialog: {
$factory: IPA.dnszone_adder_dialog,
height: 300,
sections: [
@@ -327,11 +314,9 @@ IPA.dns.zone_entity = function(spec) {
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,8 +1159,9 @@ IPA.dns.record_entity = function(spec) {
]
}
]
}).
adder_dialog({
}
],
adder_dialog: {
$factory: IPA.dns.record_adder_dialog,
fields: [
{
@@ -1217,11 +1195,8 @@ IPA.dns.record_entity = function(spec) {
type_field: 'record_type'
}
]
});
};
return that;
};
}
};};
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);
});
};
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/>.
*/
define(['./ipa', './jquery', './text', './details', './search', './add',
'./facet', './entity', './field', './widget'], function(IPA, $, text) {
define([
'./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.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;
});

View File

@@ -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,34 +122,39 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
$factory: IPA.group_adder_dialog,
fields: [
'cn',
@@ -178,11 +185,8 @@ IPA.group.entity = function(spec) {
},
'gidnumber'
]
});
};
return that;
};
}
};};
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);
};

View File

@@ -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, $) {
define([
'./ipa',
'./jquery',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
IPA.hbac = {
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({
}
],
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({
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,9 +145,10 @@ IPA.hbac.service_entity = function(spec) {
width: '100px'
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -151,26 +156,22 @@ IPA.hbac.service_entity = function(spec) {
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({
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,9 +204,10 @@ IPA.hbac.service_group_entity = function(spec) {
width: '100px'
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -212,11 +215,8 @@ IPA.hbac.service_group_entity = function(spec) {
name: 'description'
}
]
});
};
return that;
};
}
};};
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;
});

View File

@@ -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) {
define([
'./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);
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({
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);
return {};
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 exp;
});

View File

@@ -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,38 +177,45 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
$factory: IPA.host_adder_dialog,
height: 300,
sections: [
@@ -243,14 +246,11 @@ IPA.host.entity = function(spec) {
]
}
]
}).
deleter_dialog({
},
deleter_dialog: {
$factory: IPA.host_deleter_dialog
});
};
return that;
};
}
};};
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;
});

View File

@@ -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,29 +58,34 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -80,13 +93,16 @@ IPA.hostgroup.entity = function(spec) {
name: 'description'
}
]
});
}
};};
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 that;
};
IPA.register('hostgroup', IPA.hostgroup.entity);
return {};
return exp;
});

View File

@@ -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,8 +80,9 @@ IPA.idrange.entity = function(spec) {
]
}
]
}).
adder_dialog({
}
],
adder_dialog: {
fields: [
{
name: 'cn',
@@ -153,13 +161,15 @@ IPA.idrange.entity = function(spec) {
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 {};
});

View File

@@ -18,39 +18,47 @@
* 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({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -58,11 +66,8 @@ IPA.netgroup.entity = function(spec) {
name: 'description'
}
]
});
};
return that;
};
}
};};
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 {};
});

View File

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

View File

@@ -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,9 +71,11 @@ IPA.pwpolicy.entity = function(spec) {
},
'cospriority'
]
}]}).
standard_association_facets().
adder_dialog({
}]
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
{
$type: 'entity_select',
@@ -77,22 +87,17 @@ IPA.pwpolicy.entity = function(spec) {
'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
});
}
]
};};
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);
return that;
};
IPA.register('pwpolicy', IPA.pwpolicy.entity);
IPA.register('krbtpolicy', IPA.krbtpolicy.entity);
return {};
return exp;
});

View File

@@ -18,20 +18,24 @@
* 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) {
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: '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;
});

View File

@@ -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({
}
],
adder_dialog: {
fields: [
'cn',
'ipaselinuxuser'
]
});
};
return that;
};
}
};};
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;
});

View File

@@ -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 {};
});

View File

@@ -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,14 +164,16 @@ 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({
}
],
standard_association_facets: true,
adder_dialog: {
$factory: IPA.service_adder_dialog,
height: 350,
sections: [
@@ -219,11 +217,8 @@ IPA.service.entity = function(spec) {
]
}
]
});
};
return that;
};
}
};};
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;
});

View File

@@ -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) {
define([
'./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
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({
}
],
adder_dialog: {
fields: [ 'cn' ]
});
};
}
};};
return that;
};
IPA.sudo.command_entity = function(spec) {
var that = IPA.entity(spec);
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,9 +145,10 @@ IPA.sudo.command_entity = function(spec) {
width: '100px'
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'sudocmd',
{
@@ -149,26 +156,23 @@ IPA.sudo.command_entity = function(spec) {
name: 'description'
}
]
});
};
}
};};
return that;
};
IPA.sudo.command_group_entity = function(spec) {
var that = IPA.entity(spec);
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,9 +205,10 @@ IPA.sudo.command_group_entity = function(spec) {
width: '100px'
}
]
}).
standard_association_facets().
adder_dialog({
}
],
standard_association_facets: true,
adder_dialog: {
fields: [
'cn',
{
@@ -210,11 +216,8 @@ IPA.sudo.command_group_entity = function(spec) {
name: 'description'
}
]
});
};
return that;
};
}
};};
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;
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

@@ -21,36 +21,32 @@
define([
'./ipa',
'./jquery',
'./menu',
'./phases',
'./reg',
'./details',
'./search',
'./association',
'./entity'],
function(IPA, $, phases, reg) {
function(IPA, $, menu, phases, reg) {
IPA.trust = {};
var exp = 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({
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,8 +93,9 @@ IPA.trust.entity = function(spec) {
]
}
]
}).
adder_dialog({
}
],
adder_dialog: {
$factory: IPA.trust.adder_dialog,
fields: [
{
@@ -187,11 +184,8 @@ IPA.trust.entity = function(spec) {
widget: 'method'
}
]
});
};
return that;
};
}
};};
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');
}
};
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;
});

View File

@@ -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,45 +251,46 @@ 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({
remove_method: 'remove_user'
}
],
standard_association_facets: {
$post_ops: [ IPA.user.association_facet_ss_post_op ]
},
adder_dialog: {
$factory: IPA.user_adder_dialog,
sections: [
{
@@ -321,11 +318,8 @@ IPA.user.entity = function(spec) {
]
}
]
});
};
return that;
};
}
};};
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;