mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
declarative for aci
A couple of the ACI definitions were incorrect, and the end result was that fields were not getting initialized. USing the declarative approach cleaned up the cause. Also fixed a few broken unit tests
This commit is contained in:
@@ -457,9 +457,6 @@ IPA.target_section = function () {
|
|||||||
appendTo(dl);
|
appendTo(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
that.create = function(container) {
|
that.create = function(container) {
|
||||||
var dl = $('<dl class="aci-target"/>').appendTo(container);
|
var dl = $('<dl class="aci-target"/>').appendTo(container);
|
||||||
display_filter_target(dl);
|
display_filter_target(dl);
|
||||||
@@ -563,111 +560,35 @@ IPA.target_section = function () {
|
|||||||
|
|
||||||
IPA.entity_factories.permission = function () {
|
IPA.entity_factories.permission = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
return IPA.entity({
|
||||||
'name': 'permission'
|
'name': 'permission'
|
||||||
});
|
}).add_dialog(
|
||||||
|
IPA.add_dialog({
|
||||||
that.init = function() {
|
|
||||||
|
|
||||||
var dialog = IPA.permission_add_dialog({
|
|
||||||
name: 'add',
|
name: 'add',
|
||||||
title: 'Add New Permission',
|
title: 'Add New Permission'
|
||||||
entity_name: 'permission'
|
}).
|
||||||
});
|
field(IPA.text_widget({
|
||||||
that.add_dialog(dialog);
|
name: 'cn',
|
||||||
dialog.init();
|
undo: false
|
||||||
|
})).
|
||||||
var facet = IPA.permission_search_facet({
|
field(IPA.text_widget({
|
||||||
name: 'search',
|
name: 'description',
|
||||||
label: 'Search'
|
undo: false
|
||||||
});
|
})).
|
||||||
that.add_facet(facet);
|
field(IPA.rights_widget({name:'permissions'})).
|
||||||
|
field(IPA.hidden_widget(
|
||||||
facet = IPA.permission_details_facet();
|
{name:'filter','value':'objectClass=changethisvalue'}))).
|
||||||
that.add_facet(facet);
|
facet(IPA.search_facet().
|
||||||
|
column({name:'cn'}).
|
||||||
that.entity_init();
|
column({name:'description'})).
|
||||||
};
|
facet(IPA.details_facet({ name: 'details' }).
|
||||||
|
section(
|
||||||
return that;
|
IPA.stanza({
|
||||||
};
|
name:'identity',label:'Identity' }).
|
||||||
|
input({ name: 'cn', 'read_only': true }).
|
||||||
|
input({ name: 'description'})).
|
||||||
|
section(IPA.rights_section()).
|
||||||
IPA.permission_add_dialog = function (spec) {
|
section(IPA.target_section()));
|
||||||
|
|
||||||
spec = spec || {};
|
|
||||||
|
|
||||||
var that = IPA.add_dialog(spec);
|
|
||||||
|
|
||||||
that.init = function() {
|
|
||||||
|
|
||||||
that.add_field(IPA.text_widget({
|
|
||||||
name: 'cn',
|
|
||||||
undo: false
|
|
||||||
}));
|
|
||||||
|
|
||||||
that.add_field(IPA.text_widget({
|
|
||||||
name: 'description',
|
|
||||||
undo: false
|
|
||||||
}));
|
|
||||||
|
|
||||||
that.add_field(IPA.rights_widget({name:'permissions'}));
|
|
||||||
that.add_field(IPA.hidden_widget({name:'filter','value':'objectClass=changethisvalue'}));
|
|
||||||
that.add_dialog_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.permission_search_facet = function (spec) {
|
|
||||||
|
|
||||||
spec = spec || {};
|
|
||||||
var that = IPA.search_facet(spec);
|
|
||||||
that.init = function() {
|
|
||||||
that.create_column({name:'cn'});
|
|
||||||
that.create_column({name:'description'});
|
|
||||||
that.search_facet_init();
|
|
||||||
};
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.permission_details_facet = function () {
|
|
||||||
|
|
||||||
var spec = {
|
|
||||||
name: 'details'
|
|
||||||
};
|
|
||||||
var that = IPA.details_facet(spec);
|
|
||||||
|
|
||||||
that.init = function() {
|
|
||||||
|
|
||||||
var section = that.add_section(IPA.details_list_section({
|
|
||||||
name:'identity',label:'Identity' }));
|
|
||||||
section.create_field({ name: 'cn', 'read_only': true });
|
|
||||||
section.create_field({ name: 'description'});
|
|
||||||
|
|
||||||
that.rights_section = IPA.rights_section();
|
|
||||||
that.add_section(that.rights_section);
|
|
||||||
|
|
||||||
that.target_section = IPA.target_section();
|
|
||||||
|
|
||||||
that.add_section(that.target_section);
|
|
||||||
that.details_facet_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
that.superior_load = that.load;
|
|
||||||
|
|
||||||
that.load = function(result) {
|
|
||||||
that.superior_load(result);
|
|
||||||
};
|
|
||||||
|
|
||||||
that.superior_update = that.update;
|
|
||||||
that.update = function(on_win, on_fail){
|
|
||||||
that.superior_update(on_win, on_fail);
|
|
||||||
};
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -716,156 +637,89 @@ IPA.entity_factories.privilege = function() {
|
|||||||
|
|
||||||
|
|
||||||
IPA.entity_factories.role = function() {
|
IPA.entity_factories.role = function() {
|
||||||
var that = IPA.entity({
|
return IPA.entity({
|
||||||
'name': 'role'
|
'name': 'role'
|
||||||
});
|
}).
|
||||||
that.init = function() {
|
facet(IPA.search_facet().
|
||||||
var search_facet = IPA.search_facet({
|
column({name:'cn'}).
|
||||||
name: 'search',
|
column({name:'description'})).
|
||||||
label: 'Search',
|
facet(
|
||||||
entity_name: that.name
|
IPA.details_facet({name:'details'}).
|
||||||
});
|
section(
|
||||||
search_facet.create_column({name:'cn'});
|
IPA.stanza({name:'identity', label:'Role Settings'}).
|
||||||
search_facet.create_column({name:'description'});
|
input({name:'cn'}).
|
||||||
that.add_facet(search_facet);
|
input({name: 'description'}))).
|
||||||
|
add_dialog(
|
||||||
that.add_facet(function() {
|
IPA.add_dialog({
|
||||||
var that = IPA.details_facet({name:'details'});
|
name: 'add',
|
||||||
that.add_section(
|
title: 'Add Role'
|
||||||
IPA.stanza({name:'identity', label:'Role Settings'}).
|
}).
|
||||||
input({name:'cn'}).
|
field(IPA.text_widget({ name: 'cn', undo: false})).
|
||||||
input({name: 'description'}));
|
field(IPA.text_widget({ name: 'description', undo: false}))).
|
||||||
return that;
|
standard_associations();
|
||||||
}());
|
|
||||||
|
|
||||||
var dialog = IPA.add_dialog({
|
|
||||||
name: 'add',
|
|
||||||
title: 'Add Role'
|
|
||||||
});
|
|
||||||
that.add_dialog(dialog);
|
|
||||||
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'description', undo: false}));
|
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
|
||||||
|
|
||||||
that.entity_init();
|
|
||||||
};
|
|
||||||
return that;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.entity_factories.selfservice = function() {
|
IPA.entity_factories.selfservice = function() {
|
||||||
var that = IPA.entity({
|
return IPA.entity({
|
||||||
'name': 'selfservice'
|
'name': 'selfservice'
|
||||||
});
|
}).
|
||||||
|
facet(IPA.search_facet().
|
||||||
that.add_facet(function () {
|
column({name:'aciname'})).
|
||||||
var spec = {
|
facet(
|
||||||
name: 'search',
|
IPA.details_facet({'name':'details'}).
|
||||||
label: 'Search'
|
section(
|
||||||
};
|
IPA.stanza({name:'general', label:'General'}).
|
||||||
var that = IPA.search_facet(spec);
|
input({name:'aciname'}).
|
||||||
that.init = function() {
|
custom_input(IPA.attribute_table_widget({
|
||||||
that.create_column({name:'aciname'});
|
object_type:'user',
|
||||||
that.search_facet_init();
|
name:'attrs'
|
||||||
};
|
})))).
|
||||||
return that;
|
add_dialog(
|
||||||
}());
|
IPA.add_dialog({
|
||||||
|
name: 'add',
|
||||||
|
title: 'Add Self Service Definition'
|
||||||
that.add_facet(function(){
|
}).
|
||||||
var that = IPA.details_facet({'name':'details'});
|
field(IPA.text_widget({ name: 'aciname', undo: false})).
|
||||||
|
field(IPA.attribute_table_widget({
|
||||||
that.init = function() {
|
object_type:'user',
|
||||||
that.add_section(
|
name:'attrs'
|
||||||
IPA.stanza({name:'general', label:'General',
|
})));
|
||||||
entity_name:'selfservice'}).
|
|
||||||
input({name:'aciname'}).
|
|
||||||
custom_input(IPA.attribute_table_widget({
|
|
||||||
object_type:'user',
|
|
||||||
name:'attrs'
|
|
||||||
})));
|
|
||||||
};
|
|
||||||
return that;
|
|
||||||
}());
|
|
||||||
|
|
||||||
that.parent_init = that.init;
|
|
||||||
that.init = function(){
|
|
||||||
that.parent_init();
|
|
||||||
var dialog = IPA.add_dialog({
|
|
||||||
name: 'add',
|
|
||||||
title: 'Add Self Service Definition'
|
|
||||||
});
|
|
||||||
that.add_dialog(dialog);
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'aciname', undo: false}));
|
|
||||||
dialog.add_field(IPA.attribute_table_widget({
|
|
||||||
object_type:'user',
|
|
||||||
name:'attrs'
|
|
||||||
}));
|
|
||||||
dialog.init();
|
|
||||||
};
|
|
||||||
return that;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.entity_factories.delegation = function() {
|
IPA.entity_factories.delegation = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'delegation'
|
'name': 'delegation'
|
||||||
});
|
}).facet(
|
||||||
|
IPA.search_facet().
|
||||||
that.add_facet(function () {
|
column({name:'aciname'})).
|
||||||
var spec = {
|
facet(
|
||||||
name: 'search',
|
IPA.details_facet().
|
||||||
label: 'Search'
|
section(
|
||||||
};
|
IPA.stanza({name:'general', label:'General'}).
|
||||||
var that = IPA.search_facet(spec);
|
input({name:'aciname'}).
|
||||||
that.init = function() {
|
custom_input(IPA.entity_select_widget(
|
||||||
that.create_column({name:'aciname'});
|
{name:'group', entity:'group'})).
|
||||||
that.search_facet_init();
|
custom_input(IPA.entity_select_widget(
|
||||||
};
|
{name:'memberof', entity:'group'})).
|
||||||
return that;
|
custom_input(
|
||||||
}());
|
IPA.rights_widget({
|
||||||
that.add_facet(function(){
|
id:'delegation_rights'})).
|
||||||
var that = IPA.details_facet({'name':'details'});
|
custom_input(
|
||||||
var section =
|
IPA.attribute_table_widget({
|
||||||
IPA.stanza({name:'general', label:'General'}).
|
name:'attrs'})))).
|
||||||
input({name:'aciname'}).
|
add_dialog(IPA.add_dialog({
|
||||||
custom_input(IPA.entity_select_widget(
|
|
||||||
{name:'group', entity:'group'})).
|
|
||||||
custom_input(IPA.entity_select_widget(
|
|
||||||
{name:'memberof', entity:'group'})).
|
|
||||||
custom_input(
|
|
||||||
IPA.rights_widget({
|
|
||||||
id:'delegation_rights'})).
|
|
||||||
custom_input(
|
|
||||||
IPA.attribute_table_widget({
|
|
||||||
name:'attrs'}));
|
|
||||||
that.add_section(section);
|
|
||||||
return that;
|
|
||||||
}());
|
|
||||||
|
|
||||||
that.super_init = that.init;
|
|
||||||
that.init = function(){
|
|
||||||
that.super_init();
|
|
||||||
var dialog = IPA.add_dialog({
|
|
||||||
name: 'add',
|
name: 'add',
|
||||||
title: 'Add Delegation',
|
title: 'Add Delegation'
|
||||||
entity_name: that.entity
|
}).
|
||||||
});
|
field(IPA.text_widget({ name: 'aciname', undo: false})).
|
||||||
that.add_dialog(dialog);
|
field(IPA.entity_select_widget({name:'group',
|
||||||
dialog.add_field(IPA.text_widget({ name: 'aciname', undo: false}));
|
entity:'group'})).
|
||||||
dialog.add_field(IPA.entity_select_widget({name:'group',
|
field(IPA.entity_select_widget({name:'memberof',
|
||||||
entity:'group'}));
|
entity:'group'})).
|
||||||
dialog.add_field(IPA.entity_select_widget({name:'memberof',
|
field(IPA.attribute_table_widget({ name: 'attrs'}))).
|
||||||
entity:'group'}));
|
standard_associations();
|
||||||
dialog.add_field(IPA.attribute_table_widget({ name: 'attrs'}));
|
|
||||||
|
|
||||||
dialog.init();
|
|
||||||
that.create_association_facets();
|
|
||||||
};
|
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ IPA.entity_factories.hbacrule = function () {
|
|||||||
'title': 'Add New Rule'
|
'title': 'Add New Rule'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
|
|
||||||
|
|
||||||
var facet = IPA.hbacrule_search_facet({
|
var facet = IPA.hbacrule_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ IPA.entity_factories.hbacsvc = function () {
|
|||||||
'title': 'Add New HBAC Service'
|
'title': 'Add New HBAC Service'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
|
|
||||||
var facet = IPA.hbacsvc_search_facet({
|
var facet = IPA.hbacsvc_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
'label': 'Search'
|
'label': 'Search'
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ IPA.entity_factories.hbacsvcgroup = function () {
|
|||||||
'title': 'Add New HBAC Service Group'
|
'title': 'Add New HBAC Service Group'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
|
|
||||||
var facet = IPA.hbacsvcgroup_search_facet({
|
var facet = IPA.hbacsvcgroup_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
'label': 'Search'
|
'label': 'Search'
|
||||||
|
|||||||
@@ -31,24 +31,20 @@ IPA.entity_factories.config = function(){
|
|||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
name: 'config'
|
name: 'config'
|
||||||
});
|
}).facet(
|
||||||
|
IPA.details_facet().
|
||||||
var details = IPA.details_facet();
|
section(
|
||||||
|
IPA.stanza({name:'ipaserver', label:'Configuration'}).
|
||||||
details.add_section(
|
input({name:'cn', label:'Name'}).
|
||||||
IPA.stanza({name:'ipaserver', label:'Configuration'}).
|
input({name:'ipacertificatesubjectbase'}).
|
||||||
input({name:'cn', label:'Name'}).
|
input({name:'ipadefaultloginshell'}).
|
||||||
input({name:'ipacertificatesubjectbase'}).
|
input({name:'ipadefaultprimarygroup'}).
|
||||||
input({name:'ipadefaultloginshell'}).
|
input({name:'ipagroupsearchfields'}).
|
||||||
input({name:'ipadefaultprimarygroup'}).
|
input({name:'ipahomesrootdir'}).
|
||||||
input({name:'ipagroupsearchfields'}).
|
input({name:'ipamaxusernamelength'}).
|
||||||
input({name:'ipahomesrootdir'}).
|
input({name:'ipamigrationenabled'}).
|
||||||
input({name:'ipamaxusernamelength'}).
|
input({name:'ipasearchrecordslimit'}).
|
||||||
input({name:'ipamigrationenabled'}).
|
input({name:'ipasearchtimelimit'}).
|
||||||
input({name:'ipasearchrecordslimit'}).
|
input({name:'ipausersearchfields'})));
|
||||||
input({name:'ipasearchtimelimit'}).
|
|
||||||
input({name:'ipausersearchfields'}));
|
|
||||||
|
|
||||||
that.add_facet(details);
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
module('details', {
|
module('details', {
|
||||||
setup: function() {
|
setup: function() {
|
||||||
var obj_name = 'user';
|
var obj_name = 'user';
|
||||||
IPA.register_entity(
|
IPA.entity_factories.user=
|
||||||
function(){
|
function(){
|
||||||
return IPA.entity({name:obj_name});
|
return IPA.entity({name:obj_name});
|
||||||
});
|
};
|
||||||
IPA.start_entities();
|
IPA.start_entities();
|
||||||
},
|
},
|
||||||
teardown: function() {
|
teardown: function() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
module('entity',{
|
module('entity',{
|
||||||
setup: function() {
|
setup: function() {
|
||||||
IPA.register_entity(function(){return IPA.entity({name:'user'})});
|
IPA.entity_factories.user = function(){
|
||||||
|
return IPA.entity({name:'user'})};
|
||||||
IPA.start_entities();
|
IPA.start_entities();
|
||||||
},
|
},
|
||||||
teardown: function() {
|
teardown: function() {
|
||||||
@@ -87,14 +88,6 @@ test('Testing ipa_facet_setup_views().', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
IPA.register_entity(function(){
|
|
||||||
var entity = IPA.entity({
|
|
||||||
'name': 'user'
|
|
||||||
});
|
|
||||||
|
|
||||||
return entity;
|
|
||||||
});
|
|
||||||
|
|
||||||
IPA.start_entities();
|
IPA.start_entities();
|
||||||
|
|
||||||
var entity = IPA.get_entity('user');
|
var entity = IPA.get_entity('user');
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ test("Testing nav_create().", function() {
|
|||||||
|
|
||||||
var entity;
|
var entity;
|
||||||
|
|
||||||
IPA.register_entity( function() {
|
IPA.entity_factories.user = function() {
|
||||||
var that = IPA.entity({name: 'user'});
|
var that = IPA.entity({name: 'user'});
|
||||||
that.setup = function(container){
|
that.setup = function(container){
|
||||||
user_mock_called = true;
|
user_mock_called = true;
|
||||||
@@ -39,10 +39,8 @@ test("Testing nav_create().", function() {
|
|||||||
same(container[0].nodeName,'DIV','user div');
|
same(container[0].nodeName,'DIV','user div');
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
});
|
};
|
||||||
|
IPA.entity_factories.group = function(){
|
||||||
IPA.register_entity( function(){
|
|
||||||
|
|
||||||
var that = IPA.entity({name: 'group'});
|
var that = IPA.entity({name: 'group'});
|
||||||
that.setup = function(container){
|
that.setup = function(container){
|
||||||
group_mock_called = true;
|
group_mock_called = true;
|
||||||
@@ -50,7 +48,7 @@ test("Testing nav_create().", function() {
|
|||||||
same(container[0].nodeName,'DIV','group Div');
|
same(container[0].nodeName,'DIV','group Div');
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
});
|
};
|
||||||
|
|
||||||
IPA.start_entities();
|
IPA.start_entities();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user