Commits

Sebastian Sdorra  committed 8c640bb

user user dao instead of user manager to pass permission checks

  • Participants
  • Parent commits cdb6cde
  • Branches apache-shiro

Comments (0)

Files changed (1)

File scm-webapp/src/main/java/sonia/scm/security/ScmRealm.java

 import sonia.scm.repository.RepositoryListener;
 import sonia.scm.repository.RepositoryManager;
 import sonia.scm.user.User;
+import sonia.scm.user.UserDAO;
 import sonia.scm.user.UserException;
 import sonia.scm.user.UserListener;
 import sonia.scm.user.UserManager;
    * @param groupManager
    * @param repositoryManager
    * @param repositoryDAO
+   * @param userDAO
    * @param authenticator
    */
   @Inject
   public ScmRealm(ScmConfiguration configuration, CacheManager cacheManager,
     UserManager userManager, GroupManager groupManager,
     RepositoryManager repositoryManager, RepositoryDAO repositoryDAO,
-    AuthenticationManager authenticator)
+    UserDAO userDAO, AuthenticationManager authenticator)
   {
     this.configuration = configuration;
     this.userManager = userManager;
     this.groupManager = groupManager;
     this.repositoryDAO = repositoryDAO;
+    this.userDAO = userDAO;
     this.authenticator = authenticator;
 
     // init cache
       checkForAuthenticatedAdmin(user, groupSet);
 
       // store user
-      User dbUser = userManager.get(user.getName());
+      User dbUser = userDAO.get(user.getName());
 
       if (dbUser != null)
       {
       // create new user
       else
       {
-        userManager.create(user);
+
+        // TODO fire event ??
+        user.setCreationDate(System.currentTimeMillis());
+        userDAO.add(user);
       }
 
       if (user.isActive())
   private RepositoryDAO repositoryDAO;
 
   /** Field description */
+  private UserDAO userDAO;
+
+  /** Field description */
   private UserManager userManager;
 }