Package org.projectforge.user

Examples of org.projectforge.user.UserRightDO


    adminUser.setPasswordSalt(user.getPasswordSalt());
    adminUser.setLocalUser(true);
    adminUser.setLastname("Administrator");
    adminUser.setDescription("ProjectForge administrator");
    adminUser.setTimeZone(adminUserTimezone);
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_AUSGANGSRECHNUNGEN, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_COST_UNIT, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_EINGANGSRECHNUNGEN, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_DATEV_IMPORT, UserRightValue.TRUE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE_SALARY, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.FIBU_ACCOUNTS, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.ORGA_CONTRACTS, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.ORGA_INCOMING_MAIL, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.ORGA_OUTGOING_MAIL, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.PM_PROJECT, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.PM_ORDER_BOOK, UserRightValue.READWRITE));
    adminUser.addRight(new UserRightDO(UserRightId.PM_HR_PLANNING, UserRightValue.READWRITE));
    userDao.internalSave(adminUser);
    PFUserContext.setUser(adminUser); // Need to login the admin user for avoiding following access exceptions.

    final Set<PFUserDO> adminUsers = new HashSet<PFUserDO>();
    adminUsers.add(adminUser);
View Full Code Here


    addUser(TestBase.ADMIN);
    addUser(TestBase.TEST_ADMIN_USER, TestBase.TEST_ADMIN_USER_PASSWORD);
    PFUserDO user = new PFUserDO();
    user.setUsername(TestBase.TEST_FINANCE_USER);
    user//
    .addRight(new UserRightDO(UserRightId.FIBU_AUSGANGSRECHNUNGEN, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EINGANGSRECHNUNGEN, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE_SALARY, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_ACCOUNTS, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_COST_UNIT, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_ORDER_BOOK, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_PROJECT, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_HR_PLANNING, UserRightValue.READWRITE)); //
    addUser(user);
    user = new PFUserDO();
    user.setUsername(TestBase.TEST_FULL_ACCESS_USER);
    user//
    .addRight(new UserRightDO(UserRightId.FIBU_AUSGANGSRECHNUNGEN, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EINGANGSRECHNUNGEN, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_EMPLOYEE_SALARY, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_ACCOUNTS, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.FIBU_COST_UNIT, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_ORDER_BOOK, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_PROJECT, UserRightValue.READWRITE)) //
    .addRight(new UserRightDO(UserRightId.PM_HR_PLANNING, UserRightValue.READWRITE)); //
    userDao.createEncryptedPassword(user, TestBase.TEST_FULL_ACCESS_USER_PASSWORD);
    addUser(user);
    addUser(TestBase.TEST_USER, TestBase.TEST_USER_PASSWORD);
    addUser(TestBase.TEST_USER2);
    user = addUser(TestBase.TEST_DELETED_USER, TestBase.TEST_DELETED_USER_PASSWORD);
    userDao.internalMarkAsDeleted(user);
    addUser("user1");
    addUser("user2");
    addUser("user3");
    addUser(TestBase.TEST_CONTROLLING_USER);
    addUser(TestBase.TEST_MARKETING_USER);
    addUser(TestBase.TEST_PROJECT_MANAGER_USER);
    user = new PFUserDO();
    user.setUsername(TestBase.TEST_PROJECT_ASSISTANT_USER);
    user.addRight(new UserRightDO(UserRightId.PM_ORDER_BOOK, UserRightValue.PARTLYREADWRITE));
    addUser(user);
  }
View Full Code Here

    assertTrue(accessChecker.hasLoggedInUserSelectAccess(UserRightId.PM_HR_PLANNING, false));
    assertFalse(accessChecker.hasLoggedInUserSelectAccess(UserRightId.PM_HR_PLANNING, planning, false));
    assertFalse(accessChecker.hasLoggedInUserHistoryAccess(UserRightId.PM_HR_PLANNING, planning, false));
    assertFalse(accessChecker.hasLoggedInUserInsertAccess(UserRightId.PM_HR_PLANNING, planning, false));
    logon(TestBase.TEST_ADMIN_USER);
    user1.addRight(new UserRightDO(user1, UserRightId.PM_HR_PLANNING, UserRightValue.READONLY));
    userDao.update(user1);
    logon(user1);
    assertTrue(hrPlanningDao.hasLoggedInUserAccess(planning, null, OperationType.SELECT, false));
    assertTrue(accessChecker.hasLoggedInUserSelectAccess(UserRightId.PM_HR_PLANNING, planning, false));
    assertTrue(accessChecker.hasLoggedInUserHistoryAccess(UserRightId.PM_HR_PLANNING, planning, false));
View Full Code Here

      fail("Access exception expected.");
    } catch (final AccessException ex) {
      assertEquals("access.exception.userHasNotRight", ex.getI18nKey());
    }
    logon(TEST_ADMIN_USER);
    user.addRight(new UserRightDO(UserRightId.PM_ORDER_BOOK, UserRightValue.PARTLYREADWRITE)); //
    userDao.update(user);
    logon(user);
    try {
      auftrag = auftragDao.getById(id);
      fail("Access exception expected.");
    } catch (final AccessException ex) {
      assertEquals("access.exception.userHasNotRight", ex.getI18nKey());
    }
    logon(TEST_ADMIN_USER);
    final UserRightDO right = user.getRight(UserRightId.PM_ORDER_BOOK);
    right.setValue(UserRightValue.READWRITE); // Full access
    userRightDao.update(right);
    logon(user);
    auftrag = auftragDao.getById(id);
    logon(TEST_ADMIN_USER);
    right.setValue(UserRightValue.PARTLYREADWRITE);
    userRightDao.update(right);
    group.getAssignedUsers().add(user);
    groupDao.update(group); // User is now in project manager group.
    logon(user);
    auftrag = auftragDao.getById(id);
View Full Code Here

   */
  public boolean hasRight(final PFUserDO user, final UserRightId rightId, final boolean throwException, final UserRightValue... values)
  {
    Validate.notNull(user);
    Validate.notNull(values);
    final UserRightDO rightDO = user.getRight(rightId);
    final UserRight right = userRights.getRight(rightId);
    for (final UserRightValue value : values) {
      if ((rightDO == null || rightDO.getValue() == null) && right.matches(userGroupCache, user, value) == true) {
        return true;
      }
      if (rightDO != null && rightDO.getValue() == value) {
        if (right != null && right.isAvailable(userGroupCache, user, value) == true) {
          return true;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.projectforge.user.UserRightDO

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.