/** * @see org.apache.wicket.Component#isVisible() */ @Override public boolean isVisible() { return MySession.get().getFeedbackMessages().hasMessage(containerFeedbackMessageFilter); } };
/** * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class) */ @Override public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) { if (WebPage.class.isAssignableFrom(componentClass) == true) { if (MySession.get().isAuthenticated() == true) { return true; } if (AbstractSecuredBasePage.class.isAssignableFrom(componentClass) == true || AbstractSecuredBasePage.class.isAssignableFrom(componentClass) == true || AbstractSecuredMobilePage.class.isAssignableFrom(componentClass) == true) { return false; } } return true; }
final UserContext userContext = MySession.get().getUserContext(); final WebMarkupContainer tenantMenu = new WebMarkupContainer("currentTenant"); add(tenantMenu);
@Override public void onUnauthorizedInstantiation(final Component component) { if (MySession.get().isMobileUserAgent() == true) { throw new RestartResponseAtInterceptPageException(LoginMobilePage.class); } else { throw new RestartResponseAtInterceptPageException(LoginPage.class); } }
/** * Stores the given value for the current user. * * @param key * @param value * @param persistent If true, the object will be persisted in the database. * @see UserXmlPreferencesCache#putEntry(Integer, String, Object, boolean) */ public static void putEntry(final String key, final Object value, final boolean persistent) { final PFUserDO user = ThreadLocalUserContext.getUser(); if (user == null || value == null) { // Should only occur, if user is not logged in. return; } if (AccessChecker.isDemoUser(user) == true && value instanceof Serializable) { // Store user pref for demo user only in user's session. MySession.get().setAttribute(key, (Serializable) value); return; } try { getUserXmlPreferencesCache().putEntry(user.getId(), key, value, persistent); } catch (final Exception ex) { log.error("Should only occur in maintenance mode: " + ex.getMessage(), ex); } }
/** * Removes the entry under the given key. * * @param key * @return The removed entry if found. */ public static Object removeEntry(final String key) { final PFUserDO user = ThreadLocalUserContext.getUser(); if (user == null) { // Should only occur, if user is not logged in. return null; } if (AccessChecker.isDemoUser(user) == true) { MySession.get().removeAttribute(key); } return getUserXmlPreferencesCache().removeEntry(user.getId(), key); }