/** * @param userId * @return User * @throws Exception */ public UserDetail getUserDetail(String userId) throws Exception { UserDetail ud = null; try { // Set the OrganizationSchema (if not already done) getOrganizationSchema(); // Get the user information UserRow ur = getOrganization().user.getUser(idAsInt(userId)); if (ur == null) { throw new AdminException( "DomainDriverManager.getUser", SilverpeasException.ERROR, "admin.EX_ERR_USER_NOT_FOUND", "user Id: '" + userId + "'"); } // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(ur.domainId); // Get User detail from specific domain try { ud = domainDriver.getUser(ur.specificId); } catch (AdminException e) { SilverTrace.error( "admin", "DomainDriverManager.getUser", "admin.MSG_ERR_GET_USER", "user Id: '" + userId + "', domain Id: '" + ur.domainId + "'", e); ud = new UserDetail(); ud.setLogin(ur.login); ud.setFirstName(ur.firstName); ud.setLastName(ur.lastName); ud.seteMail(ur.eMail); } // Fill silverpeas info of user details ud.setId(userId); ud.setSpecificId(ur.specificId); ud.setDomainId(idAsString(ur.domainId)); ud.setAccessLevel(ur.accessLevel); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.getUser", SilverpeasException.ERROR, "admin.EX_ERR_GET_USER", "user Id: '" + userId + "', domain Id: '" + userId + "'", e); } finally { releaseOrganizationSchema(); } return ud; }
@Override public void resetEncryptedPassword(UserDetail user, String encryptedPassword) throws Exception { try { // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(idAsInt(user.getDomainId())); // Update User detail in specific domain domainDriver.resetEncryptedPassword(user, encryptedPassword); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.resetEncryptedPassword", SilverpeasException.ERROR, "admin.EX_ERR_UPDATE_USER", "userId : " + user.getId(), e); } }
/** * @param user * @throws Exception */ @Override public void updateUserDetail(UserDetail user) throws Exception { try { // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(idAsInt(user.getDomainId())); // Update User detail in specific domain domainDriver.updateUserDetail(user); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.updateUser", SilverpeasException.ERROR, "admin.EX_ERR_UPDATE_USER", user.getFirstName() + " " + user.getLastName(), e); } }
/** * Create a new User. * * @param user * @return * @throws Exception */ @Override public String createUser(UserDetail user) throws Exception { try { // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(idAsInt(user.getDomainId())); // Create User in specific domain String sUserId = domainDriver.createUser(user); return sUserId; } catch (AdminException e) { throw new AdminException( "DomainDriverManager.createUser", SilverpeasException.ERROR, "admin.EX_ERR_ADD_USER", user.getFirstName() + " " + user.getLastName(), e); } }