juergen     2003/07/16 08:51:05

  Modified:    src/share/org/apache/slide/lock LockImpl.java
               src/share/org/apache/slide/common NamespaceConfig.java
  Log:
  1) userPath is available during the load of the data section in domain.xml (dummy 
phase)
  2) LockImpl handles this case
  
  Revision  Changes    Path
  1.30      +45 -15    jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java
  
  Index: LockImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- LockImpl.java     7 Apr 2003 14:26:25 -0000       1.29
  +++ LockImpl.java     16 Jul 2003 15:50:41 -0000      1.30
  @@ -63,16 +63,24 @@
   
   package org.apache.slide.lock;
   
  -import java.util.Hashtable;
  -import java.util.Enumeration;
  -import java.util.Vector;
   import java.util.Date;
  +import java.util.Enumeration;
   import java.util.Stack;
  -import org.apache.slide.common.*;
  -import org.apache.slide.structure.*;
  -import org.apache.slide.security.*;
  +import java.util.Vector;
  +import org.apache.slide.common.Namespace;
  +import org.apache.slide.common.NamespaceConfig;
  +import org.apache.slide.common.ServiceAccessException;
  +import org.apache.slide.common.SlideException;
  +import org.apache.slide.common.SlideToken;
  +import org.apache.slide.common.Uri;
  +import org.apache.slide.security.AccessDeniedException;
  +import org.apache.slide.security.Security;
  +import org.apache.slide.structure.ActionNode;
  +import org.apache.slide.structure.ObjectNode;
  +import org.apache.slide.structure.ObjectNotFoundException;
  +import org.apache.slide.structure.SubjectNode;
   import org.apache.slide.util.Configuration;
  -import org.apache.slide.authenticate.CredentialsToken;
  +import org.apache.slide.webdav.util.AclConstants;
   
   /**
    * Lock helper class.
  @@ -388,16 +396,38 @@
               Uri objectUri = namespace.getUri(token, object.getUri());
               ObjectNode realObject = objectUri.getStore()
                   .retrieveObject(objectUri);
  -            Uri subjectUri = null;
  -            subjectUri = namespace.getUri
  -                (token, namespaceConfig.getUsersPath() + "/"
  -                 + token.getCredentialsToken().getPublicCredentials());
  +
  +            Uri subjectUri = namespace.getUri(token, 
computeSubjectUriFromPrincipal(token));
               SubjectNode subject = (SubjectNode) subjectUri
                   .getStore().retrieveObject(subjectUri);
               checkLock(token, realObject, subject, action);
   
           }
       }
  +
  +
  +    private String computeSubjectUriFromPrincipal(SlideToken token) {
  +
  +        String result;
  +        String configParam = 
namespaceConfig.getParameter(AclConstants.P_USER_COLLECTION);
  +
  +        String userCollection;
  +        if ( configParam != null && configParam.length() > 0) {
  +            userCollection =  "/" + configParam;
  +        } else {
  +            userCollection =  "";
  +        }
  +
  +
  +        String userId = token.getCredentialsToken().getPublicCredentials();
  +        if (userId.equals("/")) userId = "";
  +
  +        result = namespaceConfig.getUsersPath() + userCollection + userId;
  +        System.out.println("##### Subject URI = " + result);
  +        return result;
  +    }
  +
  +
   
   
       /**
  
  
  
  1.26      +19 -16    
jakarta-slide/src/share/org/apache/slide/common/NamespaceConfig.java
  
  Index: NamespaceConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/NamespaceConfig.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- NamespaceConfig.java      16 Jul 2003 07:36:25 -0000      1.25
  +++ NamespaceConfig.java      16 Jul 2003 15:50:51 -0000      1.26
  @@ -63,18 +63,18 @@
   
   package org.apache.slide.common;
   
  +import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Vector;
  -import java.util.Enumeration;
  -import java.io.FileReader;
  -import java.io.Reader;
  -import java.io.IOException;
  -import org.apache.slide.structure.*;
  -import org.apache.slide.content.*;
  -import org.apache.slide.lock.*;
  +import org.apache.slide.content.ContentInterceptor;
  +import org.apache.slide.content.NodeProperty;
  +import org.apache.slide.structure.ActionNode;
  +import org.apache.slide.structure.LinkNode;
  +import org.apache.slide.structure.ObjectNode;
  +import org.apache.slide.structure.SubjectNode;
  +import org.apache.slide.util.Messages;
   import org.apache.slide.util.conf.Configuration;
   import org.apache.slide.util.conf.ConfigurationException;
  -import org.apache.slide.util.Messages;
   import org.apache.slide.util.logger.Logger;
   
   /**
  @@ -219,7 +219,7 @@
       /**
        * Users path.
        */
  -    protected String usersPath;
  +    protected String usersPath = null;
   
   
       /**
  @@ -231,7 +231,7 @@
       /**
        * File path.
        */
  -    protected String filesPath;
  +    protected String filesPath = null;
   
   
       /**
  @@ -847,8 +847,11 @@
               modifyRevisionContentAction = defaultAction;
               removeRevisionContentAction = defaultAction;
   
  -            usersPath = "";
  -            filesPath = "";
  +            // re-initialise users- and files-Path only, if not already set
  +            if (usersPath == null) usersPath = "";
  +            if (filesPath == null) filesPath = "";
  +//            usersPath = "";
  +//            filesPath = "";
   
           } catch (Exception e) {
               throw new InvalidNamespaceConfigurationException
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to