Tuesday, November 28, 2006

My first placement rule!

All right I admit it's mostly borrowed from the example documentation. Thanks whomever wrote the docs, but basically my placement rule looks at the value of the location attribute for each user and based on that it assigns the user to a location in the ITIM org tree:

function getContainerName() {
var loc = entry.l.toString();
if (loc == 'E1B Education Campus')
return 'e1b education campus';
if (loc == 'Harkness Career Center')
return 'harkness career center';
if (loc == 'Kenton Career Center')
return 'kenton career center';
if (loc == 'Northtowns Academy')
return 'northtowns academy';
if (loc == 'Potter Road Career Center')
return 'potter road career center';
if (loc == 'Southtowns Academy')
return 'southtowns academy';
else {
return 'Other';
return 'l=' + getContainerName() + ',ou=erie1';

The only problem I had was trying to use wild cards. This code requires that there is an exact match to the value of entry.l so if someone had a typo somewhere I would end up placing them in Other. I was thinking that it might be nice to handle use say 'e1b*' instead of 'E1B Education Campus' that way it wouldn't have to be exact. That doesn't work however. Maybe there is function or method to the entry object that might let me do something like entry.l.contains or something to that effect where I might be able to get away with some wild card.

Anyhow, I'll play around with this more later. I have something working for now so I'm going to focus on getting some adapters installed and I'll re-visit placement stuff later.


Anonymous said...

Try using the match() method... Thanks for your script it's exactly what I've been trying to do only easier!

Anonymous said...

free por [url=http://pornushi.ru/english-version/sex-vedio/girls-cumming-mp4.htm]girls cumming mp4[/url]