Package org.projectforge.user

Examples of org.projectforge.user.UserDao


        dbUpdateTable.addAttributes("updateDate", "regionId", "versionString", "executionResult", "executedBy", "description");
        dao.createTable(dbUpdateTable);
        dao.addTableAttributes(userTable, new TableAttribute(PFUserDO.class, "dateFormat"));
        dao.addTableAttributes(userTable, new TableAttribute(PFUserDO.class, "excelDateFormat"));
        dao.addTableAttributes(userTable, new TableAttribute(PFUserDO.class, "timeNotation"));
        final UserDao userDao = Registry.instance().getDao(UserDao.class);
        dao.createMissingIndices();
        userDao.getUserGroupCache().setExpired();
        return UpdateRunningStatus.DONE;
      }
    });
    return list;
  }
View Full Code Here


   * @return The url for downloading calendars (without context), e. g. /export/ProjectForge.ics?user=...
   */
  public static String getUrl(final String additionalParams)
  {
    final PFUserDO user = PFUserContext.getUser();
    final UserDao userDao = Registry.instance().getDao(UserDao.class);
    final String authenticationKey = userDao.getAuthenticationToken(user.getId());
    final StringBuffer buf = new StringBuffer();
    buf.append("token=").append(authenticationKey);
    if (additionalParams != null) {
      buf.append(additionalParams);
    }
View Full Code Here

   * @param userKey
   * @return a calendar, null if authentication fails
   */
  private Calendar createCal(final Map<String, String> params, final Integer userId, final String authKey, final String timesheetUserParam)
  {
    final UserDao userDao = Registry.instance().getDao(UserDao.class);
    final PFUserDO loggedInUser = userDao.getUserByAuthenticationToken(userId, authKey);

    if (loggedInUser == null) {
      return null;
    }
    PFUserDO timesheetUser = null;
    if (StringUtils.isNotBlank(timesheetUserParam) == true) {
      final Integer timesheetUserId = NumberHelper.parseInteger(timesheetUserParam);
      if (timesheetUserId != null) {
        if (timesheetUserId.equals(loggedInUser.getId()) == false) {
          log.error("Not yet allowed: all users are only allowed to download their own time-sheets.");
          return null;
        }
        timesheetUser = userDao.getUserGroupCache().getUser(timesheetUserId);
        if (timesheetUser == null) {
          log.error("Time-sheet user with id '" + timesheetUserParam + "' not found.");
          return null;
        }
      }
View Full Code Here

  public void testAuthentication() throws IOException, ServletException, InterruptedException
  {
    ProjectForgeApp.init(null, null);
    WicketApplication.internalSetUpAndRunning(true);
    final HttpServletResponse response = mock(HttpServletResponse.class);
    final UserDao userDao = mock(UserDao.class);
    when(userDao.authenticateUser(Mockito.eq("successUser"), Mockito.eq("successPassword"))).thenReturn(
        new PFUserDO().setUsername("successUser"));
    when(userDao.getCachedAuthenticationToken(Mockito.eq(2))).thenReturn("token");
    final UserGroupCache userGroupCache = mock(UserGroupCache.class);
    when(userDao.getUserGroupCache()).thenReturn(userGroupCache);
    when(userGroupCache.getUser(Mockito.eq(2))).thenReturn(new PFUserDO().setUsername("testuser"));
    final RestUserFilter filter = new RestUserFilter();
    filter.userDao = userDao;

    // Wrong password
View Full Code Here

TOP

Related Classes of org.projectforge.user.UserDao

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.