Package org.nemesis.forum.exception

Examples of org.nemesis.forum.exception.UnauthorizedException


  public void setDescription(String description) throws UnauthorizedException {
    if (permissions.isSystemOrForumAdmin()) {
      forum.setDescription(description);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here


  public void setCreationDate(Date creationDate) throws UnauthorizedException {
    if (permissions.isSystemOrForumAdmin()) {
      forum.setCreationDate(creationDate);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public void setModifiedDate(Date modifiedDate) throws UnauthorizedException {
    if (permissions.isSystemOrForumAdmin()) {
      forum.setModifiedDate(modifiedDate);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public void setProperty(String name, String value) throws UnauthorizedException {
    if (permissions.isSystemOrForumAdmin()) {
      forum.setProperty(name, value);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public ForumThread createThread(Message rootMessage) throws UnauthorizedException {
    if (permissions.get(Constants.CREATE_THREAD)) {
      ForumThread thread = forum.createThread(rootMessage);
      return new ForumThreadProxy(thread, authorization, permissions);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

      //that user. Otherwise, throw an exception.
      if (user.hasPermission(Constants.USER_ADMIN) || user.isAnonymous()) {
        Message message = forum.createMessage(user);
        return new MessageProxy(message, authorization, permissions);
      } else {
        throw new UnauthorizedException();
      }

    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public void deleteThread(ForumThread thread) throws UnauthorizedException {
    if (permissions.isSystemOrForumAdmin() || permissions.get(Constants.MODERATOR)) {
      forum.deleteThread(thread);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

    //If the user is an amdin of both forums
    if (permissions.isSystemOrForumAdmin()
      && (newForum.hasPermission(Constants.SYSTEM_ADMIN) || newForum.hasPermission(Constants.FORUM_ADMIN))) {
      forum.moveThread(thread, newForum);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public void addThread(ForumThread thread) throws UnauthorizedException {
    if (permissions.get(Constants.CREATE_THREAD)) {
      forum.addThread(thread);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public void addUserPermission(User user, int permissionType) throws UnauthorizedException {
    //Don't let someone become a System Admin through this method.
    //The ForumPermissions class probably needs to be changed.
    if (permissionType == Constants.SYSTEM_ADMIN) {
      throw new UnauthorizedException();
    }
    if (permissions.isSystemOrForumAdmin()) {
      forum.addUserPermission(user, permissionType);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

TOP

Related Classes of org.nemesis.forum.exception.UnauthorizedException

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.