|
Author: adrianc
Date: Wed Jul 11 16:34:26 2012 New Revision: 1360283 URL: http://svn.apache.org/viewvc?rev=1360283&view=rev Log: Removed unused "authz" security code - https://issues.apache.org/jira/browse/OFBIZ-4839. Removed: ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/da/ ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/test/ ofbiz/trunk/applications/securityext/testdef/ ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/ Modified: ofbiz/trunk/applications/securityext/ofbiz-component.xml ofbiz/trunk/applications/securityext/servicedef/services.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/scripting/ContextHelper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java ofbiz/trunk/framework/security/data/SecurityGroupDemoData.xml ofbiz/trunk/framework/security/entitydef/entitymodel.xml ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl ofbiz/trunk/themes/flatgrey/includes/appbar.ftl ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl Modified: ofbiz/trunk/applications/securityext/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/securityext/ofbiz-component.xml?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/applications/securityext/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/securityext/ofbiz-component.xml Wed Jul 11 16:34:26 2012 @@ -26,5 +26,4 @@ under the License. <classpath type="dir" location="config"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/UserDemoData.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> - <test-suite loader="main" location="testdef/securitytests.xml"/> </ofbiz-component> Modified: ofbiz/trunk/applications/securityext/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/securityext/servicedef/services.xml?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/applications/securityext/servicedef/services.xml (original) +++ ofbiz/trunk/applications/securityext/servicedef/services.xml Wed Jul 11 16:34:26 2012 @@ -36,23 +36,4 @@ under the License. <attribute name="alias" type="String" mode="IN" optional="false"/> </service> - <!-- authorization dynamic access implementation API --> - <service name="dynamicAccessInterface" engine="interface"> - <description>Service interface for implementing Dynamic Access as a service</description> - <attribute name="userId" type="String" mode="IN" optional="false"/> - <attribute name="permission" type="String" mode="IN" optional="false"/> - <attribute name="accessString" type="String" mode="IN" optional="false"/> - <attribute name="permissionContext" type="Map" mode="IN" optional="true"/> - <attribute name="permissionGranted" type="Boolean" mode="OUT" optional="false"/> - </service> - - <!-- dynamic access test service --> - <service name="dynamicAccessTestService" engine="simple" auth="false" - location="component://securityext/testdef/da/DynamicAccessTest.xml" invoke="testDa"> - <implements service="dynamicAccessInterface"/> - </service> - <service name="dynamicAccessRecursiveTest" engine="simple" auth="false" - location="component://securityext/testdef/da/DynamicAccessTest.xml" invoke="testDaRecursion"> - <implements service="dynamicAccessInterface"/> - </service> </services> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/scripting/ContextHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/scripting/ContextHelper.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/scripting/ContextHelper.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/scripting/ContextHelper.java Wed Jul 11 16:34:26 2012 @@ -40,7 +40,6 @@ import org.ofbiz.base.util.string.Flexib import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; @@ -78,10 +77,6 @@ public final class ContextHelper { return FlexibleStringExpander.expandString(original, getBindings()); } - public Authorization getAuthz() { - return (Authorization) this.context.getAttribute("authz"); - } - public Map<String, Object> getBindings() { return this.context.getBindings(ScriptContext.ENGINE_SCOPE); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Wed Jul 11 16:34:26 2012 @@ -127,7 +127,7 @@ public final class SimpleMethod extends Map<String, SimpleMethod> simpleMethods = FastMap.newInstance(); Document document = null; try { - document = UtilXml.readXmlDocument(content, true, true); + document = UtilXml.readXmlDocument(content, MiniLangValidate.validationOn(), true); } catch (Exception e) { throw new MiniLangException("Could not read SimpleMethod XML document [" + name + "]: ", e); } @@ -139,7 +139,7 @@ public final class SimpleMethod extends Map<String, SimpleMethod> simpleMethods = FastMap.newInstance(); Document document = null; try { - document = UtilXml.readXmlDocument(xmlURL, true, true); + document = UtilXml.readXmlDocument(xmlURL, MiniLangValidate.validationOn(), true); } catch (Exception e) { throw new MiniLangException("Could not read SimpleMethod XML document [" + xmlURL + "]: ", e); } @@ -211,7 +211,7 @@ public final class SimpleMethod extends } Document document = null; try { - document = UtilXml.readXmlDocument(xmlURL, true, true); + document = UtilXml.readXmlDocument(xmlURL, MiniLangValidate.validationOn(), true); } catch (Exception e) { throw new MiniLangException("Could not read SimpleMethod XML document [" + xmlURL + "]: ", e); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java Wed Jul 11 16:34:26 2012 @@ -35,7 +35,6 @@ import org.ofbiz.base.util.string.Flexib import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.LocalDispatcher; @@ -47,7 +46,6 @@ public final class MethodContext { public static final int EVENT = 1; public static final int SERVICE = 2; - private Authorization authz; private Delegator delegator; private LocalDispatcher dispatcher; private Map<String, Object> env = FastMap.newInstance(); @@ -72,7 +70,6 @@ public final class MethodContext { this.timeZone = (TimeZone) context.get("timeZone"); this.dispatcher = ctx.getDispatcher(); this.delegator = ctx.getDelegator(); - this.authz = ctx.getAuthorization(); this.security = ctx.getSecurity(); this.userLogin = (GenericValue) context.get("userLogin"); if (this.loader == null) { @@ -94,7 +91,6 @@ public final class MethodContext { this.timeZone = UtilHttp.getTimeZone(request); this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.delegator = (Delegator) request.getAttribute("delegator"); - this.authz = (Authorization) request.getAttribute("authz"); this.security = (Security) request.getAttribute("security"); this.userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); if (this.loader == null) { @@ -107,7 +103,7 @@ public final class MethodContext { } /** - * This is a very simple constructor which assumes the needed objects (dispatcher, delegator, authz, security, request, response, etc) are in the context. Will result in calling method as a + * This is a very simple constructor which assumes the needed objects (dispatcher, delegator, security, request, response, etc) are in the context. Will result in calling method as a * service or event, as specified. */ public MethodContext(Map<String, ? extends Object> context, ClassLoader loader, int methodType) { @@ -118,7 +114,6 @@ public final class MethodContext { this.timeZone = (TimeZone) context.get("timeZone"); this.dispatcher = (LocalDispatcher) context.get("dispatcher"); this.delegator = (Delegator) context.get("delegator"); - this.authz = (Authorization) context.get("authz"); this.security = (Security) context.get("security"); this.userLogin = (GenericValue) context.get("userLogin"); if (methodType == MethodContext.EVENT) { @@ -136,8 +131,6 @@ public final class MethodContext { this.dispatcher = (LocalDispatcher) this.request.getAttribute("dispatcher"); if (this.delegator == null) this.delegator = (Delegator) this.request.getAttribute("delegator"); - if (this.authz == null) - this.authz = (Authorization) this.request.getAttribute("authz"); if (this.security == null) this.security = (Security) this.request.getAttribute("security"); if (this.userLogin == null) @@ -153,10 +146,6 @@ public final class MethodContext { } } - public Authorization getAuthz() { - return this.authz; - } - public Delegator getDelegator() { return this.delegator; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java Wed Jul 11 16:34:26 2012 @@ -32,7 +32,6 @@ import org.ofbiz.minilang.artifact.Artif import org.ofbiz.minilang.method.MethodContext; import org.ofbiz.minilang.method.MethodOperation; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.w3c.dom.Element; /** @@ -75,16 +74,15 @@ public final class HasPermissionConditio public boolean checkCondition(MethodContext methodContext) throws MiniLangException { GenericValue userLogin = methodContext.getUserLogin(); if (userLogin != null) { + Security security = methodContext.getSecurity(); String permission = permissionFse.expandString(methodContext.getEnvMap()); String action = actionFse.expandString(methodContext.getEnvMap()); if (!action.isEmpty()) { - Security security = methodContext.getSecurity(); if (security.hasEntityPermission(permission, action, userLogin)) { return true; } } else { - Authorization authz = methodContext.getAuthz(); - if (authz.hasPermission(userLogin.getString("userLoginId"), permission, methodContext.getEnvMap())) { + if (security.hasPermission(permission, userLogin)) { return true; } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java Wed Jul 11 16:34:26 2012 @@ -35,7 +35,6 @@ import org.ofbiz.minilang.method.Message import org.ofbiz.minilang.method.MethodContext; import org.ofbiz.minilang.method.MethodOperation; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.w3c.dom.Element; /** @@ -78,12 +77,11 @@ public final class CheckPermission exten boolean hasPermission = false; GenericValue userLogin = methodContext.getUserLogin(); if (userLogin != null) { - Authorization authz = methodContext.getAuthz(); Security security = methodContext.getSecurity(); - hasPermission = this.primaryPermissionInfo.hasPermission(methodContext, userLogin, authz, security); + hasPermission = this.primaryPermissionInfo.hasPermission(methodContext, userLogin, security); if (!hasPermission && altPermissionInfoList != null) { for (PermissionInfo altPermInfo : altPermissionInfoList) { - if (altPermInfo.hasPermission(methodContext, userLogin, authz, security)) { + if (altPermInfo.hasPermission(methodContext, userLogin, security)) { hasPermission = true; break; } @@ -147,7 +145,7 @@ public final class CheckPermission exten this.actionFse = FlexibleStringExpander.getInstance(element.getAttribute("action")); } - private boolean hasPermission(MethodContext methodContext, GenericValue userLogin, Authorization authz, Security security) { + private boolean hasPermission(MethodContext methodContext, GenericValue userLogin, Security security) { String permission = permissionFse.expandString(methodContext.getEnvMap()); String action = actionFse.expandString(methodContext.getEnvMap()); if (!action.isEmpty()) { @@ -155,7 +153,7 @@ public final class CheckPermission exten return security.hasEntityPermission(permission, action, userLogin); } else { // run hasPermission - return authz.hasPermission(userLogin.getString("userLoginId"), permission, methodContext.getEnvMap()); + return security.hasPermission(permission, userLogin); } } } Modified: ofbiz/trunk/framework/security/data/SecurityGroupDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/data/SecurityGroupDemoData.xml?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/security/data/SecurityGroupDemoData.xml (original) +++ ofbiz/trunk/framework/security/data/SecurityGroupDemoData.xml Wed Jul 11 16:34:26 2012 @@ -26,22 +26,6 @@ under the License. <SecurityGroup groupId="VIEWADMIN" description="Demo Admin group, has all view permissions."/> <SecurityGroup groupId="BIZADMIN" description="Full Business Applications permission group, has all business app admin permissions, not technical permissions."/> - <!-- Security 2.0 base permissions --> - <SecurityPermission permissionId="access" description="Base ACCESS permission"/> - <SecurityPermission permissionId="create" description="Base CREATE permission"/> - <SecurityPermission permissionId="read" description="Base READ permission"/> - <SecurityPermission permissionId="update" description="Base UPDATE permission"/> - <SecurityPermission permissionId="delete" description="Base DELETE permission"/> - - <!-- base permissions to groups --> - <SecurityGroupPermission groupId="FULLADMIN" permissionId="access"/> - <SecurityGroupPermission groupId="FULLADMIN" permissionId="create"/> - <SecurityGroupPermission groupId="FULLADMIN" permissionId="read"/> - <SecurityGroupPermission groupId="FULLADMIN" permissionId="update"/> - <SecurityGroupPermission groupId="FULLADMIN" permissionId="delete"/> - <SecurityGroupPermission groupId="VIEWADMIN" permissionId="access"/> - <SecurityGroupPermission groupId="VIEWADMIN" permissionId="read"/> - <!-- general admin tools permission --> <SecurityPermission description="Permission to access the Stock OFBiz Manager Applications." permissionId="OFBTOOLS_VIEW"/> <SecurityGroupPermission groupId="FULLADMIN" permissionId="OFBTOOLS_VIEW"/> Modified: ofbiz/trunk/framework/security/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/entitydef/entitymodel.xml?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/security/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/framework/security/entitydef/entitymodel.xml Wed Jul 11 16:34:26 2012 @@ -157,21 +157,8 @@ under the License. title="Security Component - Security Permission Entity"> <field name="permissionId" type="id-long-ne"></field> <field name="description" type="description"></field> - <field name="dynamicAccess" type="value"></field> <prim-key field="permissionId"/> </entity> - <entity entity-name="SecurityPermissionAutoGrant" - package-name="org.ofbiz.security.securitygroup" - default-resource-name="SecurityEntityLabels" - title="Security Component - Security Permission Auto Grant Entity"> - <field name="permissionId" type="id-long-ne"></field> - <field name="grantPermission" type="id-vlong-ne"></field> - <prim-key field="permissionId"/> - <prim-key field="grantPermission"/> - <relation type="one" fk-name="SEC_PERM_AUTO_GRNT" rel-entity-name="SecurityPermission"> - <key-map field-name="permissionId"/> - </relation> - </entity> <view-entity entity-name="UserLoginAndSecurityGroup" package-name="org.ofbiz.security.securitygroup" never-cache="true" Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Wed Jul 11 16:34:26 2012 @@ -44,7 +44,6 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.entity.Delegator; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.config.ServiceConfigUtil; import org.ofbiz.service.eca.ServiceEcaUtil; import org.w3c.dom.Document; @@ -253,14 +252,6 @@ public class DispatchContext implements } /** - * Gets the Authorization object associated with this dispatcher - * @return Authorization object associated with this dispatcher - */ - public Authorization getAuthorization() { - return dispatcher.getAuthorization(); - } - - /** * Gets the Security object associated with this dispatcher * @return Security object associated with this dispatcher */ Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java Wed Jul 11 16:34:26 2012 @@ -29,7 +29,6 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.jms.JmsListenerFactory; import org.ofbiz.service.job.JobManager; import org.ofbiz.service.job.JobManagerException; @@ -214,16 +213,8 @@ public abstract class GenericAbstractDis } /** - * @see org.ofbiz.service.LocalDispatcher#getAuthorization() - */ - public Authorization getAuthorization() { - return dispatcher.getAuthorization(); - } - - /** * @see org.ofbiz.service.LocalDispatcher#getSecurity() */ - @Deprecated public Security getSecurity() { return dispatcher.getSecurity(); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java Wed Jul 11 16:34:26 2012 @@ -22,7 +22,6 @@ import java.util.Map; import org.ofbiz.entity.Delegator; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.jms.JmsListenerFactory; import org.ofbiz.service.job.JobManager; @@ -319,11 +318,6 @@ public interface LocalDispatcher { */ public Delegator getDelegator(); - /** - * Gets the Authorization object associated with this dispatcher - * @return Authorization object associated with this dispatcher - */ - public Authorization getAuthorization(); /** * Gets the Security object associated with this dispatcher Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java Wed Jul 11 16:34:26 2012 @@ -27,7 +27,6 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; /** * Service Permission Model Class @@ -53,7 +52,6 @@ public class ModelPermission implements public boolean evalPermission(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue userLogin = (GenericValue) context.get("userLogin"); - Authorization authz = dctx.getAuthorization(); Security security = dctx.getSecurity(); if (userLogin == null) { Debug.logInfo("Secure service requested with no userLogin object", module); @@ -61,7 +59,7 @@ public class ModelPermission implements } switch (permissionType) { case PERMISSION: - return evalAuthzPermission(authz, userLogin, context); + return evalSimplePermission(security, userLogin); case ENTITY_PERMISSION: return evalEntityPermission(security, userLogin); case ROLE_MEMBER: @@ -74,12 +72,12 @@ public class ModelPermission implements } } - private boolean evalAuthzPermission(Authorization authz, GenericValue userLogin, Map<String, ? extends Object> context) { + private boolean evalSimplePermission(Security security, GenericValue userLogin) { if (nameOrRole == null) { Debug.logWarning("Null permission name passed for evaluation", module); return false; } - return authz.hasPermission(userLogin.getString("userLoginId"), nameOrRole, context); + return security.hasPermission(nameOrRole, userLogin); } private boolean evalEntityPermission(Security security, GenericValue userLogin) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Wed Jul 11 16:34:26 2012 @@ -45,8 +45,6 @@ import org.ofbiz.entity.transaction.Tran import org.ofbiz.security.Security; import org.ofbiz.security.SecurityConfigurationException; import org.ofbiz.security.SecurityFactory; -import org.ofbiz.security.authz.Authorization; -import org.ofbiz.security.authz.AuthorizationFactory; import org.ofbiz.service.config.ServiceConfigUtil; import org.ofbiz.service.eca.ServiceEcaRule; import org.ofbiz.service.eca.ServiceEcaUtil; @@ -79,7 +77,6 @@ public class ServiceDispatcher { protected Delegator delegator = null; protected GenericEngineFactory factory = null; - protected Authorization authz = null; protected Security security = null; protected Map<String, DispatchContext> localContext = null; protected Map<String, List<GenericServiceCallback>> callbacks = null; @@ -98,7 +95,6 @@ public class ServiceDispatcher { if (delegator != null) { try { - this.authz = AuthorizationFactory.getInstance(delegator); this.security = SecurityFactory.getInstance(delegator); } catch (SecurityConfigurationException e) { Debug.logError(e, "[ServiceDispatcher.init] : No instance of security implementation found.", module); @@ -810,18 +806,9 @@ public class ServiceDispatcher { } /** - * Gets the Authorization object associated with this dispatcher - * @return Authorization object associated with this dispatcher - */ - public Authorization getAuthorization() { - return this.authz; - } - - /** * Gets the Security object associated with this dispatcher * @return Security object associated with this dispatcher */ - @Deprecated public Security getSecurity() { return this.security; } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java Wed Jul 11 16:34:26 2012 @@ -25,7 +25,6 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; -import org.ofbiz.security.authz.AbstractAuthorization; import org.ofbiz.service.config.ServiceConfigUtil; /** @@ -270,9 +269,6 @@ public class JobInvoker implements Runna // increment the count count++; if (Debug.verboseOn()) Debug.logVerbose("Invoker: " + thread.getName() + " (" + count + ") total.", module); - - // reset thread local security - AbstractAuthorization.clearThreadLocal(); } long diff = (new Date().getTime() - this.getTime()); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Wed Jul 11 16:34:26 2012 @@ -61,9 +61,6 @@ import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.security.SecurityConfigurationException; import org.ofbiz.security.SecurityFactory; -import org.ofbiz.security.authz.AbstractAuthorization; -import org.ofbiz.security.authz.Authorization; -import org.ofbiz.security.authz.AuthorizationFactory; import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.LocalDispatcher; @@ -110,8 +107,6 @@ public class ContextFilter implements Fi getServerId(); // initialize the delegator getDelegator(config.getServletContext()); - // initialize authorizer - getAuthz(); // initialize security getSecurity(); // initialize the services dispatcher @@ -305,12 +300,9 @@ public class ContextFilter implements Fi config.getServletContext().setAttribute("delegator", delegator); // clear web context objects - config.getServletContext().setAttribute("authz", null); config.getServletContext().setAttribute("security", null); config.getServletContext().setAttribute("dispatcher", null); - // initialize authorizer - getAuthz(); // initialize security Security security = getSecurity(); // initialize the services dispatcher @@ -335,9 +327,6 @@ public class ContextFilter implements Fi // we're done checking; continue on chain.doFilter(httpRequest, httpResponse); - - // reset thread local security - AbstractAuthorization.clearThreadLocal(); } /** @@ -419,27 +408,6 @@ public class ContextFilter implements Fi return delegator; } - protected Authorization getAuthz() { - Authorization authz = (Authorization) config.getServletContext().getAttribute("authz"); - if (authz == null) { - Delegator delegator = (Delegator) config.getServletContext().getAttribute("delegator"); - - if (delegator != null) { - try { - authz = AuthorizationFactory.getInstance(delegator); - } catch (SecurityConfigurationException e) { - Debug.logError(e, "[ServiceDispatcher.init] : No instance of authorization implementation found.", module); - } - } - config.getServletContext().setAttribute("authz", authz); - if (authz == null) { - Debug.logError("[ContextFilter.init] ERROR: authorization create failed.", module); - } - } - return authz; - } - - @Deprecated protected Security getSecurity() { Security security = (Security) config.getServletContext().getAttribute("security"); if (security == null) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Wed Jul 11 16:34:26 2012 @@ -46,7 +46,6 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.stats.ServerHitBin; import org.ofbiz.webapp.stats.VisitHandler; @@ -177,15 +176,6 @@ public class ControlServlet extends Http } request.setAttribute("dispatcher", dispatcher); - Authorization authz = (Authorization) session.getAttribute("authz"); - if (authz == null) { - authz = (Authorization) getServletContext().getAttribute("authz"); - } - if (authz == null) { - Debug.logError("[ControlServlet] ERROR: authorization not found in ServletContext", module); - } - request.setAttribute("authz", authz); // maybe we should also add the value to 'security' - Security security = (Security) session.getAttribute("security"); if (security == null) { security = (Security) getServletContext().getAttribute("security"); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Wed Jul 11 16:34:26 2012 @@ -63,8 +63,6 @@ import org.ofbiz.entity.transaction.Tran import org.ofbiz.security.Security; import org.ofbiz.security.SecurityConfigurationException; import org.ofbiz.security.SecurityFactory; -import org.ofbiz.security.authz.Authorization; -import org.ofbiz.security.authz.AuthorizationFactory; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; @@ -478,25 +476,17 @@ public class LoginWorker { private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) { HttpSession session = request.getSession(); // NOTE: we do NOT want to set this in the servletContext, only in the request and session - // We also need to setup the security and authz objects since they are dependent on the delegator + // We also need to setup the security objects since they are dependent on the delegator Security security = null; try { security = SecurityFactory.getInstance(delegator); } catch (SecurityConfigurationException e) { Debug.logError(e, module); } - Authorization authz = null; - try { - authz = AuthorizationFactory.getInstance(delegator); - } catch (SecurityConfigurationException e) { - Debug.logError(e, module); - } - session.setAttribute("delegatorName", delegator.getDelegatorName()); request.setAttribute("delegator", delegator); request.setAttribute("dispatcher", dispatcher); request.setAttribute("security", security); - request.setAttribute("authz", authz); // get rid of the visit info since it was pointing to the previous database, and get a new one session.removeAttribute("visitor"); @@ -612,7 +602,6 @@ public class LoginWorker { request.removeAttribute("delegator"); request.removeAttribute("dispatcher"); request.removeAttribute("security"); - request.removeAttribute("authz"); // now empty out the session session.invalidate(); @@ -991,14 +980,12 @@ public class LoginWorker { Security security = (Security) request.getAttribute("security"); if (security != null) { ServletContext context = (ServletContext) request.getAttribute("servletContext"); - Authorization authz = (Authorization) request.getAttribute("authz"); String serverId = (String) context.getAttribute("_serverId"); String contextPath = request.getContextPath(); ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath); if (info != null) { for (String permission: info.getBasePermission()) { - if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin) && - !authz.hasPermission(userLogin.getString("userLoginId"), permission, null)) { + if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin)) { return false; } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Wed Jul 11 16:34:26 2012 @@ -47,8 +47,8 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericValue; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; +import org.ofbiz.security.Security; import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -110,8 +110,8 @@ public class CoreEvents { * @return Response code string */ public static String scheduleService(HttpServletRequest request, HttpServletResponse response) { + Security security = (Security) request.getAttribute("security"); GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); - Authorization authz = (Authorization) request.getAttribute("authz"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); //Delegator delegator = (Delegator) request.getAttribute("delegator"); Locale locale = UtilHttp.getLocale(request); @@ -216,7 +216,7 @@ public class CoreEvents { serviceContext.put("locale", locale); } - if (!modelService.export && !authz.hasPermission(request.getSession(), "SERVICE_INVOKE_ANY", null)) { + if (!modelService.export && !security.hasPermission("SERVICE_INVOKE_ANY", request.getSession())) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_to_call", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -438,7 +438,7 @@ public class CoreEvents { } // now do a security check - Authorization authz = (Authorization) request.getAttribute("authz"); + Security security = (Security) request.getAttribute("security"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); //lookup the service definition to see if this service is externally available, if not require the SERVICE_INVOKE_ANY permission @@ -457,7 +457,7 @@ public class CoreEvents { return "error"; } - if (!modelService.export && !authz.hasPermission(request.getSession(), "SERVICE_INVOKE_ANY", null)) { + if (!modelService.export && !security.hasPermission("SERVICE_INVOKE_ANY", request.getSession())) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_to_call", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg + "."); return "error"; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java Wed Jul 11 16:34:26 2012 @@ -87,7 +87,6 @@ public class FreeMarkerViewHandler exten // add in the OFBiz objects root.put("delegator", request.getAttribute("delegator")); root.put("dispatcher", request.getAttribute("dispatcher")); - root.put("authz", request.getAttribute("authz")); root.put("security", request.getAttribute("security")); root.put("userLogin", session.getAttribute("userLogin")); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java Wed Jul 11 16:34:26 2012 @@ -32,7 +32,6 @@ public interface RequestHandler { * <tr><td>delegator</td><td>A <code>GenericDelgator</code> instance</td></tr> * <tr><td>dispatcher</td><td>A <code>LocalDispatcher</code> instance</td></tr> * <tr><td>security</td><td>A <code>Security</code> instance</td></tr> - * <tr><td>authz</td><td>An <code>Authorization</code> instance</td></tr> * </table></p> */ public void handleRequest(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws ServletException, IOException; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java Wed Jul 11 16:34:26 2012 @@ -36,8 +36,6 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.security.Security; import org.ofbiz.security.SecurityFactory; -import org.ofbiz.security.authz.Authorization; -import org.ofbiz.security.authz.AuthorizationFactory; import org.ofbiz.service.GenericDispatcher; import org.ofbiz.service.LocalDispatcher; @@ -54,7 +52,6 @@ public class WebDavServlet extends Gener public static final String module = WebDavServlet.class.getName(); - protected Authorization authz = null; protected Delegator delegator = null; protected LocalDispatcher dispatcher = null; protected RequestHandlerFactory handlerFactory = null; @@ -72,7 +69,6 @@ public class WebDavServlet extends Gener String dispatcherName = context.getInitParameter("localDispatcherName"); this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, this.delegator); this.security = SecurityFactory.getInstance(this.delegator); - this.authz = AuthorizationFactory.getInstance(this.delegator); String factoryClassName = context.getInitParameter("requestHandlerFactoryClass"); this.handlerFactory = (RequestHandlerFactory) loader.loadClass(factoryClassName).newInstance(); } catch (Exception e) { @@ -86,8 +82,6 @@ public class WebDavServlet extends Gener buff.append(this.dispatcher.getName()); buff.append(", security = "); buff.append(this.security.getClass().getName()); - buff.append(", authz = "); - buff.append(this.authz.getClass().getName()); buff.append(", handler factory = "); buff.append(this.handlerFactory.getClass().getName()); Debug.logVerbose(buff.toString(), module); @@ -99,7 +93,6 @@ public class WebDavServlet extends Gener request.setAttribute("delegator", this.delegator); request.setAttribute("dispatcher", this.dispatcher); request.setAttribute("security", this.security); - request.setAttribute("authz", this.authz); HttpServletRequest httpRequest = (HttpServletRequest) request; RequestHandler handler = this.handlerFactory.getHandler(httpRequest.getMethod()); try { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java Wed Jul 11 16:34:26 2012 @@ -76,9 +76,8 @@ public abstract class ModelWidgetAction public abstract void runAction(Map<String, Object> context) throws GeneralException; public static List<ModelWidgetAction> readSubActions(ModelWidget modelWidget, Element parentElement) { - List<ModelWidgetAction> actions = FastList.newInstance(); - List<? extends Element> actionElementList = UtilXml.childElementList(parentElement); + List<ModelWidgetAction> actions = new ArrayList<ModelWidgetAction>(actionElementList.size()); for (Element actionElement: actionElementList) { if ("set".equals(actionElement.getNodeName())) { actions.add(new SetField(modelWidget, actionElement)); @@ -104,7 +103,6 @@ public abstract class ModelWidgetAction throw new IllegalArgumentException("Action element not supported with name: " + actionElement.getNodeName()); } } - return actions; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Wed Jul 11 16:34:26 2012 @@ -31,7 +31,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityUtil; -import org.ofbiz.security.authz.Authorization; +import org.ofbiz.security.Security; /** * PortalPageWorker Class @@ -151,9 +151,9 @@ public class PortalPageWorker { GenericValue userLogin = (GenericValue) context.get("userLogin"); if (UtilValidate.isNotEmpty(userLogin)) { String userLoginId = (String) userLogin.get("userLoginId"); - Authorization authz = (Authorization) context.get("authz"); + Security security = (Security) context.get("security"); - Boolean hasPortalAdminPermission = authz.hasPermission(userLoginId, "PORTALPAGE_ADMIN", context); + Boolean hasPortalAdminPermission = security.hasPermission("PORTALPAGE_ADMIN", userLogin); try { Delegator delegator = WidgetWorker.getDelegator(context); GenericValue portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", portalPageId),false); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java Wed Jul 11 16:34:26 2012 @@ -39,7 +39,6 @@ public class WidgetContextCacheKey { fieldNamesToSkip.add("globalContext"); fieldNamesToSkip.add("delegator"); fieldNamesToSkip.add("dispatcher"); - fieldNamesToSkip.add("authz"); fieldNamesToSkip.add("security"); fieldNamesToSkip.add("webSiteId"); fieldNamesToSkip.add("userLogin"); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Wed Jul 11 16:34:26 2012 @@ -39,7 +39,6 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.minilang.operation.BaseCompare; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -310,18 +309,15 @@ public class ModelMenuCondition { if (userLogin != null) { String permission = permissionExdr.expandString(context); String action = actionExdr.expandString(context); - - Authorization authz = (Authorization) context.get("authz"); Security security = (Security) context.get("security"); if (UtilValidate.isNotEmpty(action)) { - //Debug.logWarning("Deprecated method hasEntityPermission() was called; the action field should no longer be used", module); // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { return true; } } else { // run hasPermission - if (authz.hasPermission(userLogin.getString("userLoginId"), permission, context)) { + if (security.hasPermission(permission, userLogin)) { return true; } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Wed Jul 11 16:34:26 2012 @@ -339,7 +339,7 @@ public class ModelScreen extends ModelWi * - autoUserLogin (if a user is automatically logged in, ie no password has been entered) * - formStringRenderer * - request, response, session, application (special case, only in HTML contexts, etc) - * - delegator, dispatcher, authz, security + * - delegator, dispatcher, security * - null (represents a null field value for entity operations) * - sections (used for decorators to reference the sections to be decorated and render them) * @param screenStringRenderer An implementation of the ScreenStringRenderer Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java Wed Jul 11 16:34:26 2012 @@ -41,7 +41,6 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.minilang.operation.BaseCompare; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -308,18 +307,15 @@ public class ModelScreenCondition implem if (userLogin != null) { String permission = permissionExdr.expandString(context); String action = actionExdr.expandString(context); - - Authorization authz = (Authorization) context.get("authz"); Security security = (Security) context.get("security"); if (UtilValidate.isNotEmpty(action)) { - //Debug.logWarning("Deprecated method hasEntityPermission() was called; the action field should no longer be used", module); // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { return true; } } else { // run hasPermission - if (authz.hasPermission(userLogin.getString("userLoginId"), permission, context)) { + if (security.hasPermission(permission, userLogin)) { return true; } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Wed Jul 11 16:34:26 2012 @@ -49,7 +49,6 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericValue; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -145,11 +144,11 @@ public class ScreenRenderer { return this.screenStringRenderer; } - public void populateBasicContext(Map<String, Object> parameters, Delegator delegator, LocalDispatcher dispatcher, Authorization authz, Security security, Locale locale, GenericValue userLogin) { - populateBasicContext(context, this, parameters, delegator, dispatcher, authz, security, locale, userLogin); + public void populateBasicContext(Map<String, Object> parameters, Delegator delegator, LocalDispatcher dispatcher, Security security, Locale locale, GenericValue userLogin) { + populateBasicContext(context, this, parameters, delegator, dispatcher, security, locale, userLogin); } - public static void populateBasicContext(MapStack<String> context, ScreenRenderer screens, Map<String, Object> parameters, Delegator delegator, LocalDispatcher dispatcher, Authorization authz, Security security, Locale locale, GenericValue userLogin) { + public static void populateBasicContext(MapStack<String> context, ScreenRenderer screens, Map<String, Object> parameters, Delegator delegator, LocalDispatcher dispatcher, Security security, Locale locale, GenericValue userLogin) { // ========== setup values that should always be in a screen context // include an object to more easily render screens context.put("screens", screens); @@ -163,7 +162,6 @@ public class ScreenRenderer { context.put("parameters", parameters); context.put("delegator", delegator); context.put("dispatcher", dispatcher); - context.put("authz", authz); context.put("security", security); context.put("locale", locale); context.put("userLogin", userLogin); @@ -192,14 +190,14 @@ public class ScreenRenderer { HttpSession session = request.getSession(); // attribute names to skip for session and application attributes; these are all handled as special cases, duplicating results and causing undesired messages - Set<String> attrNamesToSkip = UtilMisc.toSet("delegator", "dispatcher", "authz", "security", "webSiteId", + Set<String> attrNamesToSkip = UtilMisc.toSet("delegator", "dispatcher", "security", "webSiteId", "org.apache.catalina.jsp_classpath"); Map<String, Object> parameterMap = UtilHttp.getCombinedMap(request, attrNamesToSkip); GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); populateBasicContext(context, screens, parameterMap, (Delegator) request.getAttribute("delegator"), - (LocalDispatcher) request.getAttribute("dispatcher"), (Authorization) request.getAttribute("authz"), + (LocalDispatcher) request.getAttribute("dispatcher"), (Security) request.getAttribute("security"), UtilHttp.getLocale(request), userLogin); context.put("autoUserLogin", session.getAttribute("autoUserLogin")); @@ -313,7 +311,7 @@ public class ScreenRenderer { } public void populateContextForService(DispatchContext dctx, Map<String, Object> serviceContext) { - this.populateBasicContext(serviceContext, dctx.getDelegator(), dctx.getDispatcher(), dctx.getAuthorization(), + this.populateBasicContext(serviceContext, dctx.getDelegator(), dctx.getDispatcher(), dctx.getSecurity(), (Locale) serviceContext.get("locale"), (GenericValue) serviceContext.get("userLogin")); } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Wed Jul 11 16:34:26 2012 @@ -39,7 +39,6 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.minilang.operation.BaseCompare; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.w3c.dom.Element; /** @@ -211,18 +210,15 @@ public class ModelTreeCondition { if (userLogin != null) { String permission = permissionExdr.expandString(context); String action = actionExdr.expandString(context); - - Authorization authz = (Authorization) context.get("authz"); Security security = (Security) context.get("security"); if (UtilValidate.isNotEmpty(action)) { - //Debug.logWarning("Deprecated method hasEntityPermission() was called; the action field should no longer be used", module); // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { return true; } } else { // run hasPermission - if (authz.hasPermission(userLogin.getString("userLoginId"), permission, context)) { + if (security.hasPermission(permission, userLogin)) { return true; } } Modified: ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl Wed Jul 11 16:34:26 2012 @@ -45,7 +45,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> @@ -75,7 +75,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> Modified: ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl Wed Jul 11 16:34:26 2012 @@ -45,7 +45,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> @@ -75,7 +75,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> Modified: ofbiz/trunk/themes/flatgrey/includes/appbar.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/flatgrey/includes/appbar.ftl?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/themes/flatgrey/includes/appbar.ftl (original) +++ ofbiz/trunk/themes/flatgrey/includes/appbar.ftl Wed Jul 11 16:34:26 2012 @@ -35,7 +35,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> @@ -72,7 +72,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> Modified: ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl?rev=1360283&r1=1360282&r2=1360283&view=diff ============================================================================== --- ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl Wed Jul 11 16:34:26 2012 @@ -49,7 +49,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> @@ -79,7 +79,7 @@ under the License. <#assign selected = false> <#assign permissions = display.getBasePermission()> <#list permissions as perm> - <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session) && !authz.hasPermission(session, perm, requestParameters))> + <#if (perm != "NONE" && !security.hasEntityPermission(perm, "_VIEW", session))> <#-- User must have ALL permissions in the base-permission list --> <#assign permission = false> </#if> |
| Free forum by Nabble | Edit this page |
