roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r571321 [2/2] - in /roller/branches/roller_4.1_dev/apps/weblogger: nbproject/ src/java/META-INF/ src/java/org/apache/roller/weblogger/business/ src/java/org/apache/roller/weblogger/business/jpa/ src/java/org/apache/roller/weblogger/business...
Date Thu, 30 Aug 2007 21:36:01 GMT
Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Comments.java Thu Aug 30 14:35:57 2007
@@ -36,7 +36,7 @@
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.pagers.CommentsPager;
 import org.apache.roller.weblogger.ui.struts2.util.KeyValueObject;
 import org.apache.roller.weblogger.util.cache.CacheManager;
@@ -84,8 +84,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.AUTHOR;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.POST;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetAdd.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetAdd.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetAdd.java Thu Aug 30 14:35:57 2007
@@ -11,8 +11,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.PingTarget;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.common.PingTargetAddBase;
 
 
@@ -32,8 +32,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermission() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermission() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargetEdit.java Thu Aug 30 14:35:57 2007
@@ -20,7 +20,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.common.PingTargetEditBase;
 
 
@@ -40,8 +40,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargets.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargets.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargets.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/CustomPingTargets.java Thu Aug 30 14:35:57 2007
@@ -24,7 +24,7 @@
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
 import org.apache.roller.weblogger.config.PingConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.common.PingTargetsBase;
 
 
@@ -48,8 +48,8 @@
         return true;
     }
     
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java Thu Aug 30 14:35:57 2007
@@ -30,8 +30,8 @@
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.pagers.EntriesPager;
 import org.apache.roller.weblogger.ui.struts2.util.KeyValueObject;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
@@ -68,8 +68,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.AUTHOR;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.POST;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java Thu Aug 30 14:35:57 2007
@@ -24,19 +24,19 @@
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.WeblogEntryManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
-import org.apache.roller.weblogger.util.MediacastException;
-import org.apache.roller.weblogger.util.cache.CacheManager;
-import org.apache.roller.weblogger.util.MailUtil;
 import org.apache.commons.lang.StringUtils;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.UserManager;
+import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
+import org.apache.roller.weblogger.util.MailUtil;
+import org.apache.roller.weblogger.util.MediacastException;
 import org.apache.roller.weblogger.util.MediacastResource;
 import org.apache.roller.weblogger.util.MediacastUtil;
+import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.struts2.interceptor.validation.SkipValidation;
 
 
@@ -59,8 +59,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.LIMITED;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.EDIT_DRAFT;
     }
     
     
@@ -72,25 +72,35 @@
     @SkipValidation
     public String execute() {
         
-        // if user is an author then post status defaults to PUBLISHED, otherwise PENDING
-        if(getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogUserPermission.AUTHOR)) {
+        WeblogPermission perm = null;
+        try {
+            // if user is an author then post status defaults to PUBLISHED, otherwise PENDING
+            UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
+            perm = umgr.getWeblogPermission(getActionWeblog(), getAuthenticatedUser());
+            
+        } catch (WebloggerException ex) {
+            // security interceptor should ensure this never happens
+            log.error("ERROR retrieving user's permission", ex);
+        }
+        
+        if (perm != null && perm.hasAction(WeblogPermission.ADMIN) && perm.hasAction(WeblogPermission.POST)) {
             getBean().setStatus(WeblogEntry.PUBLISHED);
         } else {
             getBean().setStatus(WeblogEntry.PENDING);
         }
-        
+
         // set entry locale based on weblog locale
         getBean().setLocale(getActionWeblog().getLocale());
-        
+
         // set comment defaults
         getBean().setAllowComments(getActionWeblog().getDefaultAllowComments());
         getBean().setCommentDays(new Integer(getActionWeblog().getDefaultCommentDays()));
-        
+
         // apply weblog default plugins
-        if(getActionWeblog().getDefaultPlugins() != null) {
+        if (getActionWeblog().getDefaultPlugins() != null) {
             getBean().setPlugins(StringUtils.split(getActionWeblog().getDefaultPlugins(), ","));
         }
-        
+
         return INPUT;
     }
     
@@ -125,7 +135,7 @@
                 }
                 
                 // if user does not have author perms then force PENDING status
-                if(!getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogUserPermission.AUTHOR)) {
+                if(!getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogPermission.POST)) {
                     entry.setStatus(WeblogEntry.PENDING);
                 }
             }

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java Thu Aug 30 14:35:57 2007
@@ -29,8 +29,8 @@
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.plugins.entry.WeblogEntryPlugin;
 import org.apache.roller.weblogger.business.search.IndexManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.core.RollerContext;
 import org.apache.roller.weblogger.ui.core.plugins.UIPluginManager;
 import org.apache.roller.weblogger.ui.core.plugins.WeblogEntryEditor;
@@ -202,7 +202,7 @@
     
     
     public boolean isUserAnAuthor() {
-        return getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogUserPermission.AUTHOR);
+        return getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogPermission.POST);
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java Thu Aug 30 14:35:57 2007
@@ -31,8 +31,8 @@
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.util.MailUtil;
 import org.apache.roller.weblogger.util.MediacastException;
@@ -70,8 +70,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.LIMITED;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.EDIT_DRAFT;
     }
     
     
@@ -143,7 +143,7 @@
                 }
                 
                 // if user does not have author perms then force PENDING status
-                if(!getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogUserPermission.AUTHOR)) {
+                if(!getActionWeblog().hasUserPermissions(getAuthenticatedUser(),WeblogPermission.POST)) {
                     entry.setStatus(WeblogEntry.PENDING);
                 }
             }

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java Thu Aug 30 14:35:57 2007
@@ -25,7 +25,7 @@
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.struts2.interceptor.validation.SkipValidation;
@@ -55,8 +55,8 @@
     }
     
     
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java Thu Aug 30 14:35:57 2007
@@ -25,7 +25,7 @@
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.struts2.interceptor.validation.SkipValidation;
@@ -53,8 +53,8 @@
     
     
     // author perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.AUTHOR;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.POST;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Maintenance.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Maintenance.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Maintenance.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Maintenance.java Thu Aug 30 14:35:57 2007
@@ -23,9 +23,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.search.IndexManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 
@@ -47,8 +46,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java Thu Aug 30 14:35:57 2007
@@ -26,8 +26,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.struts2.interceptor.ParameterAware;
 
@@ -56,8 +56,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     
@@ -73,36 +73,48 @@
         
         log.debug("Attempting to processing weblog permissions updates");
         
-        UserManager userMgr = WebloggerFactory.getWeblogger().getUserManager();
-        
-        List<WeblogUserPermission> permissions = getActionWeblog().getPermissions();
-        
-        // we have to copy the permissions list so that when we remove permissions
-        // below we don't get ConcurrentModificationExceptions
-        List<WeblogUserPermission> permsList = new ArrayList();
-        for( WeblogUserPermission perm : permissions ) {
-            permsList.add(perm);
-        }
-        
         int removed = 0;
         int changed = 0;
+        List<WeblogPermission>  permsList = new ArrayList<WeblogPermission>();
         try {
-            for( WeblogUserPermission perms : permsList ) {
+            UserManager userMgr = WebloggerFactory.getWeblogger().getUserManager();   
+            List<WeblogPermission> permissions = userMgr.getWeblogPermissions(getActionWeblog());
+
+            // we have to copy the permissions list so that when we remove permissions
+            // below we don't get ConcurrentModificationExceptions
+            for( WeblogPermission perm : permissions ) {
+                permsList.add(perm);
+            }
+        
+            for (WeblogPermission perms : permsList) {
                 
-                String sval = getParameter("perm-" + perms.getId());
+                String sval = getParameter("perm-" + perms.getWeblog().getId());
                 if (sval != null) {
-                    short val = Short.parseShort(sval);
+                    boolean error = false;
                     User user = getAuthenticatedUser();
-                    if (perms.getUser().getId().equals(user.getId()) && 
-                            val < perms.getPermissionMask()) {
-                        addError("memberPermissions.noSelfDemotions");
-                    } else if (val != perms.getPermissionMask()) {
-                        if (val == -1) {
-                            userMgr.removePermissions(perms);
+                    if (perms.getUser().getId().equals(user.getId())) {
+                        // if modifying self
+                        if (sval.equals(WeblogPermission.EDIT_DRAFT) 
+                            && (perms.hasAction(WeblogPermission.POST) || perms.hasAction(WeblogPermission.ADMIN))) {
+                            error = true;
+                            addError("memberPermissions.noSelfDemotions");
+                        }
+                        if (sval.equals(WeblogPermission.POST) && perms.hasAction(WeblogPermission.ADMIN)) {
+                            error = true;
+                            addError("memberPermissions.noSelfDemotions");
+                        }
+                        
+                    } 
+                    if (!error && !perms.hasAction(sval)) {
+                        if (sval == null) {
+                            WeblogPermission toRevoke = 
+                                    new WeblogPermission(perms.getWeblog(), 
+                                    perms.getUser(), 
+                                    WeblogPermission.ALL_ACTIONS);
+                            userMgr.revokeWeblogPermission(toRevoke);
                             removed++;
                         } else {
-                            perms.setPermissionMask(val);
-                            userMgr.savePermissions(perms);
+                            userMgr.setWeblogPermissionActions(perms, sval);
                             changed++;
                         }
                     }
@@ -110,10 +122,10 @@
             }
             
             if (removed > 0 || changed > 0) {
-                log.debug("Weblog permissions updated, flushing changes");
-                
+                log.debug("Weblog permissions updated, flushing changes");                
                 WebloggerFactory.getWeblogger().flush();
             }
+            
         } catch (Exception ex) {
             log.error("Error saving permissions on weblog - "+getActionWeblog().getHandle(), ex);
             // TODO: i18n

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java Thu Aug 30 14:35:57 2007
@@ -24,8 +24,8 @@
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.MailUtil;
 
@@ -54,8 +54,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     
@@ -110,11 +110,11 @@
         
         // check for existing permissions or invitation
         try {
-            WeblogUserPermission perms = umgr.getPermissions(getActionWeblog(), user);
+            WeblogPermission perm = umgr.getWeblogPermission(getActionWeblog(), user);
             
-            if (perms != null && perms.isPending()) {
+            if (perm != null && perm.isPending()) {
                 addError("inviteMember.error.userAlreadyInvited");
-            } else if (perms != null) {
+            } else if (perm != null) {
                 addError("inviteMember.error.userAlreadyMember");
             }
             
@@ -126,8 +126,9 @@
         
         // if no errors then send the invitation
         if(!hasActionErrors()) try {
-            
-            umgr.inviteUser(getActionWeblog(), user, Short.parseShort(getPermissionsMask()));
+            WeblogPermission perm = new WeblogPermission(getActionWeblog(), user, getPermissionsMask());
+            perm.setPending(true);
+            umgr.grantWeblogPermission(perm);
             WebloggerFactory.getWeblogger().flush();
             
             addMessage("inviteMember.userInvited");

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java Thu Aug 30 14:35:57 2007
@@ -37,7 +37,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 
 
@@ -72,8 +72,8 @@
     
     
     // admin perms required
-    public short requireWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requireWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java Thu Aug 30 14:35:57 2007
@@ -24,7 +24,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.referrers.RefererManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogReferrer;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
@@ -55,8 +55,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Resources.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Resources.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Resources.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Resources.java Thu Aug 30 14:35:57 2007
@@ -33,8 +33,8 @@
 import org.apache.roller.weblogger.business.FileManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.ThemeResource;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 
 
@@ -81,8 +81,8 @@
     
     
     // requires author role
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.AUTHOR;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.POST;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java Thu Aug 30 14:35:57 2007
@@ -23,11 +23,10 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
 import org.apache.roller.weblogger.pojos.Theme;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
 import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
@@ -56,8 +55,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java Thu Aug 30 14:35:57 2007
@@ -26,9 +26,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.config.WebloggerConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.Utilities;
@@ -58,8 +57,8 @@
     
     
     @Override
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateRemove.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateRemove.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateRemove.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateRemove.java Thu Aug 30 14:35:57 2007
@@ -23,7 +23,7 @@
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
@@ -51,8 +51,8 @@
     
     
     // must be a weblog admin to use this action
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java Thu Aug 30 14:35:57 2007
@@ -27,8 +27,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
 import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
@@ -59,8 +58,8 @@
     }
     
     
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java Thu Aug 30 14:35:57 2007
@@ -25,14 +25,13 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.themes.SharedTheme;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.Theme;
 import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
@@ -68,8 +67,8 @@
     }
     
     
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogConfig.java Thu Aug 30 14:35:57 2007
@@ -31,8 +31,8 @@
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.core.RollerContext;
 import org.apache.roller.weblogger.ui.core.plugins.UIPluginManager;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
@@ -69,8 +69,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogRemove.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogRemove.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogRemove.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/WeblogRemove.java Thu Aug 30 14:35:57 2007
@@ -21,8 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 
@@ -43,8 +42,8 @@
     
     
     // admin perms required
-    public short requiredWeblogPermissions() {
-        return WeblogUserPermission.ADMIN;
+    public String requiredWeblogPermissions() {
+        return WeblogPermission.ADMIN;
     }
     
     

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UIAction.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UIAction.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UIAction.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UIAction.java Thu Aug 30 14:35:57 2007
@@ -91,8 +91,8 @@
     }
     
     // default action permissions, no perms required
-    public short requiredWeblogPermissions() {
-        return -1;
+    public String requiredWeblogPermissions() {
+        return null;
     }
     
     // convenient way to tell if user being dealt with is an admin

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityEnforced.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityEnforced.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityEnforced.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityEnforced.java Thu Aug 30 14:35:57 2007
@@ -62,12 +62,13 @@
     
     /**
      * What are the required weblog permissions for this action, if any?
+     * Returns comma separaed list of required weblog permission actions
      *
      * This method only takes effect if both isUserRequired() and isWeblogRequired()
      * are 'true'.
      *
      * @return short The required weblog permissions, or -1 if no permissions required.
      */
-    public short requiredWeblogPermissions();
+    public String requiredWeblogPermissions();
     
 }

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityInterceptor.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityInterceptor.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityInterceptor.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/UISecurityInterceptor.java Thu Aug 30 14:35:57 2007
@@ -22,9 +22,11 @@
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 
 
 /**
@@ -50,7 +52,9 @@
             final UISecurityEnforced theAction = (UISecurityEnforced) action;
             
             // are we requiring an authenticated user?
-            if(theAction.isUserRequired()) {
+            if (theAction.isUserRequired()) {
+                
+                UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
                 
                 User authenticatedUser = ((UIAction)theAction).getAuthenticatedUser();
                 if(authenticatedUser == null) {
@@ -59,15 +63,15 @@
                 }
                 
                 // are we also enforcing a specific role?
-                if(theAction.requiredUserRole() != null) {
-                    if(!WebloggerFactory.getWeblogger().getUserManager().hasRole(theAction.requiredUserRole(), authenticatedUser)) {
+                if (theAction.requiredUserRole() != null) {
+                    if(!umgr.hasRole(theAction.requiredUserRole(), authenticatedUser)) {
                         log.debug("DENIED: user does not have role = "+theAction.requiredUserRole());
                         return "access-denied";
                     }
                 }
                 
                 // are we requiring a valid action weblog?
-                if(theAction.isWeblogRequired()) {
+                if (theAction.isWeblogRequired()) {
                     
                     Weblog actionWeblog = ((UIAction)theAction).getActionWeblog();
                     if(actionWeblog == null) {
@@ -76,10 +80,14 @@
                     }
                     
                     // are we also enforcing a specific weblog permission?
-                    if(theAction.requiredWeblogPermissions() > -1) {
+                    if (theAction.requiredWeblogPermissions() != null) {
+                        
+                        WeblogPermission required = new WeblogPermission(
+                                actionWeblog, 
+                                authenticatedUser, 
+                                theAction.requiredWeblogPermissions());
                         
-                        if(!actionWeblog.hasUserPermissions(authenticatedUser,
-                                theAction.requiredWeblogPermissions())) {
+                        if (!umgr.checkPermission(required, authenticatedUser)) {
                             log.debug("DENIED: user does not have required weblog permissions = "+
                                     theAction.requiredWeblogPermissions());
                             return "access-denied";

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java Thu Aug 30 14:35:57 2007
@@ -46,11 +46,11 @@
 import org.apache.roller.weblogger.business.startup.WebloggerStartup;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.util.RollerMessages.RollerMessage;
 
 
@@ -104,9 +104,8 @@
             Iterator websiteUserIter = websiteUsers.iterator();
             while (websiteUserIter.hasNext()) {
                 User websiteUser = (User)websiteUserIter.next();
-                if (entry.getWebsite().hasUserPermissions(
-                        
-                        websiteUser,WeblogUserPermission.AUTHOR)
+                if (entry.getWebsite().hasUserPermissions(                        
+                        websiteUser, WeblogPermission.POST)
                         && websiteUser.getEmailAddress() != null) {
                     reviewers.add(websiteUser.getEmailAddress());
                 }

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerMemberHandler.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerMemberHandler.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerMemberHandler.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerMemberHandler.java Thu Aug 30 14:35:57 2007
@@ -17,7 +17,6 @@
  */
 package org.apache.roller.weblogger.webservices.adminprotocol;
 
-import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -25,12 +24,11 @@
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import org.jdom.Document;
-import org.jdom.JDOMException;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.UserManager;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.webservices.adminprotocol.sdk.Entry;
 import org.apache.roller.weblogger.webservices.adminprotocol.sdk.EntrySet;
@@ -140,16 +138,15 @@
         // get all permissions: for all users, for all websites
         try {
             List users = getRoller().getUserManager().getUsers(null, null, null, 0, -1);
-            List perms = new ArrayList();
+            List<WeblogPermission> perms = new ArrayList<WeblogPermission>();
             for (Iterator i = users.iterator(); i.hasNext(); ) {
                 User user = (User)i.next();
-                List permissions = getRoller().getUserManager().getAllPermissions(user);
-                for (Iterator j = permissions.iterator(); j.hasNext(); ) {
-                    WeblogUserPermission pd = (WeblogUserPermission)j.next();
-                    perms.add(pd);
+                List<WeblogPermission> permissions = getRoller().getUserManager().getWeblogPermissions(user);
+                for (WeblogPermission perm : permissions) {
+                    perms.add(perm);
                 }
             }
-            EntrySet es = toMemberEntrySet((WeblogUserPermission[])perms.toArray(new WeblogUserPermission[0]));
+            EntrySet es = toMemberEntrySet(perms);
             return es;
         } catch (WebloggerException re) {
             throw new InternalException("ERROR: Could not get member collection", re);
@@ -162,14 +159,14 @@
         String username = muri.getUsername();
         
         try {
-            List perms;
+            List<WeblogPermission> perms;
             if (username == null) {
                 //get all entries for the given website handle
                 Weblog wd = getWebsiteData(handle);
                 if (wd == null) {
                     throw new NotFoundException("ERROR: Unknown weblog handle: " + handle);
                 }
-                perms = getRoller().getUserManager().getAllPermissions(wd);
+                perms = getRoller().getUserManager().getWeblogPermissions(wd);
             } else {
                 //get all entries for the given website handle & username
                 Weblog wd = getWebsiteData(handle);
@@ -180,14 +177,14 @@
                 if (ud == null) {
                     throw new NotFoundException("ERROR: Unknown user name: " + username);
                 }
-                WeblogUserPermission pd = getRoller().getUserManager().getPermissions(wd, ud);
+                WeblogPermission pd = getRoller().getUserManager().getWeblogPermission(wd, ud);
                 if (pd == null) {
                     throw new NotFoundException("ERROR: Could not get permissions for user name: " + username + ", handle: " + handle);
                 }
                 perms = Collections.singletonList(pd);
             }
             
-            EntrySet es = toMemberEntrySet((WeblogUserPermission[])perms.toArray(new WeblogUserPermission[0]));
+            EntrySet es = toMemberEntrySet(perms);
             return es;
         } catch (WebloggerException re) {
             throw new InternalException("ERROR: Could not get entry for handle: " + handle + ", username: " + username, re);
@@ -262,79 +259,78 @@
         try {
             UserManager mgr = getRoller().getUserManager();
             
-            List permissionsDatas= new ArrayList();
+            List<WeblogPermission> perms= new ArrayList<WeblogPermission>();
             for (int i = 0; i < c.getEntries().length; i++) {
                 MemberEntry entry = (MemberEntry)c.getEntries()[i];
-                WeblogUserPermission pd = toPermissionsData(entry);
-                mgr.savePermissions(pd);
+                WeblogPermission pd = toPermissionsData(entry);
+                mgr.grantWeblogPermission(pd);
                 getRoller().flush();
                 CacheManager.invalidate(pd.getUser());
-                CacheManager.invalidate(pd.getWebsite());
-                permissionsDatas.add(pd);
+                CacheManager.invalidate(pd.getWeblog());
+                perms.add(pd);
             }
-            return toMemberEntrySet((WeblogUserPermission[])permissionsDatas.toArray(new WeblogUserPermission[0]));
+            return toMemberEntrySet(perms);
         } catch (WebloggerException re) {
             throw new InternalException("ERROR: Could not create members", re);
         }
     }
     
-    private WeblogUserPermission toPermissionsData(MemberEntry entry) throws HandlerException {
+    private WeblogPermission toPermissionsData(MemberEntry entry) throws HandlerException {
         User ud = getUserData(entry.getName());
         Weblog wd = getWebsiteData(entry.getHandle());
-        WeblogUserPermission pd = new WeblogUserPermission();
-        pd.setUser(ud);
-        pd.setWebsite(wd);
-        pd.setPermissionMask(stringToMask(entry.getPermission()));
-        pd.setPending(false);
-        
-        return pd;
+        String actions = null;
+        if ("ADMIN".equals(entry.getPermission()))       actions = WeblogPermission.ADMIN;
+        else if ("AUTHOR".equals(entry.getPermission())) actions = WeblogPermission.POST;
+        else                                             actions = WeblogPermission.EDIT_DRAFT;
+        return new WeblogPermission(wd, ud, actions);        
     }
     
-    private WeblogUserPermission getPermissionsData(MemberEntry entry) throws HandlerException {
+    private WeblogPermission getPermissionsData(MemberEntry entry) throws HandlerException {
         return getPermissionsData(entry.getHandle(), entry.getName());
     }
     
-    private WeblogUserPermission getPermissionsData(String handle, String username) throws HandlerException {
+    private WeblogPermission getPermissionsData(String handle, String username) throws HandlerException {
         try {
             User ud = getUserData(username);
             Weblog wd = getWebsiteData(handle);
-            WeblogUserPermission pd = getRoller().getUserManager().getPermissions(wd, ud);
-            
+            WeblogPermission pd = getRoller().getUserManager().getWeblogPermission(wd, ud);            
             return pd;
+            
         } catch (WebloggerException re) {
             throw new InternalException("ERROR: Could not get permissions data for weblog handle: " + handle + ", user name: " + username, re);
         }
     }
     
     private MemberEntrySet updateMembers(MemberEntrySet c) throws HandlerException {
-        List permissionsDatas= new ArrayList();
+        List<WeblogPermission> permissionsDatas= new ArrayList<WeblogPermission>();
         for (int i = 0; i < c.getEntries().length; i++) {
             MemberEntry entry = (MemberEntry)c.getEntries()[i];
-            WeblogUserPermission pd = getPermissionsData(entry);
+            WeblogPermission pd = getPermissionsData(entry);
             if (pd == null) {
                 throw new NotFoundException("ERROR: Permissions do not exist for weblog handle: " + entry.getHandle() + ", user name: " + entry.getName());
             }
             updatePermissionsData(pd, entry);
             permissionsDatas.add(pd);
         }
-        return toMemberEntrySet((WeblogUserPermission[])permissionsDatas.toArray(new WeblogUserPermission[0]));
+        return toMemberEntrySet(permissionsDatas);
     }
     
     
-    private void updatePermissionsData(WeblogUserPermission pd, MemberEntry entry) throws HandlerException {
+    private void updatePermissionsData(WeblogPermission pd, MemberEntry entry) throws HandlerException {
         // only permission can be updated
         
         if (entry.getPermission() != null) {
-            pd.setPermissionMask(stringToMask(entry.getPermission()));
+            pd.setActions(stringToAction(entry.getPermission()));
         }
         
         try {
             User ud = getUserData(entry.getName());
             Weblog wd = getWebsiteData(entry.getHandle());
             
-            UserManager mgr = getRoller().getUserManager();
-            mgr.savePermissions(pd);
+            UserManager mgr = getRoller().getUserManager();           
+            mgr.setWeblogPermissionActions(pd, pd.getActions());
             getRoller().flush();
+            
             CacheManager.invalidate(ud);
             CacheManager.invalidate(wd);
         } catch (WebloggerException re) {
@@ -353,47 +349,52 @@
         }
         
         try {
-            WeblogUserPermission pd = getPermissionsData(handle, username);
-            WeblogUserPermission[] pds;
-            if (pd == null) {
-                throw new NotFoundException("ERROR: Permissions do not exist for weblog handle: " + handle + ", user name: " + username);
-            }
-            pds = new WeblogUserPermission[] { pd };
+            Weblog wd = getWebsiteData(handle);
+            User ud = getUserData(username);
+            WeblogPermission pd = new WeblogPermission(wd, ud, WeblogPermission.ALL_ACTIONS);
+
+            pd.setActions(WeblogPermission.ALL_ACTIONS);
             
             UserManager mgr = getRoller().getUserManager();
-            mgr.removePermissions(pd);
+            mgr.revokeWeblogPermission(pd);
             getRoller().flush();
             
-            User ud = getUserData(username);
             CacheManager.invalidate(ud);
-            Weblog wd = getWebsiteData(handle);
             CacheManager.invalidate(wd);
             
+            WeblogPermission deletedPerm = new WeblogPermission(wd, ud, WeblogPermission.ALL_ACTIONS);
+            List<WeblogPermission> pds = new ArrayList<WeblogPermission>();
+            pds.add(deletedPerm);
             EntrySet es = toMemberEntrySet(pds);
             return es;
+            
         } catch (WebloggerException re) {
             throw new InternalException("ERROR: Could not delete entry", re);
         }
     }
     
-    private MemberEntry toMemberEntry(WeblogUserPermission pd) {
-        if (pd == null) {
-            throw new NullPointerException("ERROR: Null permission data not allowed");
+    private MemberEntry toMemberEntry(WeblogPermission pd) throws HandlerException  {
+        try {
+            if (pd == null) {
+                throw new NullPointerException("ERROR: Null permission data not allowed");
+            }
+            MemberEntry me = new MemberEntry(pd.getWeblog().getHandle(), pd.getUser().getUserName(), getUrlPrefix());
+            me.setPermission(actionsToString(pd));
+            return me;
+            
+        } catch (WebloggerException ex) {
+            throw new InternalException("ERROR: getting user or weblog", ex);
         }
-        MemberEntry me = new MemberEntry(pd.getWebsite().getHandle(), pd.getUser().getUserName(), getUrlPrefix());
-        me.setPermission(maskToString(pd.getPermissionMask()));
-        
-        return me;
     }
-    private MemberEntrySet toMemberEntrySet(WeblogUserPermission[] pds) {
+    
+    private MemberEntrySet toMemberEntrySet(List<WeblogPermission> pds) throws HandlerException {
         if (pds == null) {
             throw new NullPointerException("ERROR: Null permission data not allowed");
         }
         
         List entries = new ArrayList();
-        for (int i = 0; i < pds.length; i++) {
-            WeblogUserPermission pd = pds[i];
-            Entry entry = toMemberEntry(pd);
+        for (WeblogPermission perm : pds) {
+            Entry entry = toMemberEntry(perm);
             entries.add(entry);
         }
         MemberEntrySet mes = new MemberEntrySet(getUrlPrefix());
@@ -402,34 +403,34 @@
         return mes;
     }
     
-    private static String maskToString(short mask) {
-        if (mask == WeblogUserPermission.ADMIN) {
+    private static String actionsToString(WeblogPermission perm) {
+        if (perm.hasAction(WeblogPermission.ADMIN)) {
             return MemberEntry.Permissions.ADMIN;
         }
-        if (mask == WeblogUserPermission.AUTHOR) {
+        if (perm.hasAction(WeblogPermission.POST)) {
             return MemberEntry.Permissions.AUTHOR;
         }
-        if (mask == WeblogUserPermission.LIMITED) {
+        if (perm.hasAction(WeblogPermission.EDIT_DRAFT)) {
             return MemberEntry.Permissions.LIMITED;
         }
         return null;
     }
     
     
-    private static short stringToMask(String s) {
+    private static String stringToAction(String s) {
         if (s == null) {
             throw new NullPointerException("ERROR: Null string not allowed");
         }
         if (s.equalsIgnoreCase(MemberEntry.Permissions.ADMIN)) {
-            return WeblogUserPermission.ADMIN;
+            return WeblogPermission.ADMIN;
         }
         if (s.equalsIgnoreCase(MemberEntry.Permissions.AUTHOR)) {
-            return WeblogUserPermission.AUTHOR;
+            return WeblogPermission.POST;
         }
         if (s.equalsIgnoreCase(MemberEntry.Permissions.LIMITED)) {
-            return WeblogUserPermission.LIMITED;
+            return WeblogPermission.EDIT_DRAFT;
         }
-        return 0;
+        return null;
     }
 }
 

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java Thu Aug 30 14:35:57 2007
@@ -22,7 +22,6 @@
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Collections;
 import java.util.Date;
@@ -34,9 +33,9 @@
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.util.Utilities;
 import org.apache.roller.weblogger.webservices.adminprotocol.sdk.Entry;
@@ -306,22 +305,25 @@
         if (uds == null) {
             throw new NullPointerException("ERROR: Null user data not allowed");
         }
-        
-        WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());
-        List entries = new ArrayList();
-        for (int i = 0; i < uds.length; i++) {
-            User ud = uds[i];
-            List permissions = ud.getPermissions();
-            for (Iterator j = permissions.iterator(); j.hasNext(); ) {
-                WeblogUserPermission pd = (WeblogUserPermission)j.next();
-                Weblog wd = pd.getWebsite();
-                WeblogEntry we = toWeblogEntry(wd);
-                entries.add(we);
+        try {
+            UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
+            WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());
+            List entries = new ArrayList();
+            for (int i = 0; i < uds.length; i++) {
+                User ud = uds[i];
+                List<WeblogPermission> perms = umgr.getWeblogPermissions(ud);
+                for (WeblogPermission perm : perms) {
+                    Weblog wd = perm.getWeblog();
+                    WeblogEntry we = toWeblogEntry(wd);
+                    entries.add(we);
+                }
             }
+            wes.setEntries((Entry[])entries.toArray(new Entry[0]));
+            return wes;
+            
+        } catch (WebloggerException ex) {
+            throw new InternalException("ERROR retrieving users weblogs", ex);
         }
-        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
-        
-        return wes;
     }
     
     private WeblogEntrySet toWeblogEntrySet(Weblog[] wds) throws HandlerException {

Modified: roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java Thu Aug 30 14:35:57 2007
@@ -38,7 +38,6 @@
 import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.User;
-import org.apache.roller.weblogger.pojos.WeblogUserPermission;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
@@ -70,6 +69,7 @@
 import org.apache.roller.weblogger.pojos.RuntimeConfigProperty;
 import org.apache.roller.weblogger.pojos.WeblogEntryTag;
 import org.apache.roller.weblogger.pojos.ThemeResource;
+import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 
 /**
@@ -174,7 +174,7 @@
         AtomService service = new AtomService();
         List perms = null;
         try {
-            perms = roller.getUserManager().getAllPermissions(user);
+            perms = roller.getUserManager().getWeblogPermissions(user);
         } catch (WebloggerException re) {
             throw new AtomException("Getting user's weblogs", re);
         }
@@ -186,25 +186,29 @@
         }
         if (perms != null) {
             for (Iterator iter=perms.iterator(); iter.hasNext();) {
-                WeblogUserPermission perm = (WeblogUserPermission)iter.next();
-                String handle = perm.getWebsite().getHandle();
-                
-                // 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
-                Collection entryCol = new Collection("Weblog Entries", "text", 
-                    atomURL+"/"+handle+"/entries");
-                entryCol.setAccept("application/atom+xml;type=entry");
+                WeblogPermission perm = (WeblogPermission)iter.next();
+                Workspace workspace = null;
+                Weblog weblog = null;
                 try {  
+                    String handle = perm.getWeblog().getHandle();
+
+                    // Create workspace to represent weblog
+                    workspace = new Workspace(
+                        Utilities.removeHTML(perm.getWeblog().getName()), "text");
+                    service.addWorkspace(workspace);
+
+                    // Create collection for entries within that workspace
+                    Collection entryCol = new Collection("Weblog Entries", "text", 
+                        atomURL+"/"+handle+"/entries");
+                    entryCol.setAccept("application/atom+xml;type=entry");
+                    
                     // Add fixed categories using scheme that points to 
                     // weblog because categories are weblog specific
+                    weblog = perm.getWeblog();
                     Categories cats = new Categories();
                     cats.setFixed(true);
-                    cats.setScheme(getWeblogCategoryScheme(perm.getWebsite()));
-                    List rollerCats = roller.getWeblogEntryManager().getWeblogCategories(perm.getWebsite(), false);
+                    cats.setScheme(getWeblogCategoryScheme(weblog));
+                    List rollerCats = roller.getWeblogEntryManager().getWeblogCategories(weblog, false);
                     for (Iterator it = rollerCats.iterator(); it.hasNext();) {
                         WeblogCategory rollerCat = (WeblogCategory)it.next();
                         Category cat = new Category();
@@ -220,25 +224,26 @@
                     tags.setFixed(false);
                     entryCol.addCategories(tags);
                     
+                    workspace.addCollection(entryCol);
+
+                    // Add media collection for upload dir
+                    Collection uploadCol = new Collection("Media Files", "text", 
+                        atomURL+"/"+handle+"/resources/");
+                    uploadCol.setAccept(accept);
+                    workspace.addCollection(uploadCol);
+                    
                 } catch (Exception e) {
                     throw new AtomException("Fetching weblog categories");
                 }                               
-                workspace.addCollection(entryCol);
-
-                // Add media collection for upload dir
-                Collection uploadCol = new Collection("Media Files", "text", 
-                    atomURL+"/"+handle+"/resources/");
-                uploadCol.setAccept(accept);
-                workspace.addCollection(uploadCol);
 
                 // And add one media collection for each of weblog's upload sub-directories
                 ThemeResource[] dirs;
                 try {
-                    dirs = roller.getFileManager().getDirectories(perm.getWebsite());
+                    dirs = roller.getFileManager().getDirectories(weblog);
                     for (int i=0; i<dirs.length; i++) {
                         Collection uploadSubCol = new Collection(
                             "Media Files: " + dirs[i].getPath(), "text",
-                            atomURL+"/"+handle+"/resources/" + dirs[i].getPath());
+                            atomURL+"/"+weblog.getHandle()+"/resources/" + dirs[i].getPath());
                         uploadSubCol.setAccept(accept);
                         workspace.addCollection(uploadSubCol);
                     }
@@ -940,7 +945,7 @@
      */
     private boolean canEdit(Weblog website) {
         try {
-            return website.hasUserPermissions(this.user,WeblogUserPermission.AUTHOR);
+            return website.hasUserPermissions(this.user, WeblogPermission.POST);
         } catch (Exception e) {
             log.error("Checking website.hasUserPermissions()");
         }

Modified: roller/branches/roller_4.1_dev/apps/weblogger/web/WEB-INF/jsps/core/MainMenu.jsp
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.1_dev/apps/weblogger/web/WEB-INF/jsps/core/MainMenu.jsp?rev=571321&r1=571320&r2=571321&view=diff
==============================================================================
--- roller/branches/roller_4.1_dev/apps/weblogger/web/WEB-INF/jsps/core/MainMenu.jsp (original)
+++ roller/branches/roller_4.1_dev/apps/weblogger/web/WEB-INF/jsps/core/MainMenu.jsp Thu Aug 30 14:35:57 2007
@@ -33,14 +33,14 @@
         </s:text>
         
         <s:url action="menu!accept" id="acceptInvite">
-            <s:param name="inviteId" value="#invite.id" />
+            <s:param name="inviteId" value="#invite.weblog.id" />
         </s:url>
         <a href='<s:property value="acceptInvite" />'>
             <s:text name="yourWebsites.accept" />
         </a> 
         &nbsp;|&nbsp;
         <s:url action="menu!decline" id="declineInvite">
-            <s:param name="inviteId" value="#invite.id" />
+            <s:param name="inviteId" value="#invite.weblog.id" />
         </s:url>
         <a href='<s:property value="declineInvite" />'>
             <s:text name="yourWebsites.decline" />



Mime
View raw message