Package org.nemesis.forum

Examples of org.nemesis.forum.Forum


    ActionErrors errors = new ActionErrors();

    try {

      ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
      Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
      request.setAttribute("id", request.getParameter("id"));
      //check permission
      checkPermission(request, OperationConstants.ADD_GROUP_PERMISSION, forum);
     
      ProfileManager manager = forumFactory.getProfileManager();
      Group group = manager.getGroup(request.getParameter("actor"));
       
      int perm=Integer.parseInt(request.getParameter("type"));
      if(perm==Constants.FORUM_ADMIN && ! SecurityTools.isSystemAdmin(getAuthToken(request))){
         throw new UnauthorizedException();
      }
      forum.addGroupPermission(group, perm);
     
    } catch (NotFoundException e) {
      errors.add("general", new ActionError("forumPermission.NotFound"));
    } catch (UnauthorizedException ue) {
      errors.add("general", new ActionError("forumPermission.Unauthorized"));
View Full Code Here


     

      List v = new Vector();

      ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
      Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
      //check permission
      checkPermission(request, OperationConstants.LIST_FORUM_FILTER,forum);
      ForumFiltersBean fb = new ForumFiltersBean();
      fb.setId(forum.getID());
      fb.setName(forum.getName());
      fb.setDescription(forum.getDescription());
     
      MessageFilter[] installedFilters =forum.getForumMessageFilters();
      for( int i=0; i<installedFilters.length; i++ ) {
        FilterBean b=new FilterBean(i,installedFilters[i]);
         fb.addFilters(b);
      }
     
View Full Code Here

   
    ActionErrors errors = new ActionErrors();
   
    try {
        ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
        Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
        //check permission
        checkPermission(request,OperationConstants.LIST_FORUM_CONTENT,forum);
       
        ForumThread t=forum.getThread(Integer.parseInt(request.getParameter("threadID")));
        Message m=t.getMessage(Integer.parseInt(request.getParameter("messageID")));
        m.setApproved(!m.isApproved());
        if (t.getRootMessage().getID()==m.getID()) t.setApproved(m.isApproved());
       
       
View Full Code Here

    }

    try {

      ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
      Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));

      //check permission
      checkPermission(request, OperationConstants.EDIT_FORUM, forum);

      //first, populate
      if (request.getParameter("forumBean.id") == null) {
       
        ForumBean fb =new ForumBean();
        fb.setDescription(forum.getDescription());
        fb.setId(forum.getID());
        fb.setModerationType(forum.getModerationType());
        fb.setName(forum.getName());
        String key=null;
        for(Enumeration e= forum.propertyNames();e.hasMoreElements();){
          key=(String)e.nextElement();
          fb.setPropertie(key, forum.getProperty(key));
        }

        PropertyUtils.setProperty(form, "forumBean", fb);
        return mapping.findForward("view");
      }

      //save     
      ForumBean fb = (ForumBean) PropertyUtils.getProperty(form, "forumBean");
      forum.setModerationType(fb.getModerationType());
      forum.setDescription(fb.getDescription());
      //non forum.setName(fb.getDescription());
     
      //properties
      String temp = null;
      for (Iterator it = fb.getProperties().keySet().iterator(); it.hasNext();) {
        temp = (String) it.next();
        forum.setProperty(temp, (String) fb.getProperties().get(temp));
      }

    } catch (NumberFormatException aee) {
      errors.add("general", new ActionError("addForum.unauthorized"));
    } catch (UnauthorizedException aee) {     
View Full Code Here

    ActionErrors errors = new ActionErrors();

    try {

      ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
      Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
      request.setAttribute("id", request.getParameter("id"));
      //check permission
      checkPermission(request, OperationConstants.ADD_FORUM_FILTER, forum);
      Class c = Class.forName(Config.filtersClassNames[Integer.parseInt(request.getParameter("filter"))]);
      MessageFilter filter  = (MessageFilter)(c.newInstance());
      forum.addForumMessageFilter(filter);
     
    } catch (UnauthorizedException ue) {
      errors.add("general", new ActionError("addForumFilter.Unauthorized"));
    } catch (Exception e) {
      String eid = this.getClass().getName() + "_" + System.currentTimeMillis();
View Full Code Here

    Iterator forumIterator = forumFactory.forums();
    if (!forumIterator.hasNext()) {
      return false;
    }
    while (forumIterator.hasNext()) {
      Forum forum = (Forum) forumIterator.next();
      if (forum.hasPermission(Constants.FORUM_ADMIN)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

    this.permissions = permissions;
  }

  public Forum createForum(String name, String description) throws UnauthorizedException, ForumAlreadyExistsException {
    if (permissions.get(Constants.SYSTEM_ADMIN)) {
      Forum newForum = factory.createForum(name, description);
      return new ForumProxy(newForum, authorization, permissions);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

    Iterator forumIterator = forumFactory.forums();
    if (!forumIterator.hasNext()) {
      return false;
    }
    while (forumIterator.hasNext()) {
      Forum forum = (Forum) forumIterator.next();
      if (forum.hasPermission(Constants.MODERATOR)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

      throw new UnauthorizedException();
    }
  }

  public Forum getForum(int forumID) throws ForumNotFoundException, UnauthorizedException {
    Forum forum = factory.getForum(forumID);
    ForumPermissions forumPermissions = forum.getPermissions(authorization);
    //Create a new permissions object with the combination of the
    //permissions of this object and tempPermissions.
   
    //:ICI: ************************************************** ilya une erreur
   
View Full Code Here

    }
    return new ForumProxy(forum, authorization, newPermissions);
  }

  public Forum getForum(String name) throws ForumNotFoundException, UnauthorizedException {
    Forum forum = factory.getForum(name);
    ForumPermissions forumPermissions = forum.getPermissions(authorization);
    //Create a new permissions object with the combination of the
    //permissions of this object and tempPermissions.
    //:ICI: **************************************************
   
    ForumPermissions newPermissions = (/*new ForumPermissions(permissions,*/ forumPermissions);
View Full Code Here

TOP

Related Classes of org.nemesis.forum.Forum

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.