Package com.agiletec.aps.system.services.user

Examples of com.agiletec.aps.system.services.user.UserDetails


    return (voter != null);
  }
  private static boolean isVotedByUser(SurveyRecord surveyInfo, HttpServletRequest request) throws ApsSystemException {
    //String remoteAddress = request.getRemoteAddr();
    IVoterManager voterManager = (IVoterManager) ApsWebApplicationUtils.getBean(SurveySystemConstants.SURVEY_VOTER_MANAGER, request);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);

    FieldSearchFilter usernameFilter = new FieldSearchFilter((IVoterManager.FIELD_USERNAME), currentUser.getUsername(), false);
    FieldSearchFilter surveyIdFilter = new FieldSearchFilter((IVoterManager.FIELD_SURVEY_ID), new Integer(surveyInfo.getId()), false);
    FieldSearchFilter[] filters = new FieldSearchFilter[]{usernameFilter, surveyIdFilter};

    List<Integer> voters = voterManager.searchVoters(filters);
    return (null != voters && !voters.isEmpty());
View Full Code Here


    ((List<SmallContentType>)contentTypes).addAll(allowed);
  }
 
  protected List<SmallContentType> getAllowedContentTypes() {
    HttpServletRequest request = ServletActionContext.getRequest();
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    return this.getContentActionHelper().getAllowedContentTypes(currentUser);
  }
View Full Code Here

   * @return True se l'utente corrente è abilitato all'eccesso al contenuto,
   * false in caso contrario.
   */
  @Override
  protected boolean isUserAllowed(Content content) {
    UserDetails currentUser = this.getCurrentUser();
    boolean isAllowed = this.getContentActionHelper().isUserAllowed(content, currentUser);
    return isAllowed;
  }
View Full Code Here

            if (null == content) return;
          String authorAttrName = this.getAuthorAttributeName(request);
        if (authorAttrName != null) {
          ITextAttribute authorAttribute = (ITextAttribute) content.getAttribute(authorAttrName);
          if (null != authorAttribute) {
            UserDetails user =  (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
            Lang defaultLang = super.getLangManager().getDefaultLang();
            authorAttribute.setText(user.getUsername(), defaultLang.getCode());
          }
        }
        } catch (Throwable t) {
          ApsSystemUtils.logThrowable(t, this, "updateEntity");
          throw new RuntimeException("Errore on updateEntity", t);
View Full Code Here

 
  @Override
  public int doEndTag() throws JspException {
    HttpSession session = this.pageContext.getSession();
    try {
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (null == currentUser || currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        return super.doEndTag();
      }
      IApiTokenizerManager apiTokenizerManager =
        (IApiTokenizerManager) ApsWebApplicationUtils.getBean(JpTokenApiSystemConstants.TOKENIZER_MANAGER, this.pageContext);
      this._value = apiTokenizerManager.getToken(currentUser.getUsername());
      this.evalValue();
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "doEndTag");
      throw new JspException("Error closing tag ", t);
    }
View Full Code Here

    List<String> result = null;
    try {
      if (this.hasCurrentUserPermission(Permission.SUPERUSER)) {
        return super.getContents();
      }
      UserDetails user = this.getCurrentUser();
      List<WorkflowSearchFilter> workflowFilters = ((IContentWorkFlowActionHelper) this.getContentActionHelper()).getWorkflowSearchFilters(user);
      if (workflowFilters.size() > 0) {
        List<String> allowedGroups = this.getContentGroupCodes();
        EntitySearchFilter[] filters = this.createFilters();
        String[] categories = null;
View Full Code Here

    try {
      HttpSession session = req.getSession();
      RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
      Lang lang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
      req.getSession().setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_LANG, lang);
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (!currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) session.getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null == userConfigBean || !currentUser.getUsername().equals(userConfigBean.getUsername())) {
          IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
          userConfigBean = pageUserConfigManager.getUserConfig(currentUser);
          if (null != userConfigBean) {
            session.setAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG, userConfigBean);
          } else {
View Full Code Here

    HttpServletRequest req =  (HttpServletRequest) this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
    try {
      IPageUserConfigManager pageUserConfigManager = (IPageUserConfigManager) ApsWebApplicationUtils.getBean(JpmyportalplusSystemConstants.PAGE_USER_CONFIG_MANAGER, pageContext);
      CustomPageConfig customPageConfig = null;
      UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) {
        customPageConfig = pageUserConfigManager.getGuestPageConfig(page, req);
      } else {
        PageUserConfigBean userConfigBean = (PageUserConfigBean) req.getSession().getAttribute(JpmyportalplusSystemConstants.SESSIONPARAM_CURRENT_CUSTOM_USER_PAGE_CONFIG);
        if (null != userConfigBean) {
          customPageConfig = userConfigBean.getConfig().get(page.getCode());
View Full Code Here

    super.setUp();
    this.init();
  }

  public void testGetUserConfig() throws Throwable {
    UserDetails user = this.getUser("editorCustomers");
    PageUserConfigBean config = this._pageUserConfigManager.getUserConfig(user);
    assertNotNull(config);
    assertEquals(1, config.getConfig().size());
    CustomPageConfig pageConfig = config.getConfig().get("jpmyportalplus_testpage");
    assertNotNull(pageConfig);
View Full Code Here

    assertEquals("jpmyportalplus_test_widget_3", showlets[6].getType().getCode());
    assertNull(showlets[7]);
  }

  public void testGetShowletToRender() throws Throwable {
    UserDetails user = this.getUser("editorCustomers");
    PageUserConfigBean config = this._pageUserConfigManager.getUserConfig(user);
    IPage page = this._pageManager.getPage("jpmyportalplus_testpage");
    CustomPageConfig pageConfig = config.getConfig().get("jpmyportalplus_testpage");
    Widget[] showlets = this._pageUserConfigManager.getShowletsToRender(page, pageConfig.getConfig());
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.user.UserDetails

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.