Thursday, July 14, 2011

WLST Removing and Adding Users

#
# Removing and Adding Users using WLST (online)
# John Minkjan Ciber Netherlands
#
print 'lookup DefaultAuthenticator'
atnr=cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider('DefaultAuthenticator')

group = 'companya'
password = 'Welcome1'
users = ['user1','user2']
# delete the "old" users
for user in users:   
    try:
        print 'working user: ',user
        atnr.removeUser (user)
    except:
        pass

# Create the "new" users
users = ['user1','user2']
for user in users:           
    try:       
        print 'create user: ',user
        atnr.createUser(user,password,user)
    except:
        pass

Till Next Time

No comments:

Post a Comment