/** * @param rightId * @param throwException * @see #hasRight(IUserRightId, boolean, UserRightValue...) */ @Override public boolean hasLoggedInUserReadAccess(final IUserRightId rightId, final boolean throwException) { return hasReadAccess(ThreadLocalUserContext.getUser(), rightId, throwException); }
/** * @param dbObj The original object (stored in the database) * @param obj * @throws AccessException */ protected void checkLoggedInUserUpdateAccess(final O obj, final O dbObj) throws AccessException { checkUpdateAccess(ThreadLocalUserContext.getUser(), obj, dbObj); }
/** * @param obj Check access to this object. * @return * @see #hasLoggedInUserAccess(Object, Object, OperationType, boolean) */ public boolean hasLoggedInUserSelectAccess(final O obj, final boolean throwException) { return hasSelectAccess(ThreadLocalUserContext.getUser(), obj, throwException); }
/** * Checks write access of the readWriteUserRight. If not given, true is returned at default. This method should only * be used for checking the insert access to show an insert button or not. Before inserting any object the write * access is checked by has*Access(...) independent of the result of this method. * * @see org.projectforge.framework.persistence.api.IDao#hasLoggedInUserInsertAccess() */ @Override public boolean hasLoggedInUserInsertAccess() { return hasInsertAccess(ThreadLocalUserContext.getUser()); }
/** * Tests for every group the user is assigned to, if the given permission is given. * * @return true, if the user owns the required permission, otherwise false. */ public boolean hasLoggedInUserPermission(final Integer taskId, final AccessType accessType, final OperationType operationType, final boolean throwException) { return hasPermission(ThreadLocalUserContext.getUser(), taskId, accessType, operationType, throwException); }
/** * Checks if the user is in one of the given groups. If not, an AccessException will be thrown. * * @see #isUserMemberOfGroup(ProjectForgeGroup...) */ @Override public void checkIsLoggedInUserMemberOfGroup(final ProjectForgeGroup... groups) { checkIsUserMemberOfGroup(ThreadLocalUserContext.getUser(), groups); }
/** * Checks if the user of the ThreadLocalUserContext (logged in user) is member at least of one of the given groups. * * @param throwException default false. * @param groups * @see #isUserMemberOfGroup(PFUserDO, ProjectForgeGroup...) */ public boolean isLoggedInUserMemberOfGroup(final boolean throwException, final ProjectForgeGroup... groups) { return isUserMemberOfGroup(ThreadLocalUserContext.getUser(), throwException, groups); }
/** * Is the current context user in at minimum one group of the groups assigned to the given user? * * @param user * @return */ public boolean isLoggedInUserInSameGroup(final PFUserDO user) { return areUsersInSameGroup(ThreadLocalUserContext.getUser(), user); }
@Override public boolean hasLoggedInUserHistoryAccess(final IUserRightId rightId, final Object obj, final boolean throwException) { return hasHistoryAccess(ThreadLocalUserContext.getUser(), rightId, obj, throwException); }
/** * @param parentPage * @param data */ public SkillRatingEditForm(final SkillRatingEditPage parentPage, final SkillRatingDO data) { super(parentPage, data); data.setUser(ThreadLocalUserContext.getUser()); }
/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { return report != null && StringUtils.isNotBlank(report.getFormattedVacationCount()) && vacationService.couldUserUseVacationService( ThreadLocalUserContext.getUser(), false); } }.suppressLabelForWarning();
/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { return report != null && StringUtils.isNotBlank(report.getFormattedVacationPlandCount()) && vacationService.couldUserUseVacationService( ThreadLocalUserContext.getUser(), false); } }.suppressLabelForWarning();
@Override protected void onSaveOrModify(final MemoDO obj) { super.onSaveOrModify(obj); obj.setOwner(ThreadLocalUserContext.getUser()); // Set always the logged-in user as owner. }
@Override public boolean isDemoUser() { final PFUserDO user = ThreadLocalUserContext.getUser(); if (user == null) { return false; } return isDemoUser(user.getId()); }
@Override public boolean isVisible() { // Is visible if no user is given or the given user is not the current logged in user. final PFUserDO user = UserSelectPanel.this.getModelObject(); return showSelectMeButton == true && (user == null || user.getId().equals(ThreadLocalUserContext.getUser().getId()) == false); } };
/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { // Is visible if no user is given or the given user is not the current logged in user. final PFUserDO user = UserSelectPanel.this.getModelObject(); return showSelectMeButton == true && (user == null || user.getId().equals(ThreadLocalUserContext.getUser().getId()) == false); } };
/** * @return The locale of the user if exists, otherwise default locale. * @see #getUser() * @see PFUserDO#getLocale() */ public final static Locale getLocale() { final PFUserDO user = getUser(); return user != null && user.getLocale() != null ? user.getLocale() : getLocale(null); }
@Override public void onClick(final AjaxRequestTarget target) { UserSelectPanel.this.setModelObject(ThreadLocalUserContext.getUser()); markTextFieldModelAsChanged(); target.add(this, userTextField); // For hiding entry. }
private void checkAdminUser() { if (Login.getInstance().isAdminUser(ThreadLocalUserContext.getUser()) == false) { throw new AccessException(AccessCheckerImpl.I18N_KEY_VIOLATION_USER_NOT_MEMBER_OF, ProjectForgeGroup.ADMIN_GROUP.getKey()); } }
private UserPrefDO initUserPref(final UserPrefDO userPref, final UserPrefArea area, final Object object) { userPref.setArea(area); userPref.setUser(ThreadLocalUserContext.getUser()); if (object != null) { userPrefDao.addUserPrefParameters(userPref, object); } else { userPrefDao.addUserPrefParameters(userPref, area); } return userPref; }