2011-01-14 12:16:25 -05:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
|
|
2010-10-25 19:55:57 -04:00
|
|
|
/* Authors:
|
|
|
|
|
* Adam Young <ayoung@redhat.com>
|
2011-01-29 14:25:56 -06:00
|
|
|
* Endi S. Dewata <edewata@redhat.com>
|
2010-10-25 19:55:57 -04:00
|
|
|
*
|
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
|
* published by the Free Software Foundation; version 2 only
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
2011-11-02 12:21:39 -05:00
|
|
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci = {};
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci.permission_entity = function(spec) {
|
|
|
|
|
|
|
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2011-12-09 16:37:32 +01:00
|
|
|
that.builder.facet_groups(['settings', 'privilege']).
|
2011-03-18 16:43:54 -04:00
|
|
|
search_facet({
|
2011-11-11 22:33:05 -06:00
|
|
|
columns: [ 'cn' ]
|
|
|
|
|
}).
|
|
|
|
|
details_facet({
|
2011-11-09 18:48:04 -06:00
|
|
|
factory: IPA.aci.permission_details_facet,
|
2011-11-28 15:07:12 +01:00
|
|
|
fields: [
|
|
|
|
|
{
|
|
|
|
|
name:'cn',
|
|
|
|
|
widget: 'identity.cn'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rights',
|
|
|
|
|
name: 'permissions',
|
|
|
|
|
widget: 'rights.permissions'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'select',
|
|
|
|
|
name: 'target',
|
2012-02-22 12:53:00 +01:00
|
|
|
widget: 'target.target',
|
|
|
|
|
enabled: false
|
2011-11-28 15:07:12 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'filter',
|
|
|
|
|
widget: 'target.filter',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
2012-01-03 10:57:59 +01:00
|
|
|
{
|
|
|
|
|
type: 'entity_select',
|
|
|
|
|
name: 'memberof',
|
2012-02-22 12:53:00 +01:00
|
|
|
widget: 'target.memberof',
|
|
|
|
|
enabled: false
|
2012-01-03 10:57:59 +01:00
|
|
|
},
|
2011-11-11 22:33:05 -06:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
name: 'subtree',
|
|
|
|
|
widget: 'target.subtree',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'entity_select',
|
|
|
|
|
name: 'targetgroup',
|
|
|
|
|
widget: 'target.targetgroup',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'select',
|
|
|
|
|
name: 'type',
|
|
|
|
|
widget: 'target.type',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs',
|
|
|
|
|
widget: 'target.attrs',
|
|
|
|
|
enabled: false
|
2012-02-22 12:53:00 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs_multi',
|
|
|
|
|
param: 'attrs',
|
|
|
|
|
type: 'multivalued',
|
|
|
|
|
widget: 'target.attrs_multi',
|
|
|
|
|
enabled: false
|
2011-11-28 15:07:12 +01:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
widgets: [
|
|
|
|
|
{
|
|
|
|
|
type: 'details_table_section',
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'identity',
|
2011-11-28 15:07:12 +01:00
|
|
|
label: IPA.messages.objects.permission.identity,
|
2012-01-03 10:57:59 +01:00
|
|
|
widgets: [
|
|
|
|
|
'cn'
|
|
|
|
|
]
|
2011-11-11 22:33:05 -06:00
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'details_table_section',
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'rights',
|
|
|
|
|
label: IPA.messages.objects.permission.rights,
|
2011-11-28 15:07:12 +01:00
|
|
|
widgets: [
|
2011-11-11 22:33:05 -06:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'rights',
|
|
|
|
|
name: 'permissions'
|
2011-11-11 22:33:05 -06:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'permission_target',
|
|
|
|
|
container_factory: IPA.details_table_section,
|
2012-01-03 10:57:59 +01:00
|
|
|
label: IPA.messages.objects.permission.target,
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'target',
|
2011-11-28 15:07:12 +01:00
|
|
|
show_target: false
|
2011-11-11 22:33:05 -06:00
|
|
|
}
|
2011-11-28 15:07:12 +01:00
|
|
|
],
|
|
|
|
|
policies: [
|
|
|
|
|
IPA.permission_target_policy('target')
|
2011-11-11 22:33:05 -06:00
|
|
|
]
|
2011-04-18 10:59:50 -05:00
|
|
|
}).
|
2011-08-05 10:15:53 -05:00
|
|
|
association_facet({
|
|
|
|
|
name: 'member_privilege',
|
|
|
|
|
facet_group: 'privilege'
|
|
|
|
|
}).
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-09-27 09:28:14 -05:00
|
|
|
height: 450,
|
2011-11-28 15:07:12 +01:00
|
|
|
fields: [
|
|
|
|
|
{
|
|
|
|
|
name:'cn',
|
|
|
|
|
widget: 'general.cn'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'rights',
|
|
|
|
|
name: 'permissions',
|
|
|
|
|
widget: 'general.permissions'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'select',
|
|
|
|
|
name: 'target',
|
2012-02-22 12:53:00 +01:00
|
|
|
widget: 'target.target',
|
|
|
|
|
enabled: false
|
2011-11-28 15:07:12 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'filter',
|
|
|
|
|
widget: 'target.filter',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
2012-01-03 10:57:59 +01:00
|
|
|
{
|
|
|
|
|
type: 'entity_select',
|
|
|
|
|
name: 'memberof',
|
2012-02-22 12:53:00 +01:00
|
|
|
widget: 'target.memberof',
|
|
|
|
|
enabled: false
|
2012-01-03 10:57:59 +01:00
|
|
|
},
|
2011-11-28 15:07:12 +01:00
|
|
|
{
|
|
|
|
|
name: 'subtree',
|
|
|
|
|
widget: 'target.subtree',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'entity_select',
|
|
|
|
|
name: 'targetgroup',
|
|
|
|
|
widget: 'target.targetgroup',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'select',
|
|
|
|
|
name: 'type',
|
|
|
|
|
widget: 'target.type',
|
|
|
|
|
enabled: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs',
|
|
|
|
|
widget: 'target.attrs',
|
|
|
|
|
enabled: false
|
2012-02-22 12:53:00 +01:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs_multi',
|
|
|
|
|
type: 'multivalued',
|
|
|
|
|
param: 'attrs',
|
|
|
|
|
widget: 'target.attrs_multi',
|
|
|
|
|
enabled: false
|
2011-11-28 15:07:12 +01:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
widgets: [
|
2011-04-18 10:59:50 -05:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'details_table_section_nc',
|
2011-09-10 11:54:02 -05:00
|
|
|
name: 'general',
|
2011-11-28 15:07:12 +01:00
|
|
|
widgets: [
|
2011-09-22 11:44:41 -05:00
|
|
|
'cn',
|
2011-09-10 11:54:02 -05:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'rights',
|
|
|
|
|
name: 'permissions'
|
2011-09-10 11:54:02 -05:00
|
|
|
}
|
|
|
|
|
]
|
2011-04-18 10:59:50 -05:00
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'permission_target',
|
|
|
|
|
name:'target',
|
2011-11-11 22:33:05 -06:00
|
|
|
show_target: true
|
2011-08-10 20:03:02 -05:00
|
|
|
}
|
2011-11-28 15:07:12 +01:00
|
|
|
],
|
|
|
|
|
policies: [
|
|
|
|
|
IPA.permission_target_policy('target')
|
2011-08-10 20:03:02 -05:00
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
2011-03-18 16:43:54 -04:00
|
|
|
};
|
|
|
|
|
|
2011-11-09 18:48:04 -06:00
|
|
|
IPA.aci.permission_details_facet = function(spec) {
|
|
|
|
|
|
|
|
|
|
var that = IPA.details_facet(spec);
|
|
|
|
|
|
|
|
|
|
that.get_refresh_command_name = function() {
|
|
|
|
|
return that.entity.name+'_show_'+that.pkey;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci.privilege_entity = function(spec) {
|
|
|
|
|
|
|
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-12-09 16:37:32 +01:00
|
|
|
that.builder.facet_groups(['permission', 'settings', 'role']).
|
2011-03-18 16:43:54 -04:00
|
|
|
search_facet({
|
2011-09-16 18:21:41 -05:00
|
|
|
columns: [
|
|
|
|
|
'cn',
|
|
|
|
|
'description'
|
|
|
|
|
]
|
|
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
details_facet({
|
2011-09-16 18:21:41 -05:00
|
|
|
sections: [
|
|
|
|
|
{
|
|
|
|
|
name: 'identity',
|
|
|
|
|
label: IPA.messages.details.identity,
|
|
|
|
|
fields: [
|
|
|
|
|
'cn',
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}).
|
2011-03-18 16:43:54 -04:00
|
|
|
association_facet({
|
|
|
|
|
name: 'member_role',
|
2011-08-05 10:15:53 -05:00
|
|
|
facet_group: 'role',
|
2011-03-18 16:43:54 -04:00
|
|
|
add_method: 'add_privilege',
|
|
|
|
|
remove_method: 'remove_privilege',
|
|
|
|
|
associator: IPA.serial_associator
|
|
|
|
|
}).
|
|
|
|
|
association_facet({
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'memberof_permission',
|
|
|
|
|
facet_group: 'permission',
|
|
|
|
|
add_method: 'add_permission',
|
|
|
|
|
remove_method: 'remove_permission'
|
2011-03-18 16:43:54 -04:00
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
standard_association_facets().
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-09-16 18:21:41 -05:00
|
|
|
fields: [
|
|
|
|
|
'cn',
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
|
}
|
|
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
return that;
|
2011-03-18 16:43:54 -04:00
|
|
|
};
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci.role_entity = function(spec) {
|
|
|
|
|
|
|
|
|
|
var that = IPA.entity(spec);
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2011-12-09 16:37:32 +01:00
|
|
|
that.builder.facet_groups(['member', 'privilege', 'settings']).
|
2011-03-18 16:43:54 -04:00
|
|
|
search_facet({
|
2011-09-16 18:21:41 -05:00
|
|
|
columns: [
|
|
|
|
|
'cn',
|
|
|
|
|
'description'
|
|
|
|
|
]
|
|
|
|
|
}).
|
|
|
|
|
details_facet({
|
|
|
|
|
sections: [
|
|
|
|
|
{
|
|
|
|
|
name: 'identity',
|
|
|
|
|
label: IPA.messages.objects.role.identity,
|
|
|
|
|
fields: [
|
|
|
|
|
'cn',
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}).
|
2011-03-18 16:43:54 -04:00
|
|
|
association_facet({
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'memberof_privilege',
|
|
|
|
|
facet_group: 'privilege',
|
|
|
|
|
add_method: 'add_privilege',
|
|
|
|
|
remove_method: 'remove_privilege'
|
2011-03-18 16:43:54 -04:00
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
standard_association_facets().
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-09-16 18:21:41 -05:00
|
|
|
fields: [
|
|
|
|
|
'cn',
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'textarea',
|
2011-09-16 18:21:41 -05:00
|
|
|
name: 'description'
|
|
|
|
|
}
|
|
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
2011-03-18 16:43:54 -04:00
|
|
|
};
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci.selfservice_entity = function(spec) {
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.builder.search_facet({
|
2012-05-25 08:57:47 +02:00
|
|
|
columns: [ 'aciname' ],
|
|
|
|
|
pagination: false
|
2011-11-11 22:33:05 -06:00
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
details_facet({
|
2012-05-25 08:57:47 +02:00
|
|
|
check_rights: false,
|
2011-11-11 22:33:05 -06:00
|
|
|
sections: [
|
|
|
|
|
{
|
|
|
|
|
name: 'general',
|
|
|
|
|
label: IPA.messages.details.general,
|
|
|
|
|
fields: [
|
|
|
|
|
'aciname',
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'attributes',
|
2011-11-11 22:33:05 -06:00
|
|
|
object_type: 'user',
|
|
|
|
|
name: 'attrs'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}).
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-11-11 22:33:05 -06:00
|
|
|
fields: [
|
2011-04-18 10:59:50 -05:00
|
|
|
'aciname',
|
2011-11-11 22:33:05 -06:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'attributes',
|
2011-11-11 22:33:05 -06:00
|
|
|
object_type: 'user',
|
|
|
|
|
name: 'attrs'
|
|
|
|
|
}
|
|
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
2011-03-18 16:43:54 -04:00
|
|
|
};
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
IPA.aci.delegation_entity = function(spec) {
|
2011-03-18 16:43:54 -04:00
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
var that = IPA.entity(spec);
|
|
|
|
|
|
2011-11-07 14:21:45 -06:00
|
|
|
that.group_entity = IPA.get_entity(spec.group_entity || 'group');
|
|
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.init = function() {
|
|
|
|
|
that.entity_init();
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2011-11-16 21:07:20 -06:00
|
|
|
that.builder.search_facet({
|
2012-05-25 08:57:47 +02:00
|
|
|
columns: [ 'aciname' ],
|
|
|
|
|
pagination: false
|
2011-11-11 22:33:05 -06:00
|
|
|
}).
|
|
|
|
|
details_facet({
|
2012-05-25 08:57:47 +02:00
|
|
|
check_rights: false,
|
2011-11-11 22:33:05 -06:00
|
|
|
sections: [
|
|
|
|
|
{
|
|
|
|
|
name: 'general',
|
|
|
|
|
label: IPA.messages.details.general,
|
|
|
|
|
fields: [
|
|
|
|
|
'aciname',
|
2012-04-17 18:15:00 +02:00
|
|
|
{
|
|
|
|
|
type: 'checkboxes',
|
|
|
|
|
name: 'permissions',
|
|
|
|
|
required: true,
|
|
|
|
|
options: IPA.create_options(['read', 'write'])
|
|
|
|
|
},
|
2011-11-11 22:33:05 -06:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'entity_select',
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'group',
|
2011-11-07 14:21:45 -06:00
|
|
|
other_entity: that.group_entity,
|
2011-11-11 22:33:05 -06:00
|
|
|
other_field: 'cn'
|
|
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'entity_select',
|
2011-11-11 22:33:05 -06:00
|
|
|
name: 'memberof',
|
2011-11-07 14:21:45 -06:00
|
|
|
other_entity: that.group_entity,
|
2012-02-29 18:53:11 +01:00
|
|
|
other_field: 'cn'
|
2011-11-11 22:33:05 -06:00
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'attributes',
|
|
|
|
|
name: 'attrs',
|
2012-02-29 18:53:11 +01:00
|
|
|
object_type: 'user'
|
2011-11-11 22:33:05 -06:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}).
|
2011-03-31 15:32:29 -04:00
|
|
|
standard_association_facets().
|
2011-04-18 10:59:50 -05:00
|
|
|
adder_dialog({
|
2011-11-11 22:33:05 -06:00
|
|
|
fields: [
|
2011-04-18 10:59:50 -05:00
|
|
|
'aciname',
|
2012-04-17 18:15:00 +02:00
|
|
|
{
|
|
|
|
|
type: 'checkboxes',
|
|
|
|
|
name: 'permissions',
|
|
|
|
|
options: IPA.create_options(['read', 'write'])
|
|
|
|
|
},
|
2011-04-18 10:59:50 -05:00
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'entity_select',
|
2011-07-15 12:18:59 -05:00
|
|
|
name: 'group',
|
2011-11-07 14:21:45 -06:00
|
|
|
other_entity: that.group_entity,
|
2011-09-22 11:44:41 -05:00
|
|
|
other_field: 'cn'
|
2011-04-18 10:59:50 -05:00
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'entity_select',
|
2011-07-15 12:18:59 -05:00
|
|
|
name: 'memberof',
|
2011-11-07 14:21:45 -06:00
|
|
|
other_entity: that.group_entity,
|
2012-02-29 18:53:11 +01:00
|
|
|
other_field: 'cn'
|
2011-04-18 10:59:50 -05:00
|
|
|
},
|
|
|
|
|
{
|
2011-11-28 15:07:12 +01:00
|
|
|
type: 'attributes',
|
2011-09-22 11:44:41 -05:00
|
|
|
name: 'attrs',
|
2012-02-29 18:53:11 +01:00
|
|
|
object_type: 'user'
|
2011-11-11 22:33:05 -06:00
|
|
|
}
|
|
|
|
|
]
|
2011-11-02 14:07:07 -05:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return that;
|
2011-03-18 16:43:54 -04:00
|
|
|
};
|
|
|
|
|
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
IPA.attributes_widget = function(spec) {
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
spec = spec || {};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
var that = IPA.checkboxes_widget(spec);
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
that.object_type = spec.object_type;
|
2010-10-25 19:55:57 -04:00
|
|
|
|
|
|
|
|
var id = spec.name;
|
|
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
that.create = function(container) {
|
2011-02-07 23:02:43 -05:00
|
|
|
that.container = container;
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2012-07-13 17:49:13 +02:00
|
|
|
var attr_container = $('<div/>', {
|
|
|
|
|
'class': 'aci-attribute-table-container'
|
|
|
|
|
}).appendTo(container);
|
|
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
that.table = $('<table/>', {
|
2010-10-25 19:55:57 -04:00
|
|
|
id:id,
|
2011-09-23 17:49:46 +02:00
|
|
|
'class':'search-table aci-attribute-table scrollable'
|
2011-02-02 10:35:23 -06:00
|
|
|
}).
|
2010-10-25 19:55:57 -04:00
|
|
|
append('<thead/>').
|
2011-02-02 10:35:23 -06:00
|
|
|
append('<tbody/>').
|
2012-07-13 17:49:13 +02:00
|
|
|
appendTo(attr_container);
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
var tr = $('<tr></tr>').appendTo($('thead', that.table));
|
2011-02-16 12:46:59 -06:00
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
tr.append($('<th/>', {
|
2011-09-23 17:49:46 +02:00
|
|
|
html: $('<input/>', {
|
2011-01-24 22:21:31 -05:00
|
|
|
type: "checkbox",
|
2011-09-23 17:49:46 +02:00
|
|
|
click: function() {
|
2011-02-07 23:02:43 -05:00
|
|
|
$('.aci-attribute', that.table).
|
2012-07-26 11:17:28 +02:00
|
|
|
prop('checked', $(this).prop('checked'));
|
2011-11-28 15:07:12 +01:00
|
|
|
that.value_changed.notify([], that);
|
2011-02-02 10:35:23 -06:00
|
|
|
}
|
|
|
|
|
})
|
2011-02-16 12:46:59 -06:00
|
|
|
})).append($('<th/>', {
|
|
|
|
|
'class': 'aci-attribute-column',
|
|
|
|
|
html: IPA.messages.objects.aci.attribute
|
|
|
|
|
}));
|
2011-02-02 10:35:23 -06:00
|
|
|
|
|
|
|
|
if (that.undo) {
|
2011-02-03 21:42:50 -06:00
|
|
|
that.create_undo(container);
|
2011-02-02 10:35:23 -06:00
|
|
|
}
|
|
|
|
|
|
2011-09-23 17:49:46 +02:00
|
|
|
if (that.object_type) {
|
2011-09-10 11:54:02 -05:00
|
|
|
that.populate(that.object_type);
|
2011-01-29 22:08:27 -05:00
|
|
|
}
|
2011-09-14 13:01:25 +02:00
|
|
|
|
|
|
|
|
that.create_error_link(container);
|
2010-10-25 19:55:57 -04:00
|
|
|
};
|
|
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.update = function(values) {
|
2011-01-28 09:36:25 -06:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
that.values = [];
|
2011-01-28 09:36:25 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
values = values || [];
|
2011-01-29 14:25:56 -06:00
|
|
|
for (var i=0; i<values.length; i++) {
|
2012-02-15 17:47:53 +01:00
|
|
|
|
|
|
|
|
var value = values[i];
|
|
|
|
|
|
|
|
|
|
if (!value || value === '') continue;
|
|
|
|
|
|
|
|
|
|
value = value.toLowerCase();
|
2011-01-29 14:25:56 -06:00
|
|
|
that.values.push(value);
|
2010-10-25 19:55:57 -04:00
|
|
|
}
|
|
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
that.populate(that.object_type);
|
|
|
|
|
that.append();
|
2011-11-28 15:07:12 +01:00
|
|
|
that.checkboxes_update(values);
|
2011-01-29 14:25:56 -06:00
|
|
|
};
|
|
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
that.populate = function(object_type) {
|
2011-01-29 14:25:56 -06:00
|
|
|
|
|
|
|
|
$('tbody tr', that.table).remove();
|
|
|
|
|
|
|
|
|
|
if (!object_type || object_type === '') return;
|
|
|
|
|
|
2011-02-16 12:46:59 -06:00
|
|
|
var metadata = IPA.metadata.objects[object_type];
|
2011-01-29 14:25:56 -06:00
|
|
|
if (!metadata) return;
|
|
|
|
|
|
|
|
|
|
var aciattrs = metadata.aciattrs;
|
|
|
|
|
|
|
|
|
|
var tbody = $('tbody', that.table);
|
|
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
for (var i=0; i<aciattrs.length ; i++){
|
|
|
|
|
var value = aciattrs[i].toLowerCase();
|
|
|
|
|
var aci_tr = $('<tr/>').appendTo(tbody);
|
|
|
|
|
|
|
|
|
|
var td = $('<td/>').appendTo(aci_tr);
|
2011-01-29 14:25:56 -06:00
|
|
|
td.append($('<input/>',{
|
|
|
|
|
type: 'checkbox',
|
2011-02-02 10:35:23 -06:00
|
|
|
name: that.name,
|
2011-01-29 14:25:56 -06:00
|
|
|
value: value,
|
2011-02-02 10:35:23 -06:00
|
|
|
'class': 'aci-attribute',
|
2011-02-07 23:02:43 -05:00
|
|
|
click: function() {
|
2011-11-28 15:07:12 +01:00
|
|
|
that.value_changed.notify([], that);
|
2011-02-02 10:35:23 -06:00
|
|
|
}
|
2011-01-29 14:25:56 -06:00
|
|
|
}));
|
|
|
|
|
td = $('<td/>').appendTo(aci_tr);
|
|
|
|
|
td.append($('<label/>',{
|
|
|
|
|
text:value}));
|
|
|
|
|
}
|
2011-01-12 14:47:29 -05:00
|
|
|
};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
that.append = function() {
|
|
|
|
|
|
|
|
|
|
if (!that.values) return;
|
|
|
|
|
|
|
|
|
|
var unmatched = [];
|
|
|
|
|
|
|
|
|
|
for (var i=0; i<that.values.length; i++) {
|
2011-02-07 23:02:43 -05:00
|
|
|
var input = $('input[name="'+that.name+'"]'+
|
|
|
|
|
'[value="'+that.values[i]+'"]', that.container);
|
2011-02-02 10:35:23 -06:00
|
|
|
if (!input.length) {
|
2011-01-29 14:25:56 -06:00
|
|
|
unmatched.push(that.values[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
if (unmatched.length > 0) {
|
2011-01-29 14:25:56 -06:00
|
|
|
var tbody = $('tbody', that.table);
|
|
|
|
|
|
|
|
|
|
for (var j=0; j<unmatched.length; j++) {
|
|
|
|
|
var value = unmatched[j].toLowerCase();
|
|
|
|
|
var tr = $('<tr/>').appendTo(tbody);
|
|
|
|
|
|
|
|
|
|
var td = $('<td/>').appendTo(tr);
|
|
|
|
|
td.append($('<input/>', {
|
|
|
|
|
type: 'checkbox',
|
2011-02-02 10:35:23 -06:00
|
|
|
name: that.name,
|
2011-01-29 14:25:56 -06:00
|
|
|
value: value,
|
2011-02-02 10:35:23 -06:00
|
|
|
'class': 'aci-attribute',
|
|
|
|
|
change: function() {
|
2011-11-28 15:07:12 +01:00
|
|
|
that.value_changed.notify([], that);
|
2011-02-02 10:35:23 -06:00
|
|
|
}
|
2011-01-29 14:25:56 -06:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
td = $('<td/>').appendTo(tr);
|
|
|
|
|
td.append($('<label/>', {
|
|
|
|
|
text: value
|
|
|
|
|
}));
|
|
|
|
|
}
|
2010-10-25 19:55:57 -04:00
|
|
|
}
|
2011-01-12 14:47:29 -05:00
|
|
|
};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-09-14 13:01:25 +02:00
|
|
|
that.show_undo = function() {
|
|
|
|
|
$(that.undo_span).css('display', 'inline-block');
|
|
|
|
|
};
|
|
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
return that;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
IPA.widget_factories['attributes'] = IPA.attributes_widget;
|
|
|
|
|
IPA.field_factories['attributes'] = IPA.checkboxes_field;
|
|
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
IPA.rights_widget = function(spec) {
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-01-31 16:29:25 -06:00
|
|
|
var that = IPA.checkboxes_widget(spec);
|
2011-02-02 10:35:23 -06:00
|
|
|
|
|
|
|
|
that.rights = ['write', 'add', 'delete'];
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 12:15:14 -04:00
|
|
|
for (var i=0; i<that.rights.length; i++) {
|
|
|
|
|
var right = that.rights[i];
|
|
|
|
|
that.add_option({label: right, value: right});
|
|
|
|
|
}
|
2010-10-25 19:55:57 -04:00
|
|
|
|
|
|
|
|
return that;
|
2011-01-12 14:47:29 -05:00
|
|
|
};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
IPA.widget_factories['rights'] = IPA.rights_widget;
|
|
|
|
|
IPA.field_factories['rights'] = IPA.checkboxes_field;
|
|
|
|
|
|
|
|
|
|
IPA.permission_target_widget = function(spec) {
|
2011-01-28 16:46:19 -05:00
|
|
|
|
2011-02-02 10:35:23 -06:00
|
|
|
spec = spec || {};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
var factory = spec.container_factory || IPA.details_table_section_nc;
|
|
|
|
|
|
|
|
|
|
var that = factory(spec);
|
2011-02-02 10:35:23 -06:00
|
|
|
|
2011-11-07 14:21:45 -06:00
|
|
|
that.group_entity = IPA.get_entity(spec.group_entity || 'group');
|
|
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
that.targets = [ 'filter', 'subtree', 'targetgroup', 'type' ];
|
|
|
|
|
that.target = that.targets[0];
|
|
|
|
|
that.show_target = spec.show_target;
|
2011-02-07 23:02:43 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
var init = function() {
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
that.target_select = IPA.select_widget({
|
|
|
|
|
entity: that.entity,
|
|
|
|
|
name: 'target',
|
|
|
|
|
label: IPA.messages.objects.permission.target,
|
|
|
|
|
hidden: !that.show_target
|
|
|
|
|
});
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
for (var i=0; i<that.targets.length; i++) {
|
|
|
|
|
var target = that.targets[i];
|
|
|
|
|
var target_param = IPA.get_entity_param('permission', target);
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
that.target_select.options.push({
|
|
|
|
|
label: target_param.label,
|
|
|
|
|
value: target
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.target_select);
|
2011-02-01 13:06:58 -05:00
|
|
|
|
2011-02-03 21:42:50 -06:00
|
|
|
|
2012-01-03 10:57:59 +01:00
|
|
|
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);
|
|
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
that.filter_text = IPA.text_widget({
|
2011-11-11 22:33:05 -06:00
|
|
|
entity: that.entity,
|
2011-08-10 20:03:02 -05:00
|
|
|
name: 'filter',
|
2011-11-11 22:33:05 -06:00
|
|
|
hidden: true
|
2011-08-10 20:03:02 -05:00
|
|
|
});
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.filter_text);
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
that.subtree_textarea = IPA.textarea_widget({
|
2011-11-11 22:33:05 -06:00
|
|
|
entity: that.entity,
|
2011-08-10 20:03:02 -05:00
|
|
|
name: 'subtree',
|
2011-11-11 22:33:05 -06:00
|
|
|
hidden: true
|
2011-08-10 20:03:02 -05:00
|
|
|
});
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.subtree_textarea);
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
that.group_select = IPA.entity_select_widget({
|
2011-11-11 22:33:05 -06:00
|
|
|
entity: that.entity,
|
2011-08-10 20:03:02 -05:00
|
|
|
name: 'targetgroup',
|
2011-11-07 14:21:45 -06:00
|
|
|
other_entity: that.group_entity,
|
2011-11-11 22:33:05 -06:00
|
|
|
other_field: 'cn',
|
|
|
|
|
hidden: true
|
2011-08-10 20:03:02 -05:00
|
|
|
});
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.group_select);
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2011-08-10 20:03:02 -05:00
|
|
|
that.type_select = IPA.select_widget({
|
2011-11-11 22:33:05 -06:00
|
|
|
entity: that.entity,
|
|
|
|
|
name: 'type',
|
|
|
|
|
hidden: true
|
2011-08-10 20:03:02 -05:00
|
|
|
});
|
|
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
var type_param = IPA.get_entity_param('permission', 'type');
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
for (var j=0; j<type_param.values.length; j++) {
|
|
|
|
|
var type_name = type_param.values[j];
|
|
|
|
|
var type_label = IPA.metadata.objects[type_name].label_singular;
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
that.type_select.options.push({
|
|
|
|
|
label: type_label,
|
|
|
|
|
value: type_name
|
|
|
|
|
});
|
2011-02-07 23:02:43 -05:00
|
|
|
}
|
2011-08-31 17:27:32 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.type_select);
|
2011-01-29 14:25:56 -06:00
|
|
|
|
2011-11-11 22:33:05 -06:00
|
|
|
that.attribute_table = IPA.attributes_widget({
|
|
|
|
|
entity: that.entity,
|
|
|
|
|
name: 'attrs',
|
|
|
|
|
object_type: type_param.values[0],
|
|
|
|
|
hidden: true
|
|
|
|
|
});
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.widgets.add_widget(that.attribute_table);
|
2012-02-22 12:53:00 +01:00
|
|
|
|
|
|
|
|
that.attribute_multivalued = IPA.multivalued_widget({
|
|
|
|
|
entity: that.entity,
|
|
|
|
|
name: 'attrs_multi',
|
|
|
|
|
hidden: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
that.widgets.add_widget(that.attribute_multivalued);
|
2011-11-11 22:33:05 -06:00
|
|
|
};
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
init();
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
return that;
|
|
|
|
|
};
|
2011-02-07 23:02:43 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
IPA.permission_target_policy = function (widget_name) {
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
var that = IPA.facet_policy();
|
2011-08-10 20:03:02 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
|
|
that.permission_target = that.container.widgets.get_widget(widget_name);
|
|
|
|
|
var widgets = that.permission_target.widgets;
|
|
|
|
|
|
|
|
|
|
var target_select = widgets.get_widget('target');
|
|
|
|
|
target_select.value_changed.attach(function() {
|
|
|
|
|
var target = target_select.save()[0];
|
|
|
|
|
that.select_target(target);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var type_select = widgets.get_widget('type');
|
2012-02-22 12:53:00 +01:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
type_select.value_changed.attach(function() {
|
|
|
|
|
var type = type_select.save()[0];
|
2012-02-22 12:53:00 +01:00
|
|
|
that.set_attrs_type(type);
|
2011-11-28 15:07:12 +01:00
|
|
|
});
|
2011-01-12 14:47:29 -05:00
|
|
|
};
|
2010-10-25 19:55:57 -04:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
that.set_attrs_type = function(type) {
|
|
|
|
|
var attribute_field = that.container.fields.get_field('attrs');
|
|
|
|
|
var attribute_table = that.permission_target.widgets.get_widget('attrs');
|
|
|
|
|
attribute_table.object_type = type;
|
|
|
|
|
attribute_field.reset();
|
|
|
|
|
};
|
|
|
|
|
|
2012-04-02 15:00:26 +02:00
|
|
|
that.update_attrs = function() {
|
|
|
|
|
|
|
|
|
|
var type_select = that.permission_target.widgets.get_widget('type');
|
|
|
|
|
var type = type_select.save()[0];
|
|
|
|
|
that.set_attrs_type(type);
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.post_create = function() {
|
|
|
|
|
that.select_target(that.permission_target.targets[0]);
|
2011-11-11 22:33:05 -06:00
|
|
|
};
|
2011-01-29 14:25:56 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.post_load = function(data) {
|
2011-01-29 14:25:56 -06:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
var displayed_target;
|
2012-01-03 10:57:59 +01:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
for (var target in that.target_mapping) {
|
2011-11-11 22:33:05 -06:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
if (data.result.result[target]) {
|
|
|
|
|
displayed_target = target;
|
2011-11-28 15:07:12 +01:00
|
|
|
} else {
|
|
|
|
|
that.set_target_visible(target, false);
|
|
|
|
|
}
|
2010-10-25 19:55:57 -04:00
|
|
|
}
|
2012-02-22 12:53:00 +01:00
|
|
|
|
|
|
|
|
if (displayed_target) {
|
|
|
|
|
that.permission_target.target = displayed_target;
|
|
|
|
|
that.set_target_visible(displayed_target, true);
|
|
|
|
|
}
|
2011-11-28 15:07:12 +01:00
|
|
|
};
|
2011-01-29 14:25:56 -06:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.select_target = function(target) {
|
|
|
|
|
that.set_target_visible(that.permission_target.target, false);
|
|
|
|
|
that.permission_target.target = target;
|
|
|
|
|
that.set_target_visible(that.permission_target.target, true);
|
2011-01-29 14:25:56 -06:00
|
|
|
};
|
2011-08-31 17:27:32 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
that.set_target_visible = function(target, visible) {
|
|
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
var target_info = that.target_mapping[target];
|
|
|
|
|
that.set_target_visible_core(target_info, visible);
|
|
|
|
|
};
|
2011-02-02 10:35:23 -06:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
that.set_target_visible_core = function(target_info, visible) {
|
|
|
|
|
var widget = that.permission_target.widgets.get_widget(target_info.name);
|
|
|
|
|
var field = that.container.fields.get_field(target_info.name);
|
|
|
|
|
that.permission_target.set_row_visible(target_info.name, visible);
|
|
|
|
|
field.enabled = visible;
|
|
|
|
|
field.set_required(visible && target_info.required);
|
|
|
|
|
widget.hidden = !visible;
|
2012-01-03 10:57:59 +01:00
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
if (target_info.additional) {
|
|
|
|
|
for (var i=0; i<target_info.additional.length; i++) {
|
|
|
|
|
var nested_info = target_info.additional[i];
|
|
|
|
|
that.set_target_visible_core(nested_info, visible);
|
|
|
|
|
}
|
2012-01-03 10:57:59 +01:00
|
|
|
}
|
2012-02-22 12:53:00 +01:00
|
|
|
|
|
|
|
|
if (target_info.action) target_info.action();
|
2012-01-03 10:57:59 +01:00
|
|
|
};
|
|
|
|
|
|
2012-02-22 12:53:00 +01:00
|
|
|
|
|
|
|
|
that.target_mapping = {
|
|
|
|
|
filter: {
|
|
|
|
|
name: 'filter',
|
|
|
|
|
required: true,
|
|
|
|
|
additional: [
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs_multi'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
subtree: {
|
|
|
|
|
name: 'subtree',
|
|
|
|
|
required: true,
|
|
|
|
|
additional: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberof'
|
2012-04-02 15:22:07 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs_multi'
|
2012-02-22 12:53:00 +01:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
targetgroup: {
|
|
|
|
|
name: 'targetgroup',
|
|
|
|
|
required: true,
|
|
|
|
|
additional: [
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
action: function() {
|
|
|
|
|
that.set_attrs_type('group');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
type: {
|
|
|
|
|
name: 'type',
|
|
|
|
|
additional: [
|
|
|
|
|
{
|
|
|
|
|
name: 'memberof'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attrs'
|
|
|
|
|
}
|
2012-04-02 15:00:26 +02:00
|
|
|
],
|
|
|
|
|
action: function() {
|
|
|
|
|
that.update_attrs();
|
|
|
|
|
}
|
2012-02-22 12:53:00 +01:00
|
|
|
}
|
2011-01-28 16:46:19 -05:00
|
|
|
};
|
|
|
|
|
|
2011-01-29 14:25:56 -06:00
|
|
|
|
2010-10-25 19:55:57 -04:00
|
|
|
return that;
|
2011-01-19 21:10:18 -05:00
|
|
|
};
|
2011-11-02 14:07:07 -05:00
|
|
|
|
2011-11-28 15:07:12 +01:00
|
|
|
IPA.widget_factories['permission_target'] = IPA.permission_target_widget;
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:07:07 -05:00
|
|
|
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);
|