mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-26 17:01:14 -06:00
Make facet and entity policies declarative
https://fedorahosted.org/freeipa/ticket/3235
This commit is contained in:
parent
33b584f0a0
commit
bee39848d3
@ -132,7 +132,10 @@ IPA.aci.permission_entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.permission_target_policy('target')
|
||||
{
|
||||
$factory: IPA.permission_target_policy,
|
||||
widget_name: 'target'
|
||||
}
|
||||
]
|
||||
}).
|
||||
association_facet({
|
||||
@ -217,7 +220,10 @@ IPA.aci.permission_entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.permission_target_policy('target')
|
||||
{
|
||||
$factory: IPA.permission_target_policy,
|
||||
widget_name: 'target'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
@ -740,13 +746,14 @@ IPA.permission_target_widget = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.permission_target_policy = function (widget_name) {
|
||||
IPA.permission_target_policy = function (spec) {
|
||||
|
||||
var that = IPA.facet_policy();
|
||||
that.widget_name = spec.widget_name;
|
||||
|
||||
that.init = function() {
|
||||
|
||||
that.permission_target = that.container.widgets.get_widget(widget_name);
|
||||
that.permission_target = that.container.widgets.get_widget(that.widget_name);
|
||||
var widgets = that.permission_target.widgets;
|
||||
|
||||
var target_select = widgets.get_widget('target');
|
||||
|
@ -45,14 +45,16 @@ IPA.automember.entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.facet_update_policy({
|
||||
{
|
||||
$factory: IPA.facet_update_policy,
|
||||
source_facet: 'usergrouprule',
|
||||
dest_facet: 'searchgroup'
|
||||
}),
|
||||
IPA.facet_update_policy({
|
||||
},
|
||||
{
|
||||
$factory: IPA.facet_update_policy,
|
||||
source_facet: 'hostgrouprule',
|
||||
dest_facet: 'searchhostgroup'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
|
@ -157,11 +157,12 @@ IPA.automount.key_entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.facet_update_policy({
|
||||
{
|
||||
$factory: IPA.facet_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'automountmap',
|
||||
dest_facet: 'keys'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
|
@ -948,22 +948,25 @@ IPA.cert.entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.search_facet_update_policy(),
|
||||
IPA.details_facet_update_policy(),
|
||||
IPA.cert.cert_update_policy({
|
||||
IPA.search_facet_update_policy,
|
||||
IPA.details_facet_update_policy,
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_facet: 'search'
|
||||
}),
|
||||
IPA.cert.cert_update_policy({
|
||||
},
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'host',
|
||||
dest_facet: 'details'
|
||||
}),
|
||||
IPA.cert.cert_update_policy({
|
||||
},
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'service',
|
||||
dest_facet: 'details'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
@ -1174,11 +1177,15 @@ IPA.cert.entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.cert.load_policy({ has_reason: true}),
|
||||
IPA.hide_empty_row_policy({
|
||||
{
|
||||
$factory: IPA.cert.load_policy,
|
||||
has_reason: true
|
||||
},
|
||||
{
|
||||
$factory: IPA.hide_empty_row_policy,
|
||||
widget: 'revocation_reason',
|
||||
section: 'details'
|
||||
})
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
/* IPA Object Details - populating definiton lists from entry data */
|
||||
|
||||
define([
|
||||
'./builder',
|
||||
'./ipa',
|
||||
'./jquery',
|
||||
'./phases',
|
||||
@ -31,7 +32,7 @@ define([
|
||||
'./text',
|
||||
'./facet',
|
||||
'./add'],
|
||||
function(IPA, $, phases, reg, text) {
|
||||
function(builder, IPA, $, phases, reg, text) {
|
||||
|
||||
var exp = {};
|
||||
|
||||
@ -232,7 +233,9 @@ exp.facet_policies = IPA.facet_policies = function(spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.add_policies(spec.policies);
|
||||
var policies = builder.build('', spec.policies, {},
|
||||
{ $factory: exp.facet_policy }) || [];
|
||||
that.add_policies(policies);
|
||||
|
||||
return that;
|
||||
};
|
||||
|
@ -325,7 +325,7 @@ IPA.dns.zone_entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.add_dns_zone_name_policy()
|
||||
IPA.add_dns_zone_name_policy
|
||||
]
|
||||
});
|
||||
};
|
||||
@ -1134,12 +1134,13 @@ IPA.dns.record_entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.facet_update_policy({
|
||||
{
|
||||
$factory: IPA.facet_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'dnszone',
|
||||
dest_facet: 'records'
|
||||
}),
|
||||
IPA.adder_facet_update_policy()
|
||||
},
|
||||
IPA.adder_facet_update_policy
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
@ -1212,9 +1213,10 @@ IPA.dns.record_entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.dnsrecord_adder_dialog_type_policy({
|
||||
{
|
||||
$factory: IPA.dnsrecord_adder_dialog_type_policy,
|
||||
type_field: 'record_type'
|
||||
})
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
@ -21,16 +21,22 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define(['./ipa', './jquery', './text', './facets', './facet'],
|
||||
function(IPA, $, text, facet_reg) {
|
||||
define([
|
||||
'./builder',
|
||||
'./ipa',
|
||||
'./jquery',
|
||||
'./text',
|
||||
'./facets',
|
||||
'./facet'],
|
||||
function(builder, IPA, $, text, facet_reg) {
|
||||
|
||||
IPA.entity = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.search_facet_update_policy(),
|
||||
IPA.details_facet_update_policy()
|
||||
IPA.search_facet_update_policy,
|
||||
IPA.details_facet_update_policy
|
||||
];
|
||||
|
||||
var that = IPA.object();
|
||||
@ -487,7 +493,9 @@ IPA.entity_policies = function(spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.add_policies(spec.policies);
|
||||
var policies = builder.build('', spec.policies, {},
|
||||
{ $factory: IPA.entity_policy }) || [];
|
||||
that.add_policies(policies);
|
||||
|
||||
return that;
|
||||
};
|
||||
|
@ -38,18 +38,20 @@ IPA.host.entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.search_facet_update_policy(),
|
||||
IPA.details_facet_update_policy(),
|
||||
IPA.cert.cert_update_policy({
|
||||
IPA.search_facet_update_policy,
|
||||
IPA.details_facet_update_policy,
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'cert',
|
||||
dest_facet: 'details'
|
||||
}),
|
||||
IPA.cert.cert_update_policy({
|
||||
},
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'cert',
|
||||
dest_facet: 'search'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
@ -176,8 +178,8 @@ IPA.host.entity = function(spec) {
|
||||
]
|
||||
},
|
||||
policies: [
|
||||
IPA.host.enrollment_policy(),
|
||||
IPA.host.certificate_policy()
|
||||
IPA.host.enrollment_policy,
|
||||
IPA.host.certificate_policy
|
||||
]
|
||||
}).
|
||||
association_facet({
|
||||
|
@ -148,9 +148,10 @@ IPA.idrange.entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.multiple_choice_section_policy({
|
||||
{
|
||||
$factory: IPA.multiple_choice_section_policy,
|
||||
widget: 'type'
|
||||
})
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
@ -37,18 +37,20 @@ IPA.service.entity = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
spec.policies = spec.policies || [
|
||||
IPA.search_facet_update_policy(),
|
||||
IPA.details_facet_update_policy(),
|
||||
IPA.cert.cert_update_policy({
|
||||
IPA.search_facet_update_policy,
|
||||
IPA.details_facet_update_policy,
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'cert',
|
||||
dest_facet: 'details'
|
||||
}),
|
||||
IPA.cert.cert_update_policy({
|
||||
},
|
||||
{
|
||||
$factory: IPA.cert.cert_update_policy,
|
||||
source_facet: 'details',
|
||||
dest_entity: 'cert',
|
||||
dest_facet: 'search'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
var that = IPA.entity(spec);
|
||||
@ -164,7 +166,7 @@ IPA.service.entity = function(spec) {
|
||||
]
|
||||
},
|
||||
policies: [
|
||||
IPA.service.certificate_policy()
|
||||
IPA.service.certificate_policy
|
||||
]
|
||||
}).
|
||||
association_facet({
|
||||
|
@ -174,9 +174,10 @@ IPA.trust.entity = function(spec) {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.multiple_choice_section_policy({
|
||||
{
|
||||
$factory: IPA.multiple_choice_section_policy,
|
||||
widget: 'method'
|
||||
})
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
@ -115,7 +115,10 @@ module('aci', {
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
IPA.permission_target_policy('target')
|
||||
{
|
||||
$factory: IPA.permission_target_policy,
|
||||
widget_name: 'target'
|
||||
}
|
||||
]
|
||||
});
|
||||
entity.add_facet('details', target_facet);
|
||||
|
Loading…
Reference in New Issue
Block a user