Hi, |
Re: Adding new users with non-expired passwords in batch mode
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 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
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. |