User Attributes

I can run the following script to gather a list of users in my database:

User user
for user in userList do {
string uName = user.name
print uName "\n"
}
what I'd like to be able to do is see when each user was created, datewise. is there a function to do that? append to the code above with attributes like "created on" like a module?

thanks
Rich_Mason - Thu Oct 21 09:08:32 EDT 2010

Re: User Attributes
llandale - Thu Oct 21 11:40:31 EDT 2010

You can write a program that browses all the users, and for those that do not yet have a createdDate associated with them then set it to that value. If that script runs everyday you can indeed keep track of create date, from the time of the script forward.

Doing that requires use of the very poorly documented notion of 'user defined attributes', as per the DXL manual section "Group and user management" chapter "Rational DOORS database access"; these commands:

for property in user     for property in user do {...}
isAttribute (user)      bool isAttribute(User user, string property) 
delete (user property)  void delete(User user, string property) 
get (user property)     string get(User user, string property) 
set (user property)     void set(User user, string property, string value)


The next commands 'setGroup' and 'setUser' are for STANDARD properties show in the table at the top of the section, e.g. 'systemLoginName'.

The management code may have a snippette like this:

 

string c_NameCreatedDate = "Created On"
User usr = find(NameUser)
if (!isAttribute(usr, c_NameCreatedDate) or
    null get(usr, c_NameCreatedDate)) //-
then set(usr, c_NameCreatedDate, today())


Another code snippette may look like this:

 

 

loadDirectory()
string Created, Name
for usr in userList do
{  if (!isAttribute(usr, c_NameCreatedDate) or
       null get(usr, c_NameCreatedDate)) //-
   then Created = "Unknown"
   else Created = get(usr,c_NameCreatedDate)
   Name = usr.name
   print Name "\tCreate On " Created "\n"
}


A reasonably realistic way to install the above code

Before I came up with the above solution, I had a little luck predicting when a user was created by looking at the user's with neighboring User IDs. If user A with ID 3 existed at a certain time and user C with ID 5 existed at a certain time, then I know that user B with ID 4 must have been created between those times.

If you write the above script and want to reasonable predict WHEN old users were actually created, you could quite reasonably look through ALL history in the database looking for each user's name, taking the oldest history associated with that user as the create date for that user. That would work unless the user was renamed. There may be too much data in the database and any such script would need to have a single Project as the scope, updating a user's create date when an Older History was found for that user. For each module you would open each and every Baseline; and for every baseline Module look through 'all' History.

 

 

 

  • Louie

 

 

Re: User Attributes
Rich_Mason - Thu Oct 21 12:07:51 EDT 2010

thanks for the ideas Louie

Re: User Attributes
Mathias Mamsch - Thu Oct 21 13:42:26 EDT 2010

I am pretty sure that DOORS will not store the creation date of a user. It will also not log deletions, additions of users. So I guess there won't be some magic DXL to do that. What you can do is get the date, when the password was last changed. But I think that is it. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: User Attributes
PaulHutchinson - Fri Oct 22 08:43:12 EDT 2010

Although DOORS does not expose the user "creation date" it can be obtained and exposed in DOORS:

1. Obtain the hexadecimal IDs (User.identifier) of existing users
2. Find the corresponding config files on the server (e.g \v6data\users\u00000000000000b7.DTC)
3. Consult the file creation date of each user's DTC file
4. Store the dates in a user-defined user attribute (see Louie's comment above)

Obviously the "last modified date" can also be obtained this way.

Paul

Re: User Attributes
Rich_Mason - Tue Oct 26 13:53:22 EDT 2010

thanks for all the input. in my infinite free time I'll get around to trying. Best, Rich.