You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@locus.apache.org on 2000/10/03 08:16:48 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/webdav/method GetMethod.java
remm 00/10/02 23:16:48
Modified: . build.xml
src/share/org/apache/slide/security Security.java
SecurityImpl.java
src/share/org/apache/slide/webdav/method GetMethod.java
Added: src/conf/webapp webdoc.xml
Log:
- Blank web.xml file for the new slidedoc web application
- New web application containing the documentation
- Added a new call in the security helper to make the API more consistent
- The directory browser now displays the permissions and the locks
Revision Changes Path
1.48 +8 -0 jakarta-slide/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/build.xml,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- build.xml 2000/09/23 07:41:22 1.47
+++ build.xml 2000/10/03 06:16:43 1.48
@@ -371,6 +371,12 @@
<lib dir="${slide.dist}/lib" />
</war>
+ <war warfile="${webapp.dist}/slidedoc.war"
+ webxml="src/conf/webapp/webdoc.xml">
+ <fileset dir="${slide.dist}/doc">
+ </fileset>
+ </war>
+
</target>
@@ -571,6 +577,8 @@
</copydir>
<copyfile src="${webapp.dist}/slide.war"
dest="${slide.release}/webapp/slide.war" />
+ <copyfile src="${webapp.dist}/slidedoc.war"
+ dest="${slide.release}/webapp/slidedoc.war" />
<copydir src="." dest="${slide.release}"
includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html"
/>
1.1 jakarta-slide/src/conf/webapp/webdoc.xml
Index: webdoc.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
</web-app>
1.7 +19 -4 jakarta-slide/src/share/org/apache/slide/security/Security.java
Index: Security.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/Security.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Security.java 2000/09/26 02:44:20 1.6
+++ Security.java 2000/10/03 06:16:44 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/Security.java,v 1.6 2000/09/26 02:44:20 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2000/09/26 02:44:20 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/Security.java,v 1.7 2000/10/03 06:16:44 remm Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/10/03 06:16:44 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Security helper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public interface Security {
@@ -92,6 +92,21 @@
* @exception AccessDeniedException Insufficent credentials
*/
Enumeration enumeratePermissions(CredentialsToken token, ObjectNode object)
+ throws ServiceAccessException, ObjectNotFoundException,
+ AccessDeniedException;
+
+
+ /**
+ * Enumerates permissions on an object.
+ *
+ * @param token Credentials token
+ * @param object Object on which permission is granted
+ * @exception ServiceAccessException DataSource access error
+ * @exception ObjectNotFoundException Specified object was not found
+ * in the DataSource
+ * @exception AccessDeniedException Insufficent credentials
+ */
+ Enumeration enumeratePermissions(CredentialsToken token, String object)
throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException;
1.8 +23 -5 jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java
Index: SecurityImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SecurityImpl.java 2000/09/26 02:44:20 1.7
+++ SecurityImpl.java 2000/10/03 06:16:44 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v 1.7 2000/09/26 02:44:20 remm Exp $
- * $Revision: 1.7 $
- * $Date: 2000/09/26 02:44:20 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v 1.8 2000/10/03 06:16:44 remm Exp $
+ * $Revision: 1.8 $
+ * $Date: 2000/10/03 06:16:44 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Security helper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public final class SecurityImpl implements Security {
@@ -406,7 +406,25 @@
ObjectNode object)
throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
- Uri objectUri = namespace.getUri(object.getUri());
+ return enumeratePermissions(token, object.getUri());
+ }
+
+
+ /**
+ * Enumerates permissions on an object.
+ *
+ * @param token Credentials token
+ * @param object Object on which permission is granted
+ * @exception ServiceAccessException DataSource access error
+ * @exception ObjectNotFoundException Specified object was not found
+ * in the DataSource
+ * @exception AccessDeniedException Insufficent credentials
+ */
+ public Enumeration enumeratePermissions(CredentialsToken token,
+ String object)
+ throws ServiceAccessException, ObjectNotFoundException,
+ AccessDeniedException {
+ Uri objectUri = namespace.getUri(object);
return objectUri.getDescriptorsStore().enumeratePermissions(objectUri);
}
1.6 +263 -10 jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GetMethod.java 2000/09/26 02:44:32 1.5
+++ GetMethod.java 2000/10/03 06:16:47 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v 1.5 2000/09/26 02:44:32 remm Exp $
- * $Revision: 1.5 $
- * $Date: 2000/09/26 02:44:32 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v 1.6 2000/10/03 06:16:47 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/10/03 06:16:47 $
*
* ====================================================================
*
@@ -77,6 +77,7 @@
import org.apache.slide.util.Messages;
import org.apache.slide.content.*;
import org.apache.slide.lock.*;
+import org.apache.slide.security.*;
import org.apache.slide.structure.*;
/**
@@ -192,6 +193,7 @@
if (isCollection(revisionDescriptor)) {
Writer writer = resp.getWriter();
+ resp.setContentType("text/html");
displayDirectoryBrowsing(object, writer);
writer.close();
@@ -279,6 +281,7 @@
} else {
Writer writer = resp.getWriter();
+ resp.setContentType("text/html");
displayDirectoryBrowsing(object, writer);
writer.close();
@@ -381,7 +384,7 @@
int slash = parentDirectory.lastIndexOf("/");
if (slash >= 0) {
String parent = name.substring(0, slash);
- writer.print("<tr><td colspan=\"3\" bgcolor=\"#ffffff\">\r\n");
+ writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
writer.print("<a href=\"");
writer.print(rewriteUrl(contextPath));
if (parent.equals(""))
@@ -394,9 +397,37 @@
writer.print("</td></tr>\r\n");
}
+ Enumeration permissionsList = null;
+ Enumeration locksList = null;
+
+ try {
+
+ permissionsList =
+ security.enumeratePermissions(credToken, object.getUri());
+ locksList = lock.enumerateLocks(credToken, object.getUri());
+
+ } catch (SlideException e) {
+
+ // Any security based exception will be trapped here
+
+ // Any locking based exception will be trapped here
+
+ }
+
+ // Displaying ACL info
+ displayPermissions(permissionsList, writer, false);
+
+ // Displaying lock info
+ displayLocks(locksList, writer, false);
+
+ writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">");
+ writer.print(" ");
+ writer.print("</td></tr>\r\n");
+
// Render the column headings
writer.print("<tr bgcolor=\"#cccccc\">\r\n");
- writer.print("<td align=\"left\"><font size=\"+1\"><strong>");
+ writer.print("<td align=\"left\" colspan=\"3\">");
+ writer.print("<font size=\"+1\"><strong>");
writer.print(Messages.message
("org.apache.slide.webdav.GetMethod.filename"));
writer.print("</strong></font></td>\r\n");
@@ -419,6 +450,9 @@
NodeRevisionDescriptor currentDescriptor = null;
+ permissionsList = null;
+ locksList = null;
+
try {
NodeRevisionDescriptors revisionDescriptors =
@@ -432,6 +466,24 @@
// Silent exception : Objects without any revision are
// considered collections, and do not have any attributes
+ // Any security based exception will be trapped here
+
+ // Any locking based exception will be trapped here
+
+ }
+
+ try {
+
+ permissionsList =
+ security.enumeratePermissions(credToken, currentResource);
+ locksList = lock.enumerateLocks(credToken, currentResource);
+
+ } catch (SlideException e) {
+
+ // Any security based exception will be trapped here
+
+ // Any locking based exception will be trapped here
+
}
String trimmed = currentResource.substring(trim);
@@ -440,12 +492,15 @@
continue;
writer.print("<tr");
- if (shade)
+ if (shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
writer.print(" bgcolor=\"eeeeee\"");
+ }
writer.print(">\r\n");
shade = !shade;
- writer.print("<td align=\"left\"> \r\n");
+ writer.print("<td align=\"left\" colspan=\"3\"> \r\n");
writer.print("<a href=\"");
writer.print(rewriteUrl(contextPath));
writer.print(rewriteUrl(currentResource));
@@ -464,20 +519,33 @@
writer.print("</tt></td>\r\n");
writer.print("<td align=\"right\"><tt>");
- if (currentDescriptor != null)
+ if (currentDescriptor != null) {
writer.print(currentDescriptor.getLastModified());
+ } else {
+ writer.print(" ");
+ }
writer.print("</tt></td>\r\n");
writer.print("</tr>\r\n");
+
+ // Displaying ACL info
+ displayPermissions(permissionsList, writer, shade);
+
+ // Displaying lock info
+ displayLocks(locksList, writer, shade);
+
}
-
// Render the page footer
- writer.print("<tr><td colspan=\"3\"> </td></tr>\r\n");
+ writer.print("<tr><td colspan=\"5\"> </td></tr>\r\n");
writer.print("<tr><td colspan=\"3\" bgcolor=\"#cccccc\">");
writer.print("<font size=\"-1\">");
writer.print(Messages.message
("org.apache.slide.webdav.GetMethod.version"));
+ writer.print("</font></td>\r\n");
+ writer.print("<td colspan=\"2\" align=\"right\" bgcolor=\"#cccccc\">");
+ writer.print("<font size=\"-1\">");
+ writer.print(formats[0].format(new Date()));
writer.print("</font></td></tr>\r\n");
writer.print("</table>\r\n");
writer.print("</body>\r\n");
@@ -485,6 +553,191 @@
// Return an input stream to the underlying bytes
writer.flush();
+
+ }
+
+
+ /**
+ * Display an ACL list.
+ *
+ * @param permissionsList List of NodePermission objects
+ * @param boolean Shade
+ * @param writer The output will be appended to this writer
+ */
+ private void displayPermissions(Enumeration permissionsList,
+ PrintWriter writer,
+ boolean shade)
+ throws IOException {
+
+ if ((permissionsList != null) && (permissionsList.hasMoreElements())) {
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+ writer.print("<td align=\"left\" colspan=\"5\"><tt><b>");
+ writer.print("ACL Info");
+ writer.print("</b></tt></td>\r\n");
+ writer.print("</tr>\r\n");
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+
+ writer.print("<td align=\"left\" colspan=\"2\"><tt><b>");
+ writer.print("Subject");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"left\"><tt><b>");
+ writer.print("Action");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("Inheritable");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("Deny");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("</tr>\r\n");
+
+ while (permissionsList.hasMoreElements()) {
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+
+ NodePermission currentPermission =
+ (NodePermission) permissionsList.nextElement();
+
+ writer.print("<td align=\"left\" colspan=\"2\"><tt>");
+ writer.print(currentPermission.getSubjectUri());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"left\"><tt>");
+ writer.print(currentPermission.getActionUri());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt>");
+ writer.print(currentPermission.isInheritable());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt>");
+ writer.print(currentPermission.isNegative());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("</tr>\r\n");
+
+ }
+
+ }
+
+ }
+
+
+ /**
+ * Display a lock list.
+ *
+ * @param locksList List of NodeLock objects
+ * @param boolean Shade
+ * @param writer The output will be appended to this writer
+ */
+ private void displayLocks(Enumeration locksList, PrintWriter writer,
+ boolean shade)
+ throws IOException {
+
+ if ((locksList != null) && (locksList.hasMoreElements())) {
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+ writer.print("<td align=\"left\" colspan=\"5\"><tt><b>");
+ writer.print("Locks Info");
+ writer.print("</b></tt></td>\r\n");
+ writer.print("</tr>\r\n");
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+
+ writer.print("<td align=\"left\"><tt><b>");
+ writer.print("Subject");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"left\"><tt><b>");
+ writer.print("Type");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("Expiration");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("Inheritable");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt><b>");
+ writer.print("Exclusive");
+ writer.print("</b></tt></td>\r\n");
+
+ writer.print("</tr>\r\n");
+
+ while (locksList.hasMoreElements()) {
+
+ writer.print("<tr");
+ if (!shade) {
+ writer.print(" bgcolor=\"dddddd\"");
+ } else {
+ writer.print(" bgcolor=\"eeeeee\"");
+ }
+ writer.print(">\r\n");
+
+ NodeLock currentLock = (NodeLock) locksList.nextElement();
+
+ writer.print("<td align=\"left\"><tt>");
+ writer.print(currentLock.getSubjectUri());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"left\"><tt>");
+ writer.print(currentLock.getTypeUri());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt>");
+ writer.print
+ (formats[0].format(currentLock.getExpirationDate()));
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt>");
+ writer.print(currentLock.isInheritable());
+ writer.print("</tt></td>\r\n");
+
+ writer.print("<td align=\"right\"><tt>");
+ writer.print(currentLock.isExclusive());
+ writer.print("</tt></td>\r\n");
+
+ }
+
+ }
}