roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r584210 - in /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices: atomprotocol/RollerAtomHandler.java xmlrpc/BaseAPIHandler.java xmlrpc/BloggerAPIHandler.java
Date Fri, 12 Oct 2007 17:41:23 GMT
Author: snoopdave
Date: Fri Oct 12 10:40:35 2007
New Revision: 584210

URL: http://svn.apache.org/viewvc?rev=584210&view=rev
Log:
Couple of tweaks to client APIs:
- Only include blogs that are client API enabled in lists in Blogger API getBlogs() 
- Only include blogs that are client API enabled in lists in AtomPub service doc
- Throw correct Apache XML-RPC exception on login failure 

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BaseAPIHandler.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BloggerAPIHandler.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java?rev=584210&r1=584209&r2=584210&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
Fri Oct 12 10:40:35 2007
@@ -186,14 +186,17 @@
         if (perms != null) {
             for (Iterator iter=perms.iterator(); iter.hasNext();) {
                 WeblogPermission perm = (WeblogPermission)iter.next();
-                String handle = perm.getWebsite().getHandle();
                 
+                // only include weblog's that have client API support enabled
+                if (!Boolean.TRUE.equals(perm.getWebsite().getEnableBloggerApi())) continue;
+                                
                 // Create workspace to represent weblog
                 Workspace workspace = new Workspace(
                     Utilities.removeHTML(perm.getWebsite().getName()), "text");
                 service.addWorkspace(workspace);
                 
                 // Create collection for entries within that workspace
+                String handle = perm.getWebsite().getHandle();
                 Collection entryCol = new Collection("Weblog Entries", "text", 
                     atomURL+"/"+handle+"/entries");
                 entryCol.addAccept("application/atom+xml;type=entry");

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BaseAPIHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BaseAPIHandler.java?rev=584210&r1=584209&r2=584210&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BaseAPIHandler.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BaseAPIHandler.java
Fri Oct 12 10:40:35 2007
@@ -32,6 +32,7 @@
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.util.Utilities;
+import org.apache.xmlrpc.common.XmlRpcNotAuthorizedException;
 
 /**
  * Base API handler does user validation, provides exception types, etc.
@@ -142,24 +143,19 @@
         }
         
         if ( !authenticated ) {
-            throw new XmlRpcException(
-                    AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
+            throw new XmlRpcNotAuthorizedException(AUTHORIZATION_EXCEPTION_MSG);
         }
         if ( !userEnabled ) {
-            throw new XmlRpcException(
-                    USER_DISABLED, USER_DISABLED_MSG);
+            throw new XmlRpcNotAuthorizedException(USER_DISABLED_MSG);
         }
         if ( !weblogEnabled ) {
-            throw new XmlRpcException(
-                    WEBLOG_DISABLED, WEBLOG_DISABLED_MSG);
+            throw new XmlRpcNotAuthorizedException(WEBLOG_DISABLED_MSG);
         }
         if ( !weblogFound ) {
-            throw new XmlRpcException(
-                    WEBLOG_NOT_FOUND, WEBLOG_NOT_FOUND_MSG);
+            throw new XmlRpcException(WEBLOG_NOT_FOUND, WEBLOG_NOT_FOUND_MSG);
         }
         if ( !apiEnabled ) {
-            throw new XmlRpcException(
-                    BLOGGERAPI_DISABLED, BLOGGERAPI_DISABLED_MSG);
+            throw new XmlRpcNotAuthorizedException(BLOGGERAPI_DISABLED_MSG);
         }
         return website;
     }
@@ -201,13 +197,11 @@
         }
         
         if ( !enabled ) {
-            throw new XmlRpcException(
-                    BLOGGERAPI_DISABLED, BLOGGERAPI_DISABLED_MSG);
+            throw new XmlRpcNotAuthorizedException(USER_DISABLED_MSG);
         }
         
         if ( !authenticated ) {
-            throw new XmlRpcException(
-                    AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
+            throw new XmlRpcNotAuthorizedException(AUTHORIZATION_EXCEPTION_MSG);
         }
         return authenticated;
     }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BloggerAPIHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BloggerAPIHandler.java?rev=584210&r1=584209&r2=584210&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BloggerAPIHandler.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/xmlrpc/BloggerAPIHandler.java
Fri Oct 12 10:40:35 2007
@@ -279,16 +279,21 @@
                 
                 UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
                 User user = umgr.getUserByUserName(userid);
+                
                 // get list of user's enabled websites
                 List websites = umgr.getWebsites(user, Boolean.TRUE, null, null, null, 0,
-1);
                 Iterator iter = websites.iterator();
                 while (iter.hasNext()) {
                     Weblog website = (Weblog)iter.next();
-                    Hashtable blog = new Hashtable(3);
-                    blog.put("url", website.getURL());
-                    blog.put("blogid", website.getHandle());
-                    blog.put("blogName", website.getName());
-                    result.add(blog);
+                    
+                    // only include weblog's that have client API support enabled
+                    if (Boolean.TRUE.equals(website.getEnableBloggerApi())) {
+                        Hashtable blog = new Hashtable(3);
+                        blog.put("url", website.getURL());
+                        blog.put("blogid", website.getHandle());
+                        blog.put("blogName", website.getName());
+                        result.add(blog);
+                    }
                 }
             } catch (Exception e) {
                 String msg = "ERROR in BlooggerAPIHander.getUsersBlogs";



Mime
View raw message