Adding new users with non-expired passwords in batch mode

Hi,
I have a use case where I need to create from DXL code new DOORS users for which the name and password is known and fixed (the password is not to be edited by the user). Might sound strange, but that's my use case.
The creation is performed in batch mode.
I succeeded to support this scenario using the addUser(name, password, uid) function (yeah, I know, it is deprecated).
But whatever I do, when the created user logs in for the first time, DOORS says his password has expired and forces him to re-enter it (old + new password, which can actually be the same).
This is probably a reasonable behavior, regarding security consideration, but it doesn't fit my need.
Is there any way I can force the password to be non-changeable and non-expired and have the user to log-in without facing this dialog?

Thanks,
Sebastien
sboucard - Tue Oct 30 13:53:18 EDT 2012

Re: Adding new users with non-expired passwords in batch mode
Mathias Mamsch - Wed Oct 31 05:13:40 EDT 2012

The following works for me:
 

User u 
 
// delete the user if it exists
if (existsUser ("testuser")) {
   u = find("testuser")
   deleteUser u
}
 
if (existsUser("testuser")) {
   error "Could not delete testuser ..."
}
 
// add the user
string s = addUser("testuser", "hisSystemLogin")
saveDirectory() 
 
// Now set the password and forbid him to change his password
loadDirectory()
if (!existsUser "testuser") { error "Could not create test user:" s}
u = find("testuser")
u.password = "MyPassword" 
u.passwordMayChange = false
 
saveDirectory()

 

 


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

 

 

Re: Adding new users with non-expired passwords in batch mode
sboucard - Wed Oct 31 07:37:13 EDT 2012

Mathias Mamsch - Wed Oct 31 05:13:40 EDT 2012

The following works for me:
 

User u 
 
// delete the user if it exists
if (existsUser ("testuser")) {
   u = find("testuser")
   deleteUser u
}
 
if (existsUser("testuser")) {
   error "Could not delete testuser ..."
}
 
// add the user
string s = addUser("testuser", "hisSystemLogin")
saveDirectory() 
 
// Now set the password and forbid him to change his password
loadDirectory()
if (!existsUser "testuser") { error "Could not create test user:" s}
u = find("testuser")
u.password = "MyPassword" 
u.passwordMayChange = false
 
saveDirectory()

 

 


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

 

 

Excellent, that works! Mathias, you're my rock star ;-)
Since I originally set the password directly using the addUser() function, I wrongly assumed I didn't need to set it again through the User.password property.
Many thanks.