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

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


*/
public class ListSurveyTag  extends TagSupport {
 
  public int doStartTag() throws JspException {
    try {
      UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);     
      ISurveyManager surveyManager = (ISurveyManager) ApsWebApplicationUtils.getBean(SurveySystemConstants.SURVEY_MANAGER, pageContext);
      boolean isQuestionnaire = this.getCategory() != null && this.getCategory().equals("questionnaire");
      List<Integer> list = surveyManager.getActiveSurveyByUser(currentUser, isQuestionnaire, this.isExpired());
      this.pageContext.setAttribute(this.getCtxName(), list);
    } catch (Throwable t) {
View Full Code Here


  @Override
  public int doStartTag() throws JspException {
    ITagCloudManager tagCloudManager = (ITagCloudManager) ApsWebApplicationUtils.getBean(JpcmstagcloudSystemConstants.TAG_CLOUD_MANAGER, this.pageContext);
    ServletRequest request =  this.pageContext.getRequest();
    try {
      UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      String tagCategoryCode = request.getParameter("tagCategoryCode");
      List<String> contentsId = tagCloudManager.loadPublicTaggedContentsId(tagCategoryCode, currentUser);
      this.pageContext.setAttribute(this.getListName(), contentsId);
      request.setAttribute("tagCategoryCode", tagCategoryCode);
    } catch (Throwable t) {
View Full Code Here

    return this.saveOperation(TicketOperation.OPERATIONS_CLOSE);
  }
 
  @Override
  protected boolean isAccessAllowed(Ticket ticket) {
    UserDetails currentUser = this.getCurrentUser();
    boolean allowed = false;
    int status = ticket.getStatus();
    if (this.getAuthorizationManager().isAuthOnPermission(currentUser, JpWttSystemConstants.WTT_ADMIN_PERMISSION)
        || (Ticket.STATES_ASSIGNABLE==status && this.userHasRole(ticket.getWttRole()))
        || Ticket.STATES_ASSIGNED==status && currentUser.getUsername().equals(ticket.getWttOperator())) {
      allowed = true;
    }
    return allowed;
  }
View Full Code Here

 
  public boolean isOperationAllowed(Ticket ticket, int operationCode) {
    boolean allowed = false;
    int status = ticket.getStatus();
    String operator = ticket.getWttOperator();
    UserDetails currentUser = this.getCurrentUser();
    boolean isAdmin = this.getAuthorizationManager().isAuthOnPermission(currentUser, JpWttSystemConstants.WTT_ADMIN_PERMISSION);
    switch (operationCode) {
      case TicketOperation.OPERATIONS_SETASSIGNABLE:
        if (isAdmin && (Ticket.STATES_OPENED==status || Ticket.STATES_WORKING==status)) {
          allowed = true;
        }
        break;
      case TicketOperation.OPERATIONS_TAKEINCHARGE:
        if ((isAdmin && (Ticket.STATES_OPENED==status || Ticket.STATES_WORKING==status))
            || (Ticket.STATES_ASSIGNABLE==status && this.userHasRole(ticket.getWttRole()))) {
          allowed = true;
        }
        break;
      case TicketOperation.OPERATIONS_ANSWER:
      case TicketOperation.OPERATIONS_UPDATE:
      case TicketOperation.OPERATIONS_CLOSE:
        if (Ticket.STATES_ASSIGNED==status && currentUser.getUsername().equals(operator)) {
          allowed = true;
        }
        break;
      case TicketOperation.OPERATIONS_RELEASE:
        if ((isAdmin && (Ticket.STATES_ASSIGNABLE==status || Ticket.STATES_ASSIGNED==status))
            || (Ticket.STATES_ASSIGNED==status && currentUser.getUsername().equals(operator))) {
          allowed = true;
        }
        break;
    }
    return allowed;
View Full Code Here

  }
 
  public void testGetEventsForMonth() throws Throwable {
    Calendar cal = this.createCalendar(1, Calendar.APRIL, 1999);
    this.setUserOnSession("guest");
    UserDetails user = (UserDetails) this.getRequestContext().getRequest().getSession()
        .getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    int[] eventsForMonth = _calendarManager.getEventsForMonth(cal, user);
    assertNotNull(eventsForMonth);
    // DEVE TROVARE SOLO EVN192 che parte dal 14-04 e finisce il 14-06
    assertEquals(0, eventsForMonth[2]);
View Full Code Here

    MockEventsOfDayDataBean bean = new MockEventsOfDayDataBean();
    bean.setAttributeNameStart(this._calendarManager.getConfig().getStartAttributeName());
    bean.setAttributeNameEnd(this._calendarManager.getConfig().getEndAttributeName());
    bean.setContentType(this._calendarManager.getConfig().getContentTypeCode());
    this.setUserOnSession("guest");
    UserDetails user = (UserDetails) this.getRequestContext().getRequest()
        .getSession().getAttribute(
            SystemConstants.SESSIONPARAM_CURRENT_USER);
    List<Group> userGroups = _authorizatorManager.getUserGroups(user);
    Set allowedGroup = new HashSet();
    allowedGroup.add(Group.FREE_GROUP_NAME);
View Full Code Here

  @Override
  public int doStartTag() throws JspException {
    HttpSession session = this.pageContext.getSession();
    ServletRequest request =  this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    IContentListWidgetHelper contentListHelper = (IContentListWidgetHelper) ApsWebApplicationUtils.getBean(JacmsSystemConstants.CONTENT_LIST_HELPER, this.pageContext);
    IContentActionHelper helper = (IContentActionHelper) ApsWebApplicationUtils.getBean(JpFastContentEditSystemConstants.FRONT_CONTENT_ACTION_HELPER, this.pageContext);
    try {
      Set<String> contentIds = new HashSet<String>();
      String authorAttributeName = helper.getAuthorAttributeName((HttpServletRequest) request);
      if (null != authorAttributeName && authorAttributeName.trim().length() > 0) {
        EntitySearchFilter authorFilter = new EntitySearchFilter(authorAttributeName, true, currentUser.getUsername(), false);
        this.addFilter(authorFilter);
        contentIds.addAll(contentListHelper.getContentsId(this, reqCtx));
        this._filters = new EntitySearchFilter[0];
      }
      EntitySearchFilter lastEditorFilter = new EntitySearchFilter(IContentManager.CONTENT_LAST_EDITOR_FILTER_KEY, false, currentUser.getUsername(), false);
      this.addFilter(lastEditorFilter);
      contentIds.addAll(contentListHelper.getContentsId(this, reqCtx));
                        this.pageContext.setAttribute(this.getVar(), contentIds);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
View Full Code Here

    this.removeFakeContents();
    super.tearDown();
  }

  public void testLoadPublicTaggedContentsId() throws Throwable {
    UserDetails user = this.getUser("admin");
    List<String> contentIds = this._tagCloudManager.loadPublicTaggedContentsId("cat1", user);
    compareIds(new String[]{"ART180"}, contentIds);

    contentIds = this._tagCloudManager.loadPublicTaggedContentsId("evento", user);
    compareIds(new String[]{"EVN192", "EVN193", "RAH101b", "ART120b"}, contentIds);
View Full Code Here

    contentIds = this._tagCloudManager.loadPublicTaggedContentsId("evento", user);
    compareIds(new String[]{"EVN192", "EVN193", "RAH101b"}, contentIds);
  }

  public void testGetCloudInfos() throws Throwable {
    UserDetails user = this.getUser("admin");
    Map<String, Integer> expected = new HashMap<String, Integer>();
    expected.put("cat1", new Integer(1));
    expected.put("evento", new Integer(4));
    expected.put("general", new Integer(5));
View Full Code Here

    try {
      this._calMan = (ICalendarManager) ApsWebApplicationUtils.getBean(CalendarConstants.CALENDAR_MANAGER, this.pageContext);
      IAuthorizationManager authorizatorManager = (IAuthorizationManager)
          ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, this.pageContext);
      this.extractRequiredDate();
      UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (authorizatorManager.isAuthOnGroup(currentUser, Group.ADMINS_GROUP_NAME)) {
        this.setAllowedGroups(null);
      } else {
        List<Group> userGroups = authorizatorManager.getUserGroups(currentUser);
        Set allowedGroup = new HashSet();
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.