biemond/biemond-orawls

View on GitHub
files/providers/wls_jms_security_policy/destroy.py.erb

Summary

Maintainability
Test Coverage
from weblogic.security.service import JMSResource

# check the domain else we need to skip this (done in wls_access.rb)
real_domain='<%= domain %>'


authorizationprovider = '<%= authorizationprovider %>'
jmsmodule             = '<%= jmsmodule %>'
destinationtype       = '<%= destinationtype %>'
resourcename          = '<%= resourcename %>'
action                = '<%= action %>'

if action == 'all':
  actionname = None
else:
  actionname = action

try:
    cd('/')
    securityRealm = cmo.getSecurityConfiguration().getDefaultRealm()
    authorizer = securityRealm.lookupAuthorizer(authorizationprovider)
    resource = weblogic.security.service.JMSResource(jmsmodule, destinationtype, resourcename, actionname)
    resourceId = resource.toString()
    authorizer.removePolicy(resourceId)

    report_back_success()

except:
    report_back_error_without_undo