Script to Display User/Group and RoleName in a Weblogic Middleware Domain
OUTPUT
GROUPS # Grp(JNDI_GROUP)=====> ROLENAME # PavanROletest
GROUPS # Grp(Deployers)=====> ROLENAME # Deployer
GROUPS # Grp(AppTesters)=====> ROLENAME # AppTester
GROUPS # Grp(OracleSystemGroup)=====> ROLENAME # OracleSystemRole
GROUPS # Grp(CrossDomainConnectors)=====> ROLENAME # CrossDomainConnector
GROUPS # Grp(Monitors)=====> ROLENAME # Monitor
GROUPS # Usr(projectuser)=====> ROLENAME # PROJECT1_ROLE
GROUPS # Grp(JMSGroup)|Grp(JNDI_GROUP)=====> ROLENAME # JNDI_BIND_ROLE
GROUPS # Grp(everyone)=====> ROLENAME # Anonymous
GROUPS # Grp(Administrators)=====> ROLENAME # Admin
GROUPS # Grp(Operators)=====> ROLENAME # Operator
GROUPS # Grp(AdminChannelUsers)=====> ROLENAME # AdminChannelUser
from weblogic.management.security.authentication import UserReaderMBean from weblogic.management.security.authentication import GroupReaderMBean from weblogic.management.security.authentication import MemberGroupListerMBean from weblogic.security.providers.authentication import DefaultAuthenticatorMBean from weblogic.management.security.authentication import AuthenticationProviderMBean from weblogic.management.security.authentication import GroupEditorMBean from weblogic.management.utils import NameListerMBean from weblogic.management.security.authorization import RoleMapperMBean from weblogic.security.providers.xacml.authorization import XACMLAuthorizerMBean from weblogic.management.utils import PropertiesListerMBean from weblogic.management.security.authorization import RoleReaderMBean from weblogic.security.providers.xacml.authorization import XACMLRoleMapperMBean connect() realm1=cmo.getSecurityConfiguration().getDefaultRealm() atns = realm1.getRoleMappers() realm=cmo.getSecurityConfiguration().getDefaultRealm().lookupRoleMapper("XACMLRoleMapper") print realm realm1=cmo.getSecurityConfiguration().getDefaultRealm() atns = realm1.getRoleMappers() for rolemapper in atns: realm=cmo.getSecurityConfiguration().getDefaultRealm().lookupRoleMapper(rolemapper.getName()) print realm for i in atns: if isinstance(i,XACMLRoleMapperMBean): userReader = i print "here" cursor = i.listAllRoles(0) print 'roles are: ' while userReader.haveCurrent(cursor): roleObj = userReader.getCurrentProperties(cursor) #print roleObj.get('ResourceId') if ( roleObj.get('ResourceId') == None ): print "GROUPS # "+roleObj.get('Expression')+"=====> "+"ROLENAME # "+roleObj.get('RoleName') userReader.advance(cursor) userReader.close(cursor)
OUTPUT
GROUPS # Grp(JNDI_GROUP)=====> ROLENAME # PavanROletest
GROUPS # Grp(Deployers)=====> ROLENAME # Deployer
GROUPS # Grp(AppTesters)=====> ROLENAME # AppTester
GROUPS # Grp(OracleSystemGroup)=====> ROLENAME # OracleSystemRole
GROUPS # Grp(CrossDomainConnectors)=====> ROLENAME # CrossDomainConnector
GROUPS # Grp(Monitors)=====> ROLENAME # Monitor
GROUPS # Usr(projectuser)=====> ROLENAME # PROJECT1_ROLE
GROUPS # Grp(JMSGroup)|Grp(JNDI_GROUP)=====> ROLENAME # JNDI_BIND_ROLE
GROUPS # Grp(everyone)=====> ROLENAME # Anonymous
GROUPS # Grp(Administrators)=====> ROLENAME # Admin
GROUPS # Grp(Operators)=====> ROLENAME # Operator
GROUPS # Grp(AdminChannelUsers)=====> ROLENAME # AdminChannelUser
No comments:
Post a Comment