rights check

if the field does not have a 'w' for writable in its rights, disable it.
Merged with the HBAC/Widget changes
add and remove links are managed via permissions now
This commit is contained in:
Adam Young
2010-11-05 13:11:56 -04:00
parent 655aa0fcdf
commit 9a785ed91c
3 changed files with 99 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ test("Testing ipa_details_section.setup().", function() {
var result = {};
var section = ipa_stanza({name:'IDIDID', label:'NAMENAMENAME'}).
var section = ipa_details_section({name:'IDIDID', label:'NAMENAMENAME'}).
input({name:'cn', label:'Entity Name'}).
input({name:'description', label:'Description'}).
input({name:'number', label:'Entity ID'});
@@ -221,7 +221,8 @@ test("Testing _ipa_create_text_input().", function(){
var name = "name";
var value="value";
var input = _ipa_create_text_input(name, value);
var rights = 'rscwo'
var input = _ipa_create_text_input(name, value, null,rights);
ok(input,"input not null");
var text = input.find('input');
@@ -231,3 +232,56 @@ test("Testing _ipa_create_text_input().", function(){
same(text[0].value,value );
same(text[0].type,"text" );
});
test("Testing _ipa_create_text_input() read only .", function(){
var name = "name";
var value="value";
var rights = 'rsc'
var input = _ipa_create_text_input(name, value, null,rights);
ok(input,"input not null");
var text = input.find('input');
ok(text);
same(text[0].name,name );
same(text[0].value,value );
same(text[0].type,"text" );
ok(text[0].disabled);
});
test("Testing ipa_details_section_setup again()",function(){
var section = ipa_details_section({name: 'IDIDID', label: 'NAMENAMENAME'}).
input({name:'cn', label:'Entity Name'}).
input({name:'description', label:'Description'}).
input({name:'number', label:'Entity ID'});
var fields = section.fields;
var container = $("<div title='entity'/>");
var details = $("<div/>");
container.append(details);
section.setup(container, details, section);
ok(container.find('hr'),'hr');
//var h2= container.find('h2');
//ok(h2);
//ok(h2[0].innerHTML.indexOf(section.label) > 1,"find name in html");
var dl = container.find('dl');
ok(dl,'dl');
same(dl[0].children.length,6,'6 children');
same(dl[0].id, section.name);
same(dl[0].children[0].title, fields[0].name,'title matches name');
same(dl[0].children[0].innerHTML, fields[0].label+":",
'inner HTML matches label');
same(dl[0].children[5].title, fields[2].name,
'title matches fields[2] name');
});