[seam-commits] Seam SVN: r13412 - in modules/security/trunk: examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/action and 5 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Jul 16 03:34:36 EDT 2010


Author: shane.bryzak at jboss.com
Date: 2010-07-16 03:34:35 -0400 (Fri, 16 Jul 2010)
New Revision: 13412

Modified:
   modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
   modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/action/EntityManagerProducer.java
   modules/security/trunk/examples/idmconsole/src/main/resources/import.sql
   modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/RememberMe.java
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
   modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
Log:
transactions kind of working now, but something weird is still going on


Modified: modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
--- modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -216,17 +216,9 @@
     * @param name The user for which to return a list of roles
     * @return List containing the names of the granted roles
     */
-   Collection<Role> getGrantedRoles(String name);
+   Collection<Role> getUserRoles(String name);
    
    /**
-    * Returns a list of roles that are either explicitly or indirectly granted to the specified user.
-    * 
-    * @param name The user for which to return the list of roles
-    * @return List containing the names of the implied roles
-    */
-   List<Role> getImpliedRoles(String name);
-   
-   /**
     * Returns a list of all members that have been granted the specified role
     * 
     * @param roleType The role type of the role

Modified: modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/action/EntityManagerProducer.java
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/action/EntityManagerProducer.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/examples/idmconsole/src/main/java/org/jboss/seam/security/examples/idmconsole/action/EntityManagerProducer.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -1,6 +1,7 @@
 package org.jboss.seam.security.examples.idmconsole.action;
 
 import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
 import javax.enterprise.inject.Produces;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
@@ -10,5 +11,5 @@
 @Stateless
 public class EntityManagerProducer
 {
-   @Produces @ConversationScoped @PersistenceContext(unitName = "idmconsoleDatabase") EntityManager entityManager;
+   @Produces @RequestScoped @PersistenceContext(unitName = "idmconsoleDatabase") EntityManager entityManager;
 }

Modified: modules/security/trunk/examples/idmconsole/src/main/resources/import.sql
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/resources/import.sql	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/examples/idmconsole/src/main/resources/import.sql	2010-07-16 07:34:35 UTC (rev 13412)
@@ -7,6 +7,7 @@
 insert into IdentityObject (id, name, identity_object_type_id) values (1, 'shane', 1);
 insert into IdentityObject (id, name, identity_object_type_id) values (2, 'demo', 1);
 insert into IdentityObject (id, name, identity_object_type_id) values (3, 'Head Office', 2);
+insert into IdentityObject (id, name, identity_object_type_id) values (4, 'foo', 1);
 
 insert into IdentityObjectCredentialType (id, name) values (1, 'PASSWORD');
 

Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml	2010-07-16 07:34:35 UTC (rev 13412)
@@ -10,6 +10,12 @@
   </ui:define>
    
   <ui:define name="content">
+    <script type="text/javascript">
+      function confirmDelete() {
+        return confirm("Are you sure you wish to delete this user? This action cannot be undone.");
+      }
+    </script>  
+  
     <h3>Manage Users</h3>
    
     <h:form>
@@ -47,9 +53,9 @@
             <h:commandLink id="edit" value="Edit" action="#{userAction.editUser(user.username)}"/>
             <span> | </span>
           </ui:fragment>
-          <h:link id="delete" value="Delete" action="#{userAction.deleteUser(user.username)}" 
-                  rendered="#{identity.hasPermission('seam.identity', 'delete')}"
-                  onclick="return confirmDelete()"/>
+          <ui:fragment rendered="#{identity.hasPermission('seam.identity', 'delete')}">
+            <h:commandLink id="delete" value="Delete" action="#{userAction.deleteUser(user.username)}" onclick="return confirmDelete()"/>
+          </ui:fragment>
         </h:column>
       </h:dataTable>
     </h:form>

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/RememberMe.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/RememberMe.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/RememberMe.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -153,7 +153,7 @@
                   {
                      userEnabled.value = true;
 
-                     for (Role role : identityManager.getImpliedRoles(username))
+                     for (Role role : identityManager.getUserRoles(username))
                      {
                         roles.add(role);
                      }

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -71,7 +71,7 @@
       }
    }
    
-   public boolean deleteUser(String name)
+   public @Transactional boolean deleteUser(String name)
    {
       identity.checkPermission(RESOURCE_IDENTITY, PERMISSION_DELETE);
       
@@ -263,7 +263,7 @@
     * @param name The user for which to return a list of roles
     * @return List containing the names of the granted roles
     */
-   public Collection<Role> getGrantedRoles(String username)
+   public Collection<Role> getUserRoles(String username)
    {
       identity.checkPermission(RESOURCE_RELATIONSHIP, PERMISSION_READ);
       try
@@ -289,18 +289,6 @@
       }
    }
    
-   /**
-    * Returns a list of roles that are either explicitly or indirectly granted to the specified user.
-    * 
-    * @param name The user for which to return the list of roles
-    * @return List containing the names of the implied roles
-    */
-   public List<Role> getImpliedRoles(String username)
-   {
-      //return roleIdentityStore.listImpliedRoles(username);
-      return null;
-   }
-   
    public Collection<User> listRoleMembers(String roleType, String groupName, String groupType)
    {
       identity.checkPermission(RESOURCE_RELATIONSHIP, PERMISSION_READ);

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserAction.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -49,7 +49,7 @@
    {
       conversation.begin();
       this.username = username;
-      roles = identityManager.getGrantedRoles(username);
+      roles = identityManager.getUserRoles(username);
       enabled = identityManager.isUserEnabled(username);
       newUserFlag = false;
    }
@@ -119,7 +119,7 @@
          }
       }
       
-      Collection<Role> grantedRoles = identityManager.getGrantedRoles(username);
+      Collection<Role> grantedRoles = identityManager.getUserRoles(username);
       
       if (grantedRoles != null)
       {

Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java	2010-07-16 06:29:33 UTC (rev 13411)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java	2010-07-16 07:34:35 UTC (rev 13412)
@@ -5,17 +5,14 @@
 import java.util.Collection;
 import java.util.List;
 
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Model;
 import javax.inject.Inject;
-import javax.inject.Named;
 
 import org.jboss.seam.security.management.IdentityManager;
 import org.picketlink.idm.api.Role;
 import org.picketlink.idm.api.User;
 
- at Named
- at SessionScoped
-public class UserSearch implements Serializable
+public @Model class UserSearch implements Serializable
 {
    private static final long serialVersionUID = 8592034786339372510L;
 
@@ -39,10 +36,8 @@
    
    public String getUserRoles(String username)
    {
-      Collection<Role> roles = identityManager.getGrantedRoles(username);
-      
-      //if (roles == null) return "";
-      
+      Collection<Role> roles = identityManager.getUserRoles(username);
+            
       StringBuilder sb = new StringBuilder();
       
       for (Role role : roles)



More information about the seam-commits mailing list