Search This Blog

Oracle Fusion Middleware Administration Course

Oracle Fusion Middleware Administration Course
OFMW Admin Course

Sunday, January 17, 2016

Multitenancy in WebLogic 12c Part -2: Create User and Group per Domain Partition

def create_userGroup(realmName, userName, groupName):
 cd('/')
 print 'add user: r
ealmName ' + realmName
 if realmName == 'DEFAULT_REALM':
   realm = cmo.getSecurityConfiguration().getDefaultRealm()
 else:
   realm = cmo.getSecurityConfiguration().lookupRealm(realmName)
 print "Creating user " + userName + " in realm: " + realm.getName()
 atn = realm.lookupAuthenticationProvider('ATNPartition')
 if atn.userExists(userName):
   print "User already exists."
 else:
   atn.createUser(userName, '${password}', realmName + ' Realm User')
 print "Done creating user. ${password}"
 print "Creating group " + groupName + " in realm: " + realm.getName()
 if atn.groupExists(groupName):
   print "Group already exists."
 else:
   atn.createGroup(groupName, realmName + ' Realm Group')
 if atn.isMember(groupName,userName,true) == 0:
   atn.addMemberToGroup(groupName, userName)
 else:
   print "User is already member of the group."
def main():
 connect("weblogic","welcome1","t3://192.168.33.100:6100")

 create_userGroup('Online_Realm', 'mt_adm1','Administrator')
 create_userGroup('Corporate_Realm', 'mt_adm2','Administrator')

 disconnect()

main()


Note: Remember this important point when you modify a security related configurations we should not use edit() or startEdit(). We are good to go lets execute the script...


wlst createUserGroups.py
create User and Group per Domain partition using WLST

WebLogic Admin Console sreen User configuration for Partitioned Domain

No comments:

Facebook Blogger Plugin: By RNHckr.com

Post a Comment

Please write your comment here

Popular Posts

Oracle WebLogic Administration Course

Oracle WebLogic Administration Course
WebLogic Training

Followers