WLST Script to add users, groups and modify roles

connect(‘weblogic’,’weblogic’,’t3://localhost:7001′)
edit()
startEdit(-1,-1,’false’)
serverConfig()
cd(‘/SecurityConfiguration/First_Domain/Realms/myrealm/AuthenticationProviders/DefaultAuthenticator’)
cmo.createUser(‘faisal’,’weblogic’,”)
cmo.groupExists(‘TestGrp’)
cmo.createGroup(‘TestGrp’,”)
cmo.addMemberToGroup(‘testgrp’,’faisal’)
cd(‘/SecurityConfiguration/First_Domain/Realms/myrealm/RoleMappers/XACMLRoleMapper’)
cmo.setRoleExpression(”,’Admin’,’Grp(TestGrp)|Grp(Administrators)’)
edit()
undo(defaultAnswer=’y’, unactivatedChanges=’true’)
stopEdit(‘y’)