mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Added support for memberof attribute in permission
The attribute was added to adder dialog and details facet. It uses entity select (group) widget. https://fedorahosted.org/freeipa/ticket/2101
This commit is contained in:
committed by
Endi S. Dewata
parent
9dff149830
commit
05345ce8c8
@@ -59,6 +59,11 @@ IPA.aci.permission_entity = function(spec) {
|
||||
widget: 'target.filter',
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
type: 'entity_select',
|
||||
name: 'memberof',
|
||||
widget: 'target.memberof'
|
||||
},
|
||||
{
|
||||
name: 'subtree',
|
||||
widget: 'target.subtree',
|
||||
@@ -87,7 +92,9 @@ IPA.aci.permission_entity = function(spec) {
|
||||
type: 'details_table_section',
|
||||
name: 'identity',
|
||||
label: IPA.messages.objects.permission.identity,
|
||||
widgets: ['cn']
|
||||
widgets: [
|
||||
'cn'
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'details_table_section',
|
||||
@@ -103,7 +110,7 @@ IPA.aci.permission_entity = function(spec) {
|
||||
{
|
||||
type: 'permission_target',
|
||||
container_factory: IPA.details_table_section,
|
||||
label: IPA.messages.objects.permission.rights,
|
||||
label: IPA.messages.objects.permission.target,
|
||||
name: 'target',
|
||||
show_target: false
|
||||
}
|
||||
@@ -139,6 +146,11 @@ IPA.aci.permission_entity = function(spec) {
|
||||
widget: 'target.filter',
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
type: 'entity_select',
|
||||
name: 'memberof',
|
||||
widget: 'target.memberof'
|
||||
},
|
||||
{
|
||||
name: 'subtree',
|
||||
widget: 'target.subtree',
|
||||
@@ -621,6 +633,16 @@ IPA.permission_target_widget = function(spec) {
|
||||
that.widgets.add_widget(that.target_select);
|
||||
|
||||
|
||||
that.memberof_select = IPA.entity_select_widget({
|
||||
entity: that.entity,
|
||||
name: 'memberof',
|
||||
other_entity: that.group_entity,
|
||||
other_field: 'cn',
|
||||
hidden: true
|
||||
});
|
||||
|
||||
that.widgets.add_widget(that.memberof_select);
|
||||
|
||||
that.filter_text = IPA.text_widget({
|
||||
entity: that.entity,
|
||||
name: 'filter',
|
||||
@@ -717,6 +739,8 @@ IPA.permission_target_policy = function (widget_name) {
|
||||
|
||||
var targets = that.permission_target.targets;
|
||||
|
||||
that.set_target_visible_core('memberof', false);
|
||||
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var target = targets[i];
|
||||
|
||||
@@ -736,26 +760,27 @@ IPA.permission_target_policy = function (widget_name) {
|
||||
|
||||
that.set_target_visible = function(target, visible) {
|
||||
|
||||
var widgets = that.permission_target.widgets;
|
||||
var fields = that.container.fields;
|
||||
|
||||
var widget = widgets.get_widget(target);
|
||||
widget.hidden = !visible;
|
||||
that.permission_target.set_row_visible(target, visible);
|
||||
|
||||
var field = fields.get_field(target);
|
||||
field.enabled = visible;
|
||||
that.set_target_visible_core(target, visible);
|
||||
|
||||
if (target === 'type') {
|
||||
widget = widgets.get_widget('attrs');
|
||||
widget.hidden = !visible;
|
||||
that.permission_target.set_row_visible('attrs', visible);
|
||||
|
||||
field = fields.get_field('attrs');
|
||||
field.enabled = visible;
|
||||
that.set_target_visible_core('attrs', visible);
|
||||
} else {
|
||||
var field = that.container.fields.get_field(target);
|
||||
field.set_required(visible);
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
var member_of_visible = target === 'type' || target === 'subtree';
|
||||
that.set_target_visible_core('memberof', member_of_visible);
|
||||
}
|
||||
};
|
||||
|
||||
that.set_target_visible_core = function(target, visible) {
|
||||
var widget = that.permission_target.widgets.get_widget(target);
|
||||
var field = that.container.fields.get_field(target);
|
||||
that.permission_target.set_row_visible(target, visible);
|
||||
field.enabled = visible;
|
||||
widget.hidden = !visible;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,11 @@ module('aci', {
|
||||
widget: 'target.filter',
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
type: 'entity_select',
|
||||
name: 'memberof',
|
||||
widget: 'target.memberof'
|
||||
},
|
||||
{
|
||||
name: 'subtree',
|
||||
widget: 'target.subtree',
|
||||
@@ -224,7 +229,7 @@ test("Testing type target.", function() {
|
||||
same(record.type[0], data.result.result.type,
|
||||
"saved type matches sample data");
|
||||
|
||||
same(get_visible_rows(target_widget), ['type', 'attrs'],
|
||||
same(get_visible_rows(target_widget), ['memberof', 'type', 'attrs'],
|
||||
'type and attrs rows visible');
|
||||
|
||||
ok((record.attrs.length > 10),
|
||||
@@ -268,7 +273,7 @@ test("Testing subtree target.", function() {
|
||||
|
||||
same(record.subtree[0], data.result.result.subtree, 'subtree set correctly');
|
||||
|
||||
same(get_visible_rows(target_widget), ['subtree'], 'subtree row visible');
|
||||
same(get_visible_rows(target_widget), ['memberof', 'subtree'], 'subtree row visible');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user