사용자가 특정 그룹에 속하는지 확인하는 WLST 스크립트를 만들었습니다. 쉘 스크립트는 사용자 및 그룹 이름에 대한 입력을 읽고 파이썬 스크립트로 보냅니다. 이것은 python 스크립트입니다.
d_user=sys.argv[1]
print 'User is ' +d_user
d_group=sys.argv[2]
print 'Group is ' +d_group
connect(userConfigFile='WebLogicConfig.properties',userKeyFile='WebLogicKey.properties',url='t3://wl-test.com:80')
realmName=cmo.getSecurityConfiguration().getDefaultRealm()
authProvider = realmName.getAuthenticationProviders()
from weblogic.management.security.authentication import GroupEditorMBean
print "Checking if 'd_user' is a member of the group 'd_group' ... "
atnr=cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider("DefaultAuthenticator")
if atnr.isMember('d_group','d_user',true) == 0:
print "+d_user is not member of +d_group"
else:
print "+d_user is a member of +d_group"
다음은 출력입니다.
./UserGroupCheck.sh
Enter the user name you want to check : weblogic
Enter the group name you want to check for weblogic : Administrators
CLASSPATH=...
PATH=...
Your environment has been set.
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
User is weblogic
Group is Administrators
Connecting to t3://wl-test.com:80 with userid weblogic ...
Successfully connected to Admin Server..
...
Checking if 'd_user' is a member of the group 'd_group' ...
Problem invoking WLST - Traceback (innermost last):
File "UserGroupCheck.py", line 20, in ?
weblogic.management.utils.NotFoundException: [Security:090259]Group d_group can not be found.
at weblogic.utils.StackTraceDisabled.unknownMethod()
weblogic.management.utils.NotFoundException: weblogic.management.utils.NotFoundException: [Security:090259]Group d_group can not be found.
그룹을 찾을 수 없다는 불평은 실패합니다 . 파이썬 스크립트의 변수를 받아 들일 수 d_user
및 d_group
이 WebLogic 도메인에 연결되어 있지만, 일단 처음에, 주어진 값을 인식 할 수없는 d_user
&를 d_group
대신 실제 입력으로 변수 이름을합니다.
Checking if 'd_user' is a member of the group 'd_group'
d_user
& d_group
를 실제 사용자 및 그룹으로 바꾸면 스크립트가 제대로 작동합니다 .
내가 간과 한 것이 무엇인지 알 수 없다.
인용구
atnr.isMember('d_group','d_user',true)
문제는 :
atnr.isMember(d_group,d_user,true)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다