webui: attr widget: get list of possible attrs from ipapermdefaultattr

Very useful for managed permissions since the list of attrs in metadata
might be smaller that default attributes. This smooths behavior if one
removes an attr from effective attrs which is not in metadata. Without
this it will disappear from the list and one has to add it manually
through 'Add'.

https://fedorahosted.org/freeipa/ticket/4253

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-07-09 16:49:46 +02:00
parent 4aefc0d6fe
commit d2f2fc5add

View File

@ -898,6 +898,16 @@ aci.permission_target_policy = function (spec) {
var attribute_table = that.permission_target.widgets.get_widget('attrs');
var skip_unmatched_org = attribute_table.skip_unmatched;
attribute_table.object_type = type;
// UI doesn't always know what are the possible attributes.
// In case of managed permissions, one of the possible lists is in ipapermdefaultattr.
var default_attrs = that.container.fields.get_field('ipapermdefaultattr');
if (default_attrs && default_attrs.enabled) { // if managed permission
attribute_table.custom_options = default_attrs.get_value();
} else {
attribute_table.custom_options = [];
}
// skip values which don't belong to new type. Bug #2617
attribute_table.skip_unmatched = skip_unmatched || skip_unmatched_org;
attribute_field.reset();