Created
February 7, 2018 16:33
-
-
Save andrealmar/8ba10c41cab2244752df0fad359a9e64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TO RUN the WLST script just type the command below: | |
# /webtools/oracle/plat1200_1/middleware/oracle_common/common/bin/wlst.sh weblogic_ad_users.py | |
# Author: ANDRE ALMAR | |
servidor = raw_input('Digite o servidor: ') | |
porta = raw_input('Digite a porta: ') | |
usuario = raw_input('Digite o usuario: ') | |
password = raw_input('Digite o password: ') | |
roles = ['Deployer', 'Monitor', 'Operator', 'IntegrationDeployer', 'IntegrationMonitor', 'IntegrationOperator'] | |
connect(usuario,password,'t3://' + servidor + ':' + porta ) | |
serverConfig() | |
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm/RoleMappers/XACMLRoleMapper') | |
f = open('users.csv') | |
for line in f.readlines(): | |
items = line.split(',') | |
for role in roles: | |
try: | |
expr = cmo.getRoleExpression('', role) | |
print 'Usr(' + line + ') was assigned to role ' + role | |
cmo.setRoleExpression('', role, 'Usr(' + line + ') | ' + expr) | |
except: | |
print "Role " + role + " doesn't exist" | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment