Friday, April 5, 2013

Auomation of "Mapping of Logical Role to BPM Roles"

Script to automate "Logical group to BPM Access role mapping" is working succesfully .




Please find the below location of the script name and the syntax to execute the script



Location : /home/soast01/WLST_TP/Create_AccessRoles

Script Name : Create_AccessRoles_BPM.sh





Note:



Please modify the property file /home/soast01/WLST_TP/Create_AccessRoles/Access_Role.properties, according to the requirement ..







To test I am trying to add 2 groups

1. gr gg  usr eur Level 2_DIT ,

2. gr gg usr eur Level 3_DIT

to the BPM Process Role -> CreateTelephoneApplication.CustomerService



So in this case we have to modify the property file Access_Role.properties, with the above 2 groups and the BPM Process Role

groups gr gg usr eur Level 2_DIT , gr gg usr eur Level 3_DIT to the BPM Process Role , CreateTelephoneApplication.CustomerService .

Also Admin URL,username , password and total number of groups should be mentioned .





Syntax :



Create_AccessRoles_BPM.sh



1. cat //WLST_TP/Create_AccessRoles/Access_Role.properties

admin.url=t3s://mlx123:25454

admin.userName=weblogic

admin.password=pwd



total.GROUPS=3



group.name.1 = gr gg usr eur Level 2_DIT



user.soarole.1 = CreateApplication.CustomerService





user.soarole.2 = CreateApplication.CustomerService

group.name.2 = gr gg usr eur Level 3_DIT



#Comma seperated roles

2.  cat Create_AccessRoles_BPM.sh

#!/bin/bash

#Author Mohammed Ashraf TP

#Date MARCH 18 2013

# ************* Setting the Environment ***********************

DOMAIN_HOME="/var/domain/soa_st01/soa_st01_Domain/"

. ${DOMAIN_HOME}/bin/setDomainEnv.sh $*



export CLASSPATH=/var/domain/soa_st01/WEBLOGIC_HOME/server/lib/weblogic.jar



echo "Environment has been set....."



# ************* Changing the directory where all the related files are needed ***********************

cd /home/soa01/WLST_TP/Create_AccessRoles



echo "Calling the PYTHON script....."



# ************* Calling the WLST script *****************



export CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true -Dweblogic.security.TrustKeyStore=CustomTrust -Dweblogic.security.CustomTrustKeyStoreFileName=/var/domain/soa_01/keystore/TrustKeyStore.jks -Dweblogic.security.CustomTrustKeyStorePassPhrase=wpwd -Dweblogic.security.CustomTrustKeyStoreType=JKS -Dweblogic.security.SSL.allowSmallRSAExponent=true"



/opt/Oracle/Middleware/Oracle_SOA1/common/bin/wlst.sh /home/soa/WLST_TP/Create_AccessRoles/AccessRoles_BPM.py $1 $2 $3


3.
[soast01@ngmlx476 Create_AccessRoles]$ cat AccessRoles_BPM.py


#!/usr/bin/python



from java.io import FileInputStream



from java.util import *



from javax.management import *



import sys



import re



import os



import pdb



propInputStream = FileInputStream("/home/soast01/WLST_TP/Create_AccessRoles/Access_Role.properties")



configProps = Properties()



configProps.load(propInputStream)



adminURL=configProps.get("admin.url")



adminUserName=configProps.get("admin.userName")



adminPassword=configProps.get("admin.password")



totalnumberofGROUPS=configProps.get("total.GROUPS")



connect(adminUserName, adminPassword, adminURL)



domainRuntime()



print 'Adding SOA Roles Membership of the Users:'



counter = 1



print counter



print totalnumberofGROUPS



print adminURL

print adminUserName

print adminPassword



count = 1

while count < int(totalnumberofGROUPS):

roleName = configProps.get("user.soarole." + str(count))

#groupName = configProps.get("group.name." + str(count)).split(",")

groupName = configProps.get("group.name." + str(count))

count = count + 1

print roleName

print groupName

grantAppRole(appStripe="OracleBPMProcessRolesApp",appRoleName=roleName ,principalClass="weblogic.security.principal.WLSGroupImpl",principalName=groupName)





disconnect()



exit()

No comments:

Post a Comment