[seam-commits] Seam SVN: r9076 - in trunk/examples/seamspace: view and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sun Sep 21 19:55:14 EDT 2008
Author: shane.bryzak at jboss.com
Date: 2008-09-21 19:55:14 -0400 (Sun, 21 Sep 2008)
New Revision: 9076
Modified:
trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/ImagePermission.java
trunk/examples/seamspace/view/imagepermissiondetail.page.xml
Log:
JBSEAM-3315
Modified: trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/ImagePermission.java
===================================================================
--- trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/ImagePermission.java 2008-09-21 23:44:52 UTC (rev 9075)
+++ trunk/examples/seamspace/src/org/jboss/seam/example/seamspace/ImagePermission.java 2008-09-21 23:55:14 UTC (rev 9076)
@@ -14,6 +14,7 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Conversation;
+import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.security.Role;
import org.jboss.seam.security.SimplePrincipal;
import org.jboss.seam.security.management.IdentityManager;
@@ -114,8 +115,9 @@
this.selectedActions = selectedActions;
}
- public void applyPermissions()
+ public String applyPermissions()
{
+ // If the recipient isn't null, it means we're editing existing permissions
if (recipient != null)
{
List<Permission> grantedPermissions = new ArrayList<Permission>();
@@ -140,8 +142,15 @@
if (!grantedPermissions.isEmpty()) permissionManager.grantPermissions(grantedPermissions);
if (!revokedPermissions.isEmpty()) permissionManager.revokePermissions(revokedPermissions);
}
+ // otherwise this is a set of new permissions
else
{
+ if (selectedActions.size() == 0)
+ {
+ FacesMessages.instance().add("You must select at least one action");
+ return "failure";
+ }
+
List<Permission> permissions = new ArrayList<Permission>();
for (String role : selectedRoles)
@@ -171,6 +180,7 @@
permissionManager.grantPermissions(permissions);
}
Conversation.instance().endBeforeRedirect();
+ return "success";
}
public List<Member> getAvailableFriends()
Modified: trunk/examples/seamspace/view/imagepermissiondetail.page.xml
===================================================================
--- trunk/examples/seamspace/view/imagepermissiondetail.page.xml 2008-09-21 23:44:52 UTC (rev 9075)
+++ trunk/examples/seamspace/view/imagepermissiondetail.page.xml 2008-09-21 23:55:14 UTC (rev 9076)
@@ -4,6 +4,8 @@
<page>
<navigation from-action="#{imagePermission.applyPermissions}">
- <redirect view-id="/imagepermissions.xhtml"/>
+ <rule if-outcome="success">
+ <redirect view-id="/imagepermissions.xhtml"/>
+ </rule>
</navigation>
</page>
\ No newline at end of file
More information about the seam-commits
mailing list