[python-win32] need help in creating a username generator
Brian Jarrett
bjarrett@garcoschools.org
Fri, 4 Apr 2003 09:12:56 -0800
Hello all.
I'm new to Python and I've been working on some scripts to automate the =
creation of user accounts on our network. I work in a school district, =
so I want the school secretaries to use a webpage to create student user =
accounts and I will have the administrations staff create employee user =
accounts and email boxes.
What I want to do is create some sort of object or function that would =
take a variable number of "rules" and apply them to information =
specified (firstname, lastname, middle initial, graduation year) to come =
up with a username for the individual. If the first username is already =
used, then it would try applying the next "rule" until it came up with a =
unique name. Since I have two classes of users (Employees and Students) =
I will have two separate sets of rules.
I already have code that checks my Active Directory to see if a username =
has not been used. I just need something to generate the username to =
test.
Of course I could hardcode how I'd want to slice up first and last =
names, etc, to get a username, but I thought I'd make it more flexible =
and then release it for others to use if they wanted.
The rules I'd be using would be something like:
Employees:
Try first initial + last name
Try first initial + middle initial + last name
Students:
Try first initial + last name + last 2 digits of grad year
Try first initial + middle initial + last name + last 2 digits of grad =
year
Try first two letters of first name + last name + last 2 digits of grad =
year
Any ideas on how to do this would be appreciated. Mainly I'm concerned =
with making the rules persistent but easily changed and flexible enough =
to add/remove data to use and how to specify the use of said data.
Brian Jarrett
Network Administrator
Garfield County School District 16