Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AEC9B102D7 for ; Sat, 26 Oct 2013 12:46:55 +0000 (UTC) Received: (qmail 70173 invoked by uid 500); 26 Oct 2013 12:46:54 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 70122 invoked by uid 500); 26 Oct 2013 12:46:54 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 70107 invoked by uid 99); 26 Oct 2013 12:46:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Oct 2013 12:46:53 +0000 X-ASF-Spam-Status: No, hits=-1998.0 required=5.0 tests=ALL_TRUSTED,FB_GET_MEDS,WEIRD_QUOTING X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Oct 2013 12:46:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5F269238899C; Sat, 26 Oct 2013 12:46:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1535983 [1/2] - in /manifoldcf/trunk: ./ connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/ framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/ framework/crawler-ui/src/main... Date: Sat, 26 Oct 2013 12:46:19 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131026124620.5F269238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Sat Oct 26 12:46:18 2013 New Revision: 1535983 URL: http://svn.apache.org/r1535983 Log: CONNECTORS-792: Add authority groups, authorization domains, etc. WARNING: Schema change!! Upgrade code has been added too, but not yet tested. Added: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editgroup.jsp - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listgroups.jsp - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listgroups.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewgroup.jsp - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewgroup.jsp manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authdomains/ - copied from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authdomains/ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/ - copied from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorizationDomainManagerFactory.java - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorizationDomainManagerFactory.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroup.java - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroup.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorizationDomainManager.java - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorizationDomainManager.java Modified: manifoldcf/trunk/ (props changed) manifoldcf/trunk/CHANGES.txt manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp manifoldcf/trunk/framework/example-common/connectors.xml manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/concepts.xml manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml manifoldcf/trunk/tests/activedirectory/src/test/java/org/apache/manifoldcf/activedirectory_tests/NavigationDerbyUI.java manifoldcf/trunk/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/NavigationDerbyUI.java manifoldcf/trunk/tests/jdbc/src/test/java/org/apache/manifoldcf/jdbc_tests/NavigationDerbyUI.java manifoldcf/trunk/tests/ldap/src/test/java/org/apache/manifoldcf/ldap_tests/NavigationDerbyUI.java Propchange: manifoldcf/trunk/ ------------------------------------------------------------------------------ Merged /manifoldcf/branches/CONNECTORS-792:r1534965-1535981 Modified: manifoldcf/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1535983&r1=1535982&r2=1535983&view=diff ============================================================================== --- manifoldcf/trunk/CHANGES.txt (original) +++ manifoldcf/trunk/CHANGES.txt Sat Oct 26 12:46:18 2013 @@ -3,6 +3,14 @@ $Id$ ======================= 1.5-dev ===================== +CONNECTORS-792: Introduce concepts of authorization domain +and authority group, and appropriate UI, API, etc. changes. This +is to support federated authorization models such as what SharePoint +Claim Space fundamentally does, where there are multiple authorities +per repository. +WARNING: Schema change! +(Karl Wright) + ======================= Release 1.4 ===================== CONNECTORS-791: Broken WHERE clause in job status query. Modified: manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java?rev=1535983&r1=1535982&r2=1535983&view=diff ============================================================================== --- manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java (original) +++ manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java Sat Oct 26 12:46:18 2013 @@ -61,11 +61,12 @@ public class HDFSSession { info.put("Name Node", nameNode); info.put("Config", config.toString()); info.put("User", user); + // Commented much of this out because each timeout is too long if there's no connection info.put("Canonical Service Name", fileSystem.getCanonicalServiceName()); - info.put("Default Block Size", Long.toString(fileSystem.getDefaultBlockSize())); - info.put("Default Replication", Short.toString(fileSystem.getDefaultReplication())); - info.put("Home Directory", fileSystem.getHomeDirectory().toUri().toString()); - info.put("Working Directory", fileSystem.getWorkingDirectory().toUri().toString()); + //info.put("Default Block Size", Long.toString(fileSystem.getDefaultBlockSize())); + //info.put("Default Replication", Short.toString(fileSystem.getDefaultReplication())); + //info.put("Home Directory", fileSystem.getHomeDirectory().toUri().toString()); + //info.put("Working Directory", fileSystem.getWorkingDirectory().toUri().toString()); return info; } Modified: manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java?rev=1535983&r1=1535982&r2=1535983&view=diff ============================================================================== --- manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java (original) +++ manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java Sat Oct 26 12:46:18 2013 @@ -106,13 +106,37 @@ public class UserACLServlet extends Http Logging.authorityService.debug("Received request"); + Map domainMap = new HashMap(); + + // Legacy mode: single user name with optional domain String userID = request.getParameter("username"); - if (userID == null) + if (userID != null) + { + String domain = request.getParameter("domain"); + if (domain == null) + domain = ""; + domainMap.put(domain,userID); + } + + // Now, go through enumerated username/domain pairs + int q = 0; + while (true) + { + String enumUserName = request.getParameter("username_"+q); + if (enumUserName == null) + break; + String enumDomain = request.getParameter("domain_"+q); + if (enumDomain == null) + enumDomain = ""; + domainMap.put(enumDomain,enumUserName); + } + + if (domainMap.size() == 0) { response.sendError(response.SC_BAD_REQUEST); return; } - + boolean idneeded = false; boolean aclneeded = true; @@ -135,7 +159,18 @@ public class UserACLServlet extends Http if (Logging.authorityService.isDebugEnabled()) { - Logging.authorityService.debug("Received authority request for user '"+userID+"'"); + StringBuilder sb2 = new StringBuilder("["); + boolean first = true; + for (String domain : domainMap.keySet()) + { + if (first) + first = false; + else + sb2.append(","); + sb2.append("'").append(domain).append("':'").append(domainMap.get(domain)).append("'"); + } + sb2.append("]"); + Logging.authorityService.debug("Received authority request for domain:user set "+sb2.toString()); } RequestQueue mappingQueue = ManifoldCF.getMappingRequestQueue(); @@ -158,15 +193,15 @@ public class UserACLServlet extends Http IMappingConnectionManager mappingConnManager = MappingConnectionManagerFactory.make(itc); IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(itc); + // Get all mapping connections; we may not need them all but we do need to be able to look them all up IMappingConnection[] mappingConnections = mappingConnManager.getAllConnections(); - IAuthorityConnection[] connections = authConnManager.getAllConnections(); // One thread per connection, which is responsible for starting the mapping process when it is ready. List mappingThreads = new ArrayList(); // One thread per authority, which is responsible for starting the auth request when it is ready. List authThreads = new ArrayList(); - Map mappingRequests = new HashMap(); + Map mappingRequests = new HashMap(); Map authRequests = new HashMap(); Map mappingConnMap = new HashMap(); @@ -178,46 +213,56 @@ public class UserACLServlet extends Http } // Set of connections we need to fire off - Set activeConnections = new HashSet(); + Set activeConnections = new HashSet(); // We do the minimal set of mapping requests and authorities. Since it is the authority tokens we are // looking for, we start there, and build authority requests first, then mapping requests that support them, // etc. // Create auth requests - for (int i = 0; i < connections.length; i++) + for (String authDomain : domainMap.keySet()) { - IAuthorityConnection thisConnection = connections[i]; - String identifyingString = thisConnection.getDescription(); - if (identifyingString == null || identifyingString.length() == 0) - identifyingString = thisConnection.getName(); - - // Create a request - AuthRequest ar = new AuthRequest( - thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections()); - authRequests.put(thisConnection.getName(), ar); - - // We create an auth thread if there are prerequisites to meet. - // Otherwise, we just fire off the request - if (thisConnection.getPrerequisiteMapping() == null) - { - ar.setUserID(userID); - queue.addRequest(ar); - } - else + IAuthorityConnection[] connections = authConnManager.getDomainConnections(authDomain); + for (int i = 0; i < connections.length; i++) { - AuthOrderThread thread = new AuthOrderThread(identifyingString, - ar, thisConnection.getPrerequisiteMapping(), - queue, mappingRequests); - authThreads.add(thread); - activeConnections.add(thisConnection.getPrerequisiteMapping()); + IAuthorityConnection thisConnection = connections[i]; + String identifyingString = thisConnection.getDescription(); + if (identifyingString == null || identifyingString.length() == 0) + identifyingString = thisConnection.getName(); + + // Create a request + AuthRequest ar = new AuthRequest( + thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections()); + authRequests.put(thisConnection.getName(), ar); + + // We create an auth thread if there are prerequisites to meet. + // Otherwise, we just fire off the request + String domainUserID = domainMap.get(authDomain); + if (thisConnection.getPrerequisiteMapping() == null) + { + ar.setUserID(domainUserID); + queue.addRequest(ar); + } + else + { + MapperDescription md = new MapperDescription(thisConnection.getPrerequisiteMapping(),authDomain); + AuthOrderThread thread = new AuthOrderThread(identifyingString, + ar, md, + queue, mappingRequests); + authThreads.add(thread); + // The same mapper can be used for multiple domains, although this is likely to be uncommon. Nevertheless, + // mapper invocations need to be segregated to prevent trouble + activeConnections.add(md); + } } } // Create mapping requests while (!activeConnections.isEmpty()) { - Iterator connectionIter = activeConnections.iterator(); - String connectionName = connectionIter.next(); + Iterator connectionIter = activeConnections.iterator(); + MapperDescription mapperDesc = connectionIter.next(); + String connectionName = mapperDesc.mapperName; + String authDomain = mapperDesc.authDomain; IMappingConnection thisConnection = mappingConnMap.get(connectionName); String identifyingString = thisConnection.getDescription(); if (identifyingString == null || identifyingString.length() == 0) @@ -226,25 +271,25 @@ public class UserACLServlet extends Http // Create a request MappingRequest mr = new MappingRequest( thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections()); - mappingRequests.put(connectionName, mr); + mappingRequests.put(mapperDesc, mr); // Either start up a thread, or just fire it off immediately. if (thisConnection.getPrerequisiteMapping() == null) { - mr.setUserID(userID); + mr.setUserID(domainMap.get(authDomain)); mappingQueue.addRequest(mr); } else { //System.out.println("Mapper: prerequisite found: '"+thisConnection.getPrerequisiteMapping()+"'"); + MapperDescription p = new MapperDescription(thisConnection.getPrerequisiteMapping(),authDomain); MappingOrderThread thread = new MappingOrderThread(identifyingString, - mr, thisConnection.getPrerequisiteMapping(), mappingQueue, mappingRequests); + mr, p, mappingQueue, mappingRequests); mappingThreads.add(thread); - String p = thisConnection.getPrerequisiteMapping(); if (mappingRequests.get(p) == null) activeConnections.add(p); } - activeConnections.remove(connectionName); + activeConnections.remove(mapperDesc); } // Start threads. We have to wait until all the requests have been @@ -287,25 +332,24 @@ public class UserACLServlet extends Http // Now, work through the returning answers. - // Ask all the registered authorities for their ACLs, and merge the final list together. + // Ask all the interrogated authorities for their ACLs, and merge the final list together. StringBuilder sb = new StringBuilder(); // Set response mime type response.setContentType("text/plain; charset=ISO8859-1"); ServletOutputStream out = response.getOutputStream(); try { - for (int i = 0; i < connections.length; i++) + for (String connectionName : authRequests.keySet()) { - IAuthorityConnection ac = connections[i]; - AuthRequest ar = authRequests.get(ac.getName()); + AuthRequest ar = authRequests.get(connectionName); if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("Waiting for answer from connector class '"+ac.getClassName()+"' for user '"+userID+"'"); + Logging.authorityService.debug("Waiting for answer from authority connection "+ar.getIdentifyingString()+" for user '"+ar.getUserID()+"'"); ar.waitForComplete(); if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("Received answer from connector class '"+ac.getClassName()+"' for user '"+userID+"'"); + Logging.authorityService.debug("Received answer from authority connection "+ar.getIdentifyingString()+" for user '"+ar.getUserID()+"'"); Throwable exception = ar.getAnswerException(); AuthorizationResponse reply = ar.getAnswerResponse(); @@ -324,24 +368,24 @@ public class UserACLServlet extends Http if (reply == null) { if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("User '"+userID+"' mapping failed for authority '"+ar.getIdentifyingString()+"'"); + Logging.authorityService.debug("User '"+ar.getUserID()+"' mapping failed for authority '"+ar.getIdentifyingString()+"'"); sb.append(USERNOTFOUND_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n"); } else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_UNREACHABLE) { - Logging.authorityService.warn("Authority '"+ar.getIdentifyingString()+"' is unreachable for user '"+userID+"'"); + Logging.authorityService.warn("Authority '"+ar.getIdentifyingString()+"' is unreachable for user '"+ar.getUserID()+"'"); sb.append(UNREACHABLE_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n"); } else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_USERUNAUTHORIZED) { if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("Authority '"+ar.getIdentifyingString()+"' does not authorize user '"+userID+"'"); + Logging.authorityService.debug("Authority '"+ar.getIdentifyingString()+"' does not authorize user '"+ar.getUserID()+"'"); sb.append(UNAUTHORIZED_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n"); } else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_USERNOTFOUND) { if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("User '"+userID+"' unknown to authority '"+ar.getIdentifyingString()+"'"); + Logging.authorityService.debug("User '"+ar.getUserID()+"' unknown to authority '"+ar.getIdentifyingString()+"'"); sb.append(USERNOTFOUND_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n"); } else @@ -356,14 +400,15 @@ public class UserACLServlet extends Http while (j < acl.length) { if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug(" User '"+userID+"' has Acl = '"+acl[j]+"' from authority '"+ar.getIdentifyingString()+"'"); - sb.append(TOKEN_PREFIX).append(java.net.URLEncoder.encode(ac.getName(),"UTF-8")).append(":").append(java.net.URLEncoder.encode(acl[j++],"UTF-8")).append("\n"); + Logging.authorityService.debug(" User '"+ar.getUserID()+"' has Acl = '"+acl[j]+"' from authority '"+ar.getIdentifyingString()+"'"); + sb.append(TOKEN_PREFIX).append(java.net.URLEncoder.encode(connectionName,"UTF-8")).append(":").append(java.net.URLEncoder.encode(acl[j++],"UTF-8")).append("\n"); } } } } - if (idneeded) + // Maintained for backwards compatibility only; no practical use that I can determine here + if (idneeded && userID != null) sb.append(ID_PREFIX).append(java.net.URLEncoder.encode(userID,"UTF-8")).append("\n"); byte[] responseValue = sb.toString().getBytes("ISO8859-1"); @@ -378,7 +423,20 @@ public class UserACLServlet extends Http } if (Logging.authorityService.isDebugEnabled()) - Logging.authorityService.debug("Done with request for '"+userID+"'"); + { + StringBuilder sb2 = new StringBuilder("["); + boolean first = true; + for (String domain : domainMap.keySet()) + { + if (first) + first = false; + else + sb2.append(","); + sb2.append("'").append(domain).append("':'").append(domainMap.get(domain)).append("'"); + } + sb2.append("]"); + Logging.authorityService.debug("Done with request for domain:user set "+sb2.toString()); + } } catch (InterruptedException e) { @@ -396,6 +454,34 @@ public class UserACLServlet extends Http } } + /** This class represents a tuple of (mapper_name, auth_domain). + */ + protected static class MapperDescription + { + public final String mapperName; + public final String authDomain; + + public MapperDescription(String mapperName, String authDomain) + { + this.mapperName = mapperName; + this.authDomain = authDomain; + } + + public int hashCode() + { + return mapperName.hashCode() + authDomain.hashCode(); + } + + public boolean equals(Object o) + { + if (!(o instanceof MapperDescription)) + return false; + MapperDescription other = (MapperDescription)o; + return this.mapperName.equals(other.mapperName) && + this.authDomain.equals(other.authDomain); + } + } + /** This thread is responsible for making sure that the constraints for a given mapping connection * are met, and then when they are, firing off a MappingRequest. One of these threads is spun up * for every IMappingConnection being handled. @@ -406,8 +492,8 @@ public class UserACLServlet extends Http protected static class MappingOrderThread extends Thread { protected final MappingRequest request; - protected final String prerequisite; - protected final Map requests; + protected final MapperDescription prerequisite; + protected final Map requests; protected final RequestQueue mappingRequestQueue; protected Throwable exception = null; @@ -415,9 +501,9 @@ public class UserACLServlet extends Http public MappingOrderThread( String identifyingString, MappingRequest request, - String prerequisite, + MapperDescription prerequisite, RequestQueue mappingRequestQueue, - Map requests) + Map requests) { super(); this.request = request; @@ -469,8 +555,8 @@ public class UserACLServlet extends Http protected static class AuthOrderThread extends Thread { protected final AuthRequest request; - protected final String prerequisite; - protected final Map mappingRequests; + protected final MapperDescription prerequisite; + protected final Map mappingRequests; protected final RequestQueue authRequestQueue; protected Throwable exception = null; @@ -478,9 +564,9 @@ public class UserACLServlet extends Http public AuthOrderThread( String identifyingString, AuthRequest request, - String prerequisite, + MapperDescription prerequisite, RequestQueue authRequestQueue, - Map mappingRequests) + Map mappingRequests) { super(); this.request = request; Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff ============================================================================== --- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp (original) +++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp Sat Oct 26 12:46:18 2013 @@ -28,13 +28,17 @@ // the connection object being edited will be placed in the thread context under the name "ConnectionObject". try { + // Get the domain manager handle + IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadContext); // Get the connection manager handle IAuthorityConnectionManager connMgr = AuthorityConnectionManagerFactory.make(threadContext); // Also get the list of available connectors IAuthorityConnectorManager connectorManager = AuthorityConnectorManagerFactory.make(threadContext); // Get the mapping connection manager IMappingConnectionManager mappingConnMgr = MappingConnectionManagerFactory.make(threadContext); - + // Get the group manager + IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext); + // Figure out what the current tab name is. String tabName = variableContext.getParameter("tabname"); if (tabName == null || tabName.length() == 0) @@ -61,7 +65,9 @@ int maxConnections = 10; ConfigParams parameters = new ConfigParams(); String prereq = null; - + String authDomain = ""; + String groupName = ""; + if (connection != null) { // Set up values @@ -72,6 +78,12 @@ parameters = connection.getConfigParams(); maxConnections = connection.getMaxConnections(); prereq = connection.getPrerequisiteMapping(); + authDomain = connection.getAuthDomain(); + if (authDomain == null) + authDomain = ""; + groupName = connection.getAuthGroup(); + if (groupName == null) + groupName = ""; } else connectionName = null; @@ -152,6 +164,13 @@ document.editconnection.connname.focus(); return; } + if (editconnection.authoritygroup.value == "") + { + alert("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editauthority.ConnectionMustHaveAGroup")%>"); + SelectTab("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editauthority.Type")%>"); + document.editconnection.authoritygroup.focus(); + return; + } if (window.checkConfigForSave) { if (!checkConfigForSave()) @@ -222,6 +241,8 @@ // Get connectors, since this will be needed to determine what to display. IResultSet set = connectorManager.getConnectors(); + // Same for authority groups + IAuthorityGroup[] set2 = authGroupManager.getAllGroups(); %> @@ -233,10 +254,15 @@ - - <% - if (set.getRowCount() == 0) + if (set2.length == 0) + { +%> +

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.EditAuthorityConnection")%>

+
<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.NoAuthorityGroupsDefinedCreateOneFirst")%>
+<% + } + else if (set.getRowCount() == 0) { %>

<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.EditAuthorityConnection")%>

@@ -341,6 +367,7 @@ // "Type" tab if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editauthority.Type"))) { + IResultSet domainSet = domainMgr.getDomains(); %> @@ -390,6 +417,49 @@ %> + + + + + + +


<%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.AuthorityGroupColon")%> + + <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.AuthorizationDomainColon")%> + +
<% } @@ -398,6 +468,8 @@ // Hiddens for the "Type" tab %> + + <% } Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff ============================================================================== --- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp (original) +++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp Sat Oct 26 12:46:18 2013 @@ -32,7 +32,7 @@ IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(threadContext); // Also get the list of available connectors IConnectorManager connectorManager = ConnectorManagerFactory.make(threadContext); - IAuthorityConnectionManager authConnectionManager = AuthorityConnectionManagerFactory.make(threadContext); + IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext); // Figure out what the current tab name is. String tabName = variableContext.getParameter("tabname"); @@ -422,10 +422,10 @@ - <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityColon")%> + <%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityGroupColon")%> <% - IAuthorityConnection[] set2 = authConnectionManager.getAllConnections(); + IAuthorityGroup[] set2 = authGroupManager.getAllGroups(); int i = 0; %>