Thursday, July 14, 2011

WLST Removing and Adding Groups

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

groups = ['companya', 'companyb']
groupcomment = 'If you work for this company you need this group'

for group in groups:
    print 'delete the old one if exists'
    try:
        atnr.removeGroup(group)
    except:
        print '*************** CANNOT DELETE !!! Check If The Group With the Name : ' , group ,' Exists or NOT...'

for group in groups:
    print 'create group:' , group
    atnr.createGroup(group,groupcomment)

 

Till Next Time

No comments:

Post a Comment