/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }