[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action ...

Christian Bauer christian at hibernate.org
Sun Apr 22 16:00:15 EDT 2007


  User: cbauer  
  Date: 07/04/22 16:00:15

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/action 
                        UserHome.java
  Log:
  Added feature: Manual account creation (for admins)
  
  Revision  Changes    Path
  1.8       +5 -1      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UserHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- UserHome.java	22 Apr 2007 19:19:29 -0000	1.7
  +++ UserHome.java	22 Apr 2007 20:00:14 -0000	1.8
  @@ -86,8 +86,11 @@
           } else {
               UserManagementPreferences userMgmtPrefs =
                       (UserManagementPreferences) Component.getInstance("userManagementPreferences");
  -            if (!userMgmtPrefs.isEnableRegistration())
  +            if (!userMgmtPrefs.isEnableRegistration() &&
  +                !Identity.instance().hasPermission("User", "isAdmin", Component.getInstance("currentUser"))) {
                   throw new RuntimeException("User registration has been disabled");
  +            }
  +
               defaultRole = (Role)Component.getInstance("newUserDefaultRole");
           }
       }
  @@ -115,6 +118,7 @@
   
           if (Identity.instance().hasPermission("User", "isAdmin", Component.getInstance("currentUser"))) {
               // Current user is admin and creating a new account, the new account is active automatically
  +            getInstance().setActivated(true);
               return super.persist();
           } else {
               // Set activation code (unique user in time)
  
  
  



More information about the jboss-cvs-commits mailing list