mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-12 16:32:01 -05:00
declarative defintions
Delay the creation of entities until after ipa init is called made the user and group entity definitions declarative removed unused facet from groups adjusted unit tests made review changes: factories are now in an associative array entity init called right after factory init dialogs in entity init fixed type on search
This commit is contained in:
1 parent
442d6ad30c
commit
f904df0f0d
24 files changed
+253
-311
No files matched your search
+12
-14
@@ -561,7 +561,7 @@ IPA.target_section = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.permission = function () {
|
IPA.entity_factories.permission = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'permission'
|
'name': 'permission'
|
||||||
@@ -593,9 +593,6 @@ IPA.permission = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.permission());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IPA.permission_add_dialog = function (spec) {
|
IPA.permission_add_dialog = function (spec) {
|
||||||
|
|
||||||
@@ -675,7 +672,7 @@ IPA.permission_details_facet = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.privilege = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'privilege'
|
'name': 'privilege'
|
||||||
});
|
});
|
||||||
@@ -715,10 +712,10 @@ IPA.add_entity( function() {
|
|||||||
that.entity_init();
|
that.entity_init();
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.role = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'role'
|
'name': 'role'
|
||||||
});
|
});
|
||||||
@@ -756,10 +753,10 @@ IPA.add_entity( function() {
|
|||||||
that.entity_init();
|
that.entity_init();
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.selfservice = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'selfservice'
|
'name': 'selfservice'
|
||||||
});
|
});
|
||||||
@@ -783,7 +780,8 @@ IPA.add_entity( function() {
|
|||||||
|
|
||||||
that.init = function() {
|
that.init = function() {
|
||||||
that.add_section(
|
that.add_section(
|
||||||
IPA.stanza({name:'general', label:'General'}).
|
IPA.stanza({name:'general', label:'General',
|
||||||
|
entity_name:'selfservice'}).
|
||||||
input({name:'aciname'}).
|
input({name:'aciname'}).
|
||||||
custom_input(IPA.attribute_table_widget({
|
custom_input(IPA.attribute_table_widget({
|
||||||
object_type:'user',
|
object_type:'user',
|
||||||
@@ -793,7 +791,6 @@ IPA.add_entity( function() {
|
|||||||
return that;
|
return that;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
that.parent_init = that.init;
|
that.parent_init = that.init;
|
||||||
that.init = function(){
|
that.init = function(){
|
||||||
that.parent_init();
|
that.parent_init();
|
||||||
@@ -810,10 +807,10 @@ IPA.add_entity( function() {
|
|||||||
dialog.init();
|
dialog.init();
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.delegation = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'delegation'
|
'name': 'delegation'
|
||||||
});
|
});
|
||||||
@@ -870,4 +867,5 @@ IPA.add_entity( function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
}());
|
|
||||||
|
};
|
||||||
@@ -485,6 +485,7 @@ IPA.stanza = function (spec) {
|
|||||||
IPA.details_facet = function (spec) {
|
IPA.details_facet = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
spec.name = spec.name || 'details';
|
||||||
|
|
||||||
var that = IPA.facet(spec);
|
var that = IPA.facet(spec);
|
||||||
|
|
||||||
@@ -498,8 +499,6 @@ IPA.details_facet = function (spec) {
|
|||||||
that.refresh = spec.refresh || IPA.details_refresh;
|
that.refresh = spec.refresh || IPA.details_refresh;
|
||||||
|
|
||||||
that.sections = [];
|
that.sections = [];
|
||||||
that.sections_by_name = {};
|
|
||||||
|
|
||||||
that.__defineGetter__("entity_name", function(){
|
that.__defineGetter__("entity_name", function(){
|
||||||
return that._entity_name;
|
return that._entity_name;
|
||||||
});
|
});
|
||||||
@@ -512,17 +511,17 @@ IPA.details_facet = function (spec) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
that.get_section = function(name) {
|
|
||||||
return that.sections_by_name[name];
|
|
||||||
};
|
|
||||||
|
|
||||||
that.add_section = function(section) {
|
that.add_section = function(section) {
|
||||||
section.entity_name = that.entity_name;
|
section.entity_name = that.entity_name;
|
||||||
that.sections.push(section);
|
that.sections.push(section);
|
||||||
that.sections_by_name[section.name] = section;
|
|
||||||
return section;
|
return section;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.section = function(section) {
|
||||||
|
that.add_section(section);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
that.create_section = function(spec) {
|
that.create_section = function(spec) {
|
||||||
var section = IPA.details_section(spec);
|
var section = IPA.details_section(spec);
|
||||||
that.add_section(section);
|
that.add_section(section);
|
||||||
|
|||||||
+31
-24
@@ -110,8 +110,17 @@ IPA.entity = function (spec) {
|
|||||||
dialog.entity_name = that.name;
|
dialog.entity_name = that.name;
|
||||||
that.dialogs.push(dialog);
|
that.dialogs.push(dialog);
|
||||||
that.dialogs_by_name[dialog.name] = dialog;
|
that.dialogs_by_name[dialog.name] = dialog;
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function init_dialogs (){
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < that.dialogs.length; i += 1){
|
||||||
|
that.dialogs[i].init();
|
||||||
|
}
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
|
||||||
that.get_facet = function(name) {
|
that.get_facet = function(name) {
|
||||||
return that.facets_by_name[name];
|
return that.facets_by_name[name];
|
||||||
};
|
};
|
||||||
@@ -120,6 +129,14 @@ IPA.entity = function (spec) {
|
|||||||
facet.entity_name = that.name;
|
facet.entity_name = that.name;
|
||||||
that.facets.push(facet);
|
that.facets.push(facet);
|
||||||
that.facets_by_name[facet.name] = facet;
|
that.facets_by_name[facet.name] = facet;
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
|
that.facet = function(facet) {
|
||||||
|
facet.entity_name = that.name;
|
||||||
|
that.facets.push(facet);
|
||||||
|
that.facets_by_name[facet.name] = facet;
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.get_associations = function() {
|
that.get_associations = function() {
|
||||||
@@ -141,6 +158,13 @@ IPA.entity = function (spec) {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.association = function(spec) {
|
||||||
|
var config = IPA.association_config(spec);
|
||||||
|
that.add_association(config);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
that.create_association_facet = function(attribute_member, other_entity, label, facet_group) {
|
that.create_association_facet = function(attribute_member, other_entity, label, facet_group) {
|
||||||
|
|
||||||
if (!attribute_member) {
|
if (!attribute_member) {
|
||||||
@@ -190,8 +214,12 @@ IPA.entity = function (spec) {
|
|||||||
that.add_facet(facet);
|
that.add_facet(facet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.standard_associations = that.create_association_facets;
|
||||||
|
|
||||||
|
|
||||||
that.init = function() {
|
that.init = function() {
|
||||||
|
|
||||||
if (!that.label) {
|
if (!that.label) {
|
||||||
@@ -206,6 +234,7 @@ IPA.entity = function (spec) {
|
|||||||
var facet = that.facets[i];
|
var facet = that.facets[i];
|
||||||
facet.init();
|
facet.init();
|
||||||
}
|
}
|
||||||
|
init_dialogs();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.entity_init = that.init;
|
that.entity_init = that.init;
|
||||||
@@ -221,6 +250,7 @@ var window_hash_cache = {};
|
|||||||
IPA.fetch_entity = function (entity_name) {
|
IPA.fetch_entity = function (entity_name) {
|
||||||
|
|
||||||
var entity = IPA.get_entity(entity_name);
|
var entity = IPA.get_entity(entity_name);
|
||||||
|
/*
|
||||||
if (entity) return entity;
|
if (entity) return entity;
|
||||||
|
|
||||||
entity = IPA.entity({
|
entity = IPA.entity({
|
||||||
@@ -228,6 +258,7 @@ IPA.fetch_entity = function (entity_name) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
IPA.add_entity(entity);
|
IPA.add_entity(entity);
|
||||||
|
*/
|
||||||
return entity;
|
return entity;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -264,30 +295,6 @@ IPA.entity_set_search_definition = function (entity_name, data) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.entity_set_add_definition = function (entity_name, data) {
|
|
||||||
|
|
||||||
var entity = IPA.fetch_entity(entity_name);
|
|
||||||
|
|
||||||
var dialog = IPA.add_dialog({
|
|
||||||
'name': 'add',
|
|
||||||
'title': data[1]
|
|
||||||
});
|
|
||||||
entity.add_dialog(dialog);
|
|
||||||
|
|
||||||
for (var i=0; i<data[2].length; i++) {
|
|
||||||
var field = data[2][i];
|
|
||||||
dialog.add_field(IPA.text_widget({
|
|
||||||
name: field[0],
|
|
||||||
label: field[1],
|
|
||||||
setup: field[2],
|
|
||||||
undo: false
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.init();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.entity_get_add_dialog = function (entity_name) {
|
IPA.entity_get_add_dialog = function (entity_name) {
|
||||||
|
|
||||||
var entity = IPA.fetch_entity(entity_name);
|
var entity = IPA.fetch_entity(entity_name);
|
||||||
|
|||||||
+36
-103
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/* Authors:
|
/* Authors:
|
||||||
* Pavel Zuna <pzuna@redhat.com>
|
* Pavel Zuna <pzuna@redhat.com>
|
||||||
|
* Endi Dewata <edewata@redhat.com>
|
||||||
|
* Adam Young <ayoung@redhat.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat
|
* Copyright (C) 2010 Red Hat
|
||||||
* see file 'COPYING' for use and warranty information
|
* see file 'COPYING' for use and warranty information
|
||||||
@@ -22,123 +24,53 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.group = function () {
|
IPA.entity_factories.group = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
return IPA.entity({
|
||||||
'name': 'group'
|
'name': 'group'
|
||||||
});
|
}).
|
||||||
|
facet(IPA.search_facet().
|
||||||
that.init = function() {
|
column({name:'cn'}).
|
||||||
|
column({name:'gidnumber'}).
|
||||||
that.create_association({
|
column({name:'description'})).
|
||||||
|
facet(
|
||||||
|
IPA.details_facet().section(
|
||||||
|
IPA.stanza({label: 'Group Settings' }).
|
||||||
|
input({name: 'cn' }).
|
||||||
|
input({name: 'description'}).
|
||||||
|
input({name: 'gidnumber' }))).
|
||||||
|
facet( IPA.group_member_user_facet({
|
||||||
|
'name': 'member_user',
|
||||||
|
'label': 'Users',
|
||||||
|
'other_entity': 'user'
|
||||||
|
})).
|
||||||
|
association({
|
||||||
name: 'netgroup',
|
name: 'netgroup',
|
||||||
associator: 'serial'
|
associator: 'serial'
|
||||||
});
|
}).
|
||||||
|
association({
|
||||||
that.create_association({
|
|
||||||
name: 'rolegroup',
|
name: 'rolegroup',
|
||||||
associator: 'serial'
|
associator: 'serial'
|
||||||
});
|
}).
|
||||||
|
association({
|
||||||
that.create_association({
|
|
||||||
name: 'taskgroup',
|
name: 'taskgroup',
|
||||||
associator: 'serial'
|
associator: 'serial'
|
||||||
});
|
}).
|
||||||
|
add_dialog(
|
||||||
var dialog = IPA.group_add_dialog({
|
IPA.add_dialog({
|
||||||
'name': 'add',
|
'name': 'add',
|
||||||
'title': 'Add New Group'
|
'title': 'Add New Group'
|
||||||
});
|
}).
|
||||||
that.add_dialog(dialog);
|
field(IPA.text_widget({name:'cn', undo: false})).
|
||||||
dialog.init();
|
field(IPA.text_widget({name:'description', undo: false})).
|
||||||
|
|
||||||
var facet = IPA.group_search_facet({
|
|
||||||
'name': 'search',
|
|
||||||
'label': 'Search'
|
|
||||||
});
|
|
||||||
that.add_facet(facet);
|
|
||||||
|
|
||||||
facet = IPA.group_details_facet({
|
|
||||||
'name': 'details'
|
|
||||||
});
|
|
||||||
that.add_facet(facet);
|
|
||||||
|
|
||||||
that.create_association_facets();
|
|
||||||
|
|
||||||
that.entity_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.group());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.group_add_dialog = function (spec) {
|
|
||||||
|
|
||||||
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}));
|
|
||||||
// TODO: Replace with i18n label
|
// TODO: Replace with i18n label
|
||||||
that.add_field(IPA.checkbox_widget({
|
field(IPA.checkbox_widget({
|
||||||
name:'posix',
|
name:'posix',
|
||||||
label:'Is this a POSIX group?',
|
label:'Is this a POSIX group?',
|
||||||
undo: false,
|
undo: false,
|
||||||
checked:'checked'}));
|
checked:'checked'})).
|
||||||
that.add_field(IPA.text_widget({name:'gidnumber', undo: false}));
|
field(IPA.text_widget({name:'gidnumber', undo: false}))).
|
||||||
|
standard_associations();
|
||||||
that.add_dialog_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.group_search_facet = function (spec) {
|
|
||||||
|
|
||||||
spec = spec || {};
|
|
||||||
|
|
||||||
var that = IPA.search_facet(spec);
|
|
||||||
|
|
||||||
that.init = function() {
|
|
||||||
that.create_column({name:'cn'});
|
|
||||||
that.create_column({name:'gidnumber'});
|
|
||||||
that.create_column({name:'description'});
|
|
||||||
that.search_facet_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IPA.group_details_facet = function (spec) {
|
|
||||||
|
|
||||||
spec = spec || {};
|
|
||||||
|
|
||||||
var that = IPA.details_facet(spec);
|
|
||||||
|
|
||||||
that.init = function() {
|
|
||||||
|
|
||||||
var section = IPA.details_list_section({
|
|
||||||
name: 'details',
|
|
||||||
label: 'Group Settings'
|
|
||||||
});
|
|
||||||
that.add_section(section);
|
|
||||||
|
|
||||||
section.create_field({name: 'cn' });
|
|
||||||
section.create_field({name: 'description'});
|
|
||||||
section.create_field({name: 'gidnumber' });
|
|
||||||
|
|
||||||
that.details_facet_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
return that;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -198,4 +130,5 @@ IPA.group_member_user_facet = function (spec) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.hbacrule = function () {
|
IPA.entity_factories.hbacrule = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'hbacrule'
|
'name': 'hbacrule'
|
||||||
@@ -35,7 +35,7 @@ IPA.hbacrule = function () {
|
|||||||
'title': 'Add New Rule'
|
'title': 'Add New Rule'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.hbacrule_search_facet({
|
var facet = IPA.hbacrule_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -55,7 +55,6 @@ IPA.hbacrule = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.hbacrule());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.hbacrule_add_dialog = function (spec) {
|
IPA.hbacrule_add_dialog = function (spec) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.hbacsvc = function () {
|
IPA.entity_factories.hbacsvc = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'hbacsvc'
|
'name': 'hbacsvc'
|
||||||
@@ -35,7 +35,6 @@ IPA.hbacsvc = function () {
|
|||||||
'title': 'Add New HBAC Service'
|
'title': 'Add New HBAC Service'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.hbacsvc_search_facet({
|
var facet = IPA.hbacsvc_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -55,8 +54,6 @@ IPA.hbacsvc = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.hbacsvc());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.hbacsvc_add_dialog = function (spec) {
|
IPA.hbacsvc_add_dialog = function (spec) {
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.hbacsvcgroup = function () {
|
IPA.entity_factories.hbacsvcgroup = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'hbacsvcgroup'
|
'name': 'hbacsvcgroup'
|
||||||
@@ -41,7 +41,6 @@ IPA.hbacsvcgroup = function () {
|
|||||||
'title': 'Add New HBAC Service Group'
|
'title': 'Add New HBAC Service Group'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.hbacsvcgroup_search_facet({
|
var facet = IPA.hbacsvcgroup_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -61,9 +60,6 @@ IPA.hbacsvcgroup = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.hbacsvcgroup());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.hbacsvcgroup_add_dialog = function (spec) {
|
IPA.hbacsvcgroup_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
+1
-5
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.host = function () {
|
IPA.entity_factories.host = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'host'
|
'name': 'host'
|
||||||
@@ -47,7 +47,6 @@ IPA.host = function () {
|
|||||||
'title': 'Add New Host'
|
'title': 'Add New Host'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.host_search_facet({
|
var facet = IPA.host_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -76,9 +75,6 @@ IPA.host = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.host());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.host_add_dialog = function (spec) {
|
IPA.host_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.hostgroup = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'hostgroup'
|
'name': 'hostgroup'
|
||||||
});
|
});
|
||||||
@@ -55,13 +55,11 @@ IPA.add_entity( function() {
|
|||||||
|
|
||||||
dialog.add_field(IPA.text_widget({name: 'cn', undo: false}));
|
dialog.add_field(IPA.text_widget({name: 'cn', undo: false}));
|
||||||
dialog.add_field(IPA.text_widget({name: 'description', undo: false}));
|
dialog.add_field(IPA.text_widget({name: 'description', undo: false}));
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
that.create_association_facets();
|
||||||
that.entity_init();
|
that.entity_init();
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+14
-2
@@ -49,6 +49,8 @@ var IPA = ( function () {
|
|||||||
|
|
||||||
|
|
||||||
that.entities = [];
|
that.entities = [];
|
||||||
|
that.entity_factories = {};
|
||||||
|
|
||||||
that.entities_by_name = {};
|
that.entities_by_name = {};
|
||||||
|
|
||||||
that.error_dialog = $('<div/>', {
|
that.error_dialog = $('<div/>', {
|
||||||
@@ -113,11 +115,21 @@ var IPA = ( function () {
|
|||||||
return that.entities_by_name[name];
|
return that.entities_by_name[name];
|
||||||
};
|
};
|
||||||
|
|
||||||
that.add_entity = function (entity) {
|
function add_entity(entity) {
|
||||||
that.entities.push(entity);
|
that.entities.push(entity);
|
||||||
that.entities_by_name[entity.name] = entity;
|
that.entities_by_name[entity.name] = entity;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
that.start_entities = function(){
|
||||||
|
var factory;
|
||||||
|
var name ;
|
||||||
|
for (name in that.entity_factories){
|
||||||
|
factory = that.entity_factories[name];
|
||||||
|
var entity = factory();
|
||||||
|
add_entity(entity);
|
||||||
|
entity.init();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
that.show_page = function (entity_name, facet_name) {
|
that.show_page = function (entity_name, facet_name) {
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.add_entity( function() {
|
IPA.entity_factories.netgroup = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'netgroup'
|
'name': 'netgroup'
|
||||||
});
|
});
|
||||||
@@ -55,13 +55,12 @@ IPA.add_entity( function() {
|
|||||||
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
||||||
dialog.add_field(IPA.text_widget({ name: 'description', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'description', undo: false}));
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
that.create_association_facets();
|
||||||
that.entity_init();
|
that.entity_init();
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+19
-18
@@ -24,8 +24,7 @@
|
|||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
/* DNS */
|
/* DNS */
|
||||||
|
IPA.entity_factories.dnszone = function() {
|
||||||
IPA.add_entity(function (){
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
name: 'dnszone'
|
name: 'dnszone'
|
||||||
});
|
});
|
||||||
@@ -74,15 +73,14 @@ IPA.add_entity(function (){
|
|||||||
dialog.add_field(IPA.text_widget({ name: 'idnsname', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'idnsname', undo: false}));
|
||||||
dialog.add_field(IPA.text_widget({ name: 'idnssoamname', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'idnssoamname', undo: false}));
|
||||||
dialog.add_field(IPA.text_widget({ name: 'idnssoarname', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'idnssoarname', undo: false}));
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
that.create_association_facets();
|
||||||
that.entity_init();
|
that.entity_init();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.records_facet = function (spec){
|
IPA.records_facet = function (spec){
|
||||||
@@ -418,7 +416,6 @@ IPA.records_facet = function (spec){
|
|||||||
options.data = data_filter;
|
options.data = data_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var pkey = $.bbq.getState(that.entity_name + '-pkey', true);
|
var pkey = $.bbq.getState(that.entity_name + '-pkey', true);
|
||||||
IPA.cmd('dnsrecord_find',[pkey],options,load_on_win, load_on_fail);
|
IPA.cmd('dnsrecord_find',[pkey],options,load_on_win, load_on_fail);
|
||||||
|
|
||||||
@@ -499,7 +496,7 @@ IPA.records_facet = function (spec){
|
|||||||
|
|
||||||
/**Automount*/
|
/**Automount*/
|
||||||
|
|
||||||
IPA.add_entity(function (){
|
IPA.entity_factories.automountlocation = function (){
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
name: 'automountlocation'
|
name: 'automountlocation'
|
||||||
});
|
});
|
||||||
@@ -530,20 +527,19 @@ IPA.add_entity(function (){
|
|||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
that.create_association_facets();
|
||||||
that.entity_init();
|
that.entity_init();
|
||||||
|
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
/**pwpolicy*/
|
/**pwpolicy*/
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(function (){
|
IPA.entity_factories.pwpolicy = function() {
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
name: 'pwpolicy'
|
name: 'pwpolicy'
|
||||||
});
|
});
|
||||||
@@ -580,14 +576,13 @@ IPA.add_entity(function (){
|
|||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
that.create_association_facets();
|
that.create_association_facets();
|
||||||
that.entity_init();
|
that.entity_init();
|
||||||
|
|
||||||
};
|
};
|
||||||
return that;
|
return that;
|
||||||
}());
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -595,13 +590,19 @@ IPA.add_entity(function (){
|
|||||||
krbtpolicy
|
krbtpolicy
|
||||||
Does not have search
|
Does not have search
|
||||||
*/
|
*/
|
||||||
|
IPA.entity_factories.krbtpolicy = function() {
|
||||||
|
var that = IPA.entity({
|
||||||
|
name: 'krbtpolicy'
|
||||||
|
});
|
||||||
|
|
||||||
IPA.entity_set_details_definition('krbtpolicy', [
|
var details = IPA.details_facet({
|
||||||
|
'name': 'details'
|
||||||
|
});
|
||||||
|
details.add_section(
|
||||||
IPA.stanza({name:'identity', label:'Kerberos ticket policy'}).
|
IPA.stanza({name:'identity', label:'Kerberos ticket policy'}).
|
||||||
//input({name:'uid',label:' '}).
|
//input({name:'uid',label:' '}).
|
||||||
input({name:'krbmaxrenewableage'}).
|
input({name:'krbmaxrenewableage'}).
|
||||||
input({name:'krbmaxticketlife'})
|
input({name:'krbmaxticketlife'}));
|
||||||
]);
|
that.add_facet(details);
|
||||||
|
return that;
|
||||||
IPA.entity_set_association_definition('krbtpolicy', {
|
};
|
||||||
});
|
|
||||||
@@ -254,6 +254,10 @@ IPA.search_facet = function (spec) {
|
|||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
|
spec.name = spec.name || 'search';
|
||||||
|
spec.label = spec.label || IPA.messages.facets.search;
|
||||||
|
|
||||||
|
|
||||||
spec.display_class = 'search-facet';
|
spec.display_class = 'search-facet';
|
||||||
|
|
||||||
var that = IPA.facet(spec);
|
var that = IPA.facet(spec);
|
||||||
@@ -298,6 +302,11 @@ IPA.search_facet = function (spec) {
|
|||||||
return column;
|
return column;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.column = function(spec){
|
||||||
|
that.create_column(spec);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
that.setup_column = function(column) {
|
that.setup_column = function(column) {
|
||||||
column.setup = function(container, record) {
|
column.setup = function(container, record) {
|
||||||
container.empty();
|
container.empty();
|
||||||
|
|||||||
@@ -26,8 +26,16 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
IPA.entity_set_details_definition('config',[
|
|
||||||
|
|
||||||
|
IPA.entity_factories.config = function(){
|
||||||
|
|
||||||
|
var that = IPA.entity({
|
||||||
|
name: 'config'
|
||||||
|
});
|
||||||
|
|
||||||
|
var details = IPA.details_facet();
|
||||||
|
|
||||||
|
details.add_section(
|
||||||
IPA.stanza({name:'ipaserver', label:'Configuration'}).
|
IPA.stanza({name:'ipaserver', label:'Configuration'}).
|
||||||
input({name:'cn', label:'Name'}).
|
input({name:'cn', label:'Name'}).
|
||||||
input({name:'ipacertificatesubjectbase'}).
|
input({name:'ipacertificatesubjectbase'}).
|
||||||
@@ -39,5 +47,8 @@ IPA.entity_set_details_definition('config',[
|
|||||||
input({name:'ipamigrationenabled'}).
|
input({name:'ipamigrationenabled'}).
|
||||||
input({name:'ipasearchrecordslimit'}).
|
input({name:'ipasearchrecordslimit'}).
|
||||||
input({name:'ipasearchtimelimit'}).
|
input({name:'ipasearchtimelimit'}).
|
||||||
input({name:'ipausersearchfields'})
|
input({name:'ipausersearchfields'}));
|
||||||
]);
|
|
||||||
|
that.add_facet(details);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.service = function () {
|
IPA.entity_factories.service = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'service'
|
'name': 'service'
|
||||||
@@ -42,7 +42,6 @@ IPA.service = function () {
|
|||||||
'title': 'Add New Service'
|
'title': 'Add New Service'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.service_search_facet({
|
var facet = IPA.service_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -69,9 +68,6 @@ IPA.service = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.service());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.service_add_dialog = function (spec) {
|
IPA.service_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.sudocmd = function () {
|
IPA.entity_factories.sudocmd = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'sudocmd'
|
'name': 'sudocmd'
|
||||||
@@ -35,7 +35,6 @@ IPA.sudocmd = function () {
|
|||||||
'title': 'Add New SUDO Command'
|
'title': 'Add New SUDO Command'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.sudocmd_search_facet({
|
var facet = IPA.sudocmd_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -55,9 +54,6 @@ IPA.sudocmd = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.sudocmd());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.sudocmd_add_dialog = function (spec) {
|
IPA.sudocmd_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.sudocmdgroup = function () {
|
IPA.entity_factories.sudocmdgroup = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'sudocmdgroup'
|
'name': 'sudocmdgroup'
|
||||||
@@ -41,7 +41,6 @@ IPA.sudocmdgroup = function () {
|
|||||||
'title': 'Add New SUDO Command Group'
|
'title': 'Add New SUDO Command Group'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.sudocmdgroup_search_facet({
|
var facet = IPA.sudocmdgroup_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -61,9 +60,6 @@ IPA.sudocmdgroup = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.sudocmdgroup());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.sudocmdgroup_add_dialog = function (spec) {
|
IPA.sudocmdgroup_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.sudorule = function () {
|
IPA.entity_factories.sudorule = function () {
|
||||||
|
|
||||||
var that = IPA.entity({
|
var that = IPA.entity({
|
||||||
'name': 'sudorule'
|
'name': 'sudorule'
|
||||||
@@ -35,7 +35,6 @@ IPA.sudorule = function () {
|
|||||||
'title': 'Add New Rule'
|
'title': 'Add New Rule'
|
||||||
});
|
});
|
||||||
that.add_dialog(dialog);
|
that.add_dialog(dialog);
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
var facet = IPA.sudorule_search_facet({
|
var facet = IPA.sudorule_search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
@@ -55,9 +54,6 @@ IPA.sudorule = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.sudorule());
|
|
||||||
|
|
||||||
|
|
||||||
IPA.sudorule_add_dialog = function (spec) {
|
IPA.sudorule_add_dialog = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|||||||
@@ -19,7 +19,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
module('details');
|
module('details', {
|
||||||
|
setup: function() {
|
||||||
|
var obj_name = 'user';
|
||||||
|
IPA.register_entity(
|
||||||
|
function(){
|
||||||
|
return IPA.entity({name:obj_name});
|
||||||
|
});
|
||||||
|
IPA.start_entities();
|
||||||
|
},
|
||||||
|
teardown: function() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
test("Testing IPA.details_section.create().", function() {
|
test("Testing IPA.details_section.create().", function() {
|
||||||
|
|
||||||
@@ -146,7 +158,10 @@ test("Testing details lifecycle: create, setup, load.", function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var container = $("<div/>");
|
var container = $("<div/>");
|
||||||
|
|
||||||
var obj_name = 'user';
|
var obj_name = 'user';
|
||||||
|
|
||||||
|
|
||||||
IPA.entity_set_details_definition(obj_name, [
|
IPA.entity_set_details_definition(obj_name, [
|
||||||
IPA.stanza({name:'identity', label:'Identity Details'}).
|
IPA.stanza({name:'identity', label:'Identity Details'}).
|
||||||
input({name:'title'}).
|
input({name:'title'}).
|
||||||
|
|||||||
@@ -18,7 +18,14 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module('entity');
|
module('entity',{
|
||||||
|
setup: function() {
|
||||||
|
IPA.register_entity(function(){return IPA.entity({name:'user'})});
|
||||||
|
IPA.start_entities();
|
||||||
|
},
|
||||||
|
teardown: function() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('Testing IPA.entity_set_search_definition().', function() {
|
test('Testing IPA.entity_set_search_definition().', function() {
|
||||||
|
|
||||||
@@ -79,20 +86,26 @@ test('Testing ipa_facet_setup_views().', function() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
IPA.register_entity(function(){
|
||||||
var entity = IPA.entity({
|
var entity = IPA.entity({
|
||||||
'name': 'user'
|
'name': 'user'
|
||||||
});
|
});
|
||||||
|
|
||||||
IPA.add_entity(entity);
|
return entity;
|
||||||
|
});
|
||||||
|
|
||||||
|
IPA.start_entities();
|
||||||
|
|
||||||
|
var entity = IPA.get_entity('user');
|
||||||
var facet = IPA.search_facet({
|
var facet = IPA.search_facet({
|
||||||
'name': 'search',
|
'name': 'search',
|
||||||
'label': 'Search'
|
'label': 'Search'
|
||||||
});
|
});
|
||||||
entity.add_facet(facet);
|
entity.add_facet(facet);
|
||||||
|
|
||||||
entity.create_association_facets();
|
entity.create_association_facets();
|
||||||
|
|
||||||
|
|
||||||
var container = $('<div/>');
|
var container = $('<div/>');
|
||||||
|
|
||||||
entity.init();
|
entity.init();
|
||||||
@@ -167,5 +180,3 @@ test('Testing ipa_facet_setup_views().', function() {
|
|||||||
|
|
||||||
IPA.switch_and_show_page = orig_switch_and_show_page;
|
IPA.switch_and_show_page = orig_switch_and_show_page;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -23,28 +23,36 @@ module('navigation');
|
|||||||
|
|
||||||
test("Testing nav_create().", function() {
|
test("Testing nav_create().", function() {
|
||||||
|
|
||||||
var mock_tabs_lists =
|
var mock_tabs_lists = [
|
||||||
[
|
|
||||||
{ name:'identity', label:'IDENTITY', children: [
|
{ name:'identity', label:'IDENTITY', children: [
|
||||||
{name:'user', entity:'user'},
|
{name:'user', entity:'user'},
|
||||||
{name:'group', entity:'group'}
|
{name:'group', entity:'group'}
|
||||||
]}];
|
]}];
|
||||||
|
|
||||||
var entity = IPA.entity({name: 'user'});
|
var entity;
|
||||||
entity.setup = function(container){
|
|
||||||
|
IPA.register_entity( function() {
|
||||||
|
var that = IPA.entity({name: 'user'});
|
||||||
|
that.setup = function(container){
|
||||||
user_mock_called = true;
|
user_mock_called = true;
|
||||||
same(container[0].id,'user','user id');
|
same(container[0].id,'user','user id');
|
||||||
same(container[0].nodeName,'DIV','user div');
|
same(container[0].nodeName,'DIV','user div');
|
||||||
};
|
}
|
||||||
IPA.add_entity(entity);
|
return that;
|
||||||
|
});
|
||||||
|
|
||||||
entity = IPA.entity({name: 'group'});
|
IPA.register_entity( function(){
|
||||||
entity.setup = function(container){
|
|
||||||
|
var that = IPA.entity({name: 'group'});
|
||||||
|
that.setup = function(container){
|
||||||
group_mock_called = true;
|
group_mock_called = true;
|
||||||
same(container[0].id,'group','group id');
|
same(container[0].id,'group','group id');
|
||||||
same(container[0].nodeName,'DIV','group Div');
|
same(container[0].nodeName,'DIV','group Div');
|
||||||
};
|
};
|
||||||
IPA.add_entity(entity);
|
return that;
|
||||||
|
});
|
||||||
|
|
||||||
|
IPA.start_entities();
|
||||||
|
|
||||||
IPA.metadata = {};
|
IPA.metadata = {};
|
||||||
var navigation = $('<div id="navigation"/>').appendTo(document.body);
|
var navigation = $('<div id="navigation"/>').appendTo(document.body);
|
||||||
|
|||||||
+44
-77
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
/* Authors:
|
/* Authors:
|
||||||
* Pavel Zuna <pzuna@redhat.com>
|
* Pavel Zuna <pzuna@redhat.com>
|
||||||
|
* Adam Young <ayoung@redhat.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat
|
* Copyright (C) 2010 Red Hat
|
||||||
* see file 'COPYING' for use and warranty information
|
* see file 'COPYING' for use and warranty information
|
||||||
@@ -22,108 +23,76 @@
|
|||||||
|
|
||||||
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
||||||
|
|
||||||
IPA.user = function (){
|
IPA.entity_factories.user = function (){
|
||||||
|
|
||||||
var that = IPA.entity({
|
return IPA.entity({
|
||||||
name: 'user'
|
name: 'user'
|
||||||
});
|
}).
|
||||||
|
association({
|
||||||
that.init = function() {
|
|
||||||
|
|
||||||
that.create_association({
|
|
||||||
'name': 'group',
|
'name': 'group',
|
||||||
'associator': 'serial'
|
'associator': 'serial'
|
||||||
});
|
}).
|
||||||
|
association({
|
||||||
that.create_association({
|
|
||||||
'name': 'netgroup',
|
'name': 'netgroup',
|
||||||
'associator': 'serial'
|
'associator': 'serial'
|
||||||
});
|
}).
|
||||||
|
facet(
|
||||||
var search_facet = IPA.search_facet({
|
IPA.search_facet().
|
||||||
'name': 'search',
|
column({name:'cn'}).
|
||||||
'label': 'Search',
|
column({name:'uid'}).
|
||||||
entity_name: that.name
|
column({name:'uidnumber'}).
|
||||||
});
|
column({name:'mail'}).
|
||||||
that.add_facet(search_facet);
|
column({name:'telephonenumber'}).
|
||||||
|
column({name:'title'})).
|
||||||
search_facet.create_column({name:'cn'});
|
facet(IPA.details_facet().
|
||||||
search_facet.create_column({name:'uid'});
|
section(
|
||||||
search_facet.create_column({name:'uidnumber'});
|
IPA.stanza({label:IPA.messages.details.identity}).
|
||||||
search_facet.create_column({name:'mail'});
|
|
||||||
search_facet.create_column({name:'telephonenumber'});
|
|
||||||
search_facet.create_column({name:'title'});
|
|
||||||
|
|
||||||
that.add_facet(details_facet({name:'details'}));
|
|
||||||
|
|
||||||
var dialog = IPA.add_dialog({
|
|
||||||
'name': 'add',
|
|
||||||
'title': 'Add User'
|
|
||||||
});
|
|
||||||
that.add_dialog(dialog);
|
|
||||||
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'uid', undo: false }));
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'givenname', undo: false }));
|
|
||||||
dialog.add_field(IPA.text_widget({ name: 'sn', undo: false }));
|
|
||||||
dialog.init();
|
|
||||||
|
|
||||||
/*eventually, we need to call
|
|
||||||
entity.create_association_facets();
|
|
||||||
but we are currently defining the associator using the global
|
|
||||||
function after the registration of the entity */
|
|
||||||
that.create_association_facets();
|
|
||||||
|
|
||||||
that.entity_init();
|
|
||||||
};
|
|
||||||
|
|
||||||
function details_facet(spec) {
|
|
||||||
spec = spec || {};
|
|
||||||
var that = IPA.details_facet(spec);
|
|
||||||
|
|
||||||
var sections =[
|
|
||||||
IPA.stanza({name:'identity', label:IPA.messages.details.identity}).
|
|
||||||
input({name:'title'}).
|
input({name:'title'}).
|
||||||
input({name:'givenname'}).
|
input({name:'givenname'}).
|
||||||
input({name:'sn'}).
|
input({name:'sn'}).
|
||||||
input({name:'cn'}).
|
input({name:'cn'}).
|
||||||
input({name:'displayname'}).
|
input({name:'displayname'}).
|
||||||
input({name:'initials'}),
|
input({name:'initials'})).
|
||||||
IPA.stanza({name:'account', label:IPA.messages.details.account}).
|
section(
|
||||||
|
IPA.stanza({label:IPA.messages.details.account}).
|
||||||
custom_input(user_status_widget({name:'nsaccountlock'})).
|
custom_input(user_status_widget({name:'nsaccountlock'})).
|
||||||
input({name:'uid'}).
|
input({name:'uid'}).
|
||||||
input({name:'userpassword', load: user_password_load}).
|
input({name:'userpassword', load: user_password_load}).
|
||||||
input({name:'uidnumber'}).
|
input({name:'uidnumber'}).
|
||||||
input({name:'gidnumber'}).
|
input({name:'gidnumber'}).
|
||||||
input({name:'loginshell'}).
|
input({name:'loginshell'}).
|
||||||
input({name:'homedirectory'}),
|
input({name:'homedirectory'})).
|
||||||
IPA.stanza({name:'contact', label:IPA.messages.details.contact}).
|
section(
|
||||||
|
IPA.stanza({label:IPA.messages.details.contact}).
|
||||||
input({name:'mail'}).
|
input({name:'mail'}).
|
||||||
input({name:'telephonenumber'}).
|
input({name:'telephonenumber'}).
|
||||||
input({name:'pager'}).
|
input({name:'pager'}).
|
||||||
input({name:'mobile'}).
|
input({name:'mobile'}).
|
||||||
input({name:'facsimiletelephonenumber'}),
|
input({name:'facsimiletelephonenumber'})).
|
||||||
IPA.stanza({name:'address', label: IPA.messages.details.mailing}).
|
section(
|
||||||
|
IPA.stanza({label: IPA.messages.details.mailing}).
|
||||||
input({name:'street'}).
|
input({name:'street'}).
|
||||||
input({name:'location'}).
|
input({name:'location'}).
|
||||||
input({name:'state', load:user_state_load}).
|
input({name:'state', load:user_state_load}).
|
||||||
input({name:'postalcode'}),
|
input({name:'postalcode'})).
|
||||||
IPA.stanza({name:'employee', label:IPA.messages.details.employee}).
|
section(
|
||||||
|
IPA.stanza({label:IPA.messages.details.employee}).
|
||||||
input({name:'ou', label:'Org. Unit'}).
|
input({name:'ou', label:'Org. Unit'}).
|
||||||
input({name:'manager'}),
|
input({name:'manager'})).
|
||||||
IPA.stanza({name:'misc', label:IPA.messages.details.misc}).
|
section(
|
||||||
input({name:'carlicense'})
|
IPA.stanza({label:IPA.messages.details.misc}).
|
||||||
];
|
input({name:'carlicense'}))).
|
||||||
for (var i = 0; i < sections.length; i += 1){
|
standard_associations().
|
||||||
that.add_section(sections[i]);
|
add_dialog(
|
||||||
}
|
IPA.add_dialog({
|
||||||
return that;
|
'name': 'add',
|
||||||
}
|
'title': 'Add User'
|
||||||
return that;
|
}).
|
||||||
|
field(IPA.text_widget({ name: 'uid', undo: false })).
|
||||||
|
field(IPA.text_widget({ name: 'givenname', undo: false })).
|
||||||
|
field(IPA.text_widget({ name: 'sn', undo: false })));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPA.add_entity(IPA.user());
|
|
||||||
|
|
||||||
/* ATTRIBUTE CALLBACKS */
|
/* ATTRIBUTE CALLBACKS */
|
||||||
|
|
||||||
|
|
||||||
@@ -294,5 +263,3 @@ function user_state_load(result) {
|
|||||||
else
|
else
|
||||||
sel.val('');
|
sel.val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+1
-4
@@ -135,10 +135,7 @@ $(function() {
|
|||||||
$('#loggedinas a').fragment(
|
$('#loggedinas a').fragment(
|
||||||
{'user-facet':'details', 'user-pkey':IPA.whoami_pkey},2);
|
{'user-facet':'details', 'user-pkey':IPA.whoami_pkey},2);
|
||||||
|
|
||||||
for (var i=0; i<IPA.entities.length; i++) {
|
IPA.start_entities();
|
||||||
var entity = IPA.entities[i];
|
|
||||||
entity.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
var navigation = $('#navigation');
|
var navigation = $('#navigation');
|
||||||
|
|
||||||
|
|||||||
@@ -898,6 +898,11 @@ IPA.dialog = function(spec) {
|
|||||||
that.fields_by_name[field.name] = field;
|
that.fields_by_name[field.name] = field;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.field = function(field){
|
||||||
|
that.add_field(field);
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
that.init = function() {
|
that.init = function() {
|
||||||
for (var i=0; i<that.fields.length; i++) {
|
for (var i=0; i<that.fields.length; i++) {
|
||||||
var field = that.fields[i];
|
var field = that.fields[i];
|
||||||
|
|||||||
Reference in new issue
Block a user