Package org.damour.base.client.objects

Examples of org.damour.base.client.objects.User


  public PermissibleObject getNextUnratedPermissibleObject(String objectType) throws SimpleMessageException {
    if (StringUtils.isEmpty(objectType)) {
      throw new SimpleMessageException("Type not supplied.");
    }
    PermissibleObject object = null;
    User authUser = getAuthenticatedUser(session.get());
    object = RatingHelper.getNextUnratedPermissibleObject(session.get(), objectType, authUser, getVoterGUID());
    return object;
  }
View Full Code Here


  public UserAdvisory getUserAdvisory(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());

      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
        throw new SimpleMessageException("User is not authorized to get advisory on this content.");
View Full Code Here

  public UserAdvisory setUserAdvisory(PermissibleObject permissibleObject, int advisory) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("PermissibleObject not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    Transaction tx = session.get().beginTransaction();
    try {
      permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId());

      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
View Full Code Here

      throw new SimpleMessageException("Comment not supplied.");
    }
    if (comment.getParent() == null) {
      throw new SimpleMessageException("PermissibleObject not supplied with comment.");
    }
    User authUser = getAuthenticatedUser(session.get());
    Transaction tx = session.get().beginTransaction();
    try {
      PermissibleObject parentPermissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, comment.getParent().getId());
      parentPermissibleObject.setNumComments(parentPermissibleObject.getNumComments() + 1);
      comment.setParent(parentPermissibleObject);
View Full Code Here

  public Boolean approveComment(Comment comment) throws SimpleMessageException {
    if (comment == null) {
      throw new SimpleMessageException("Comment not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException(".");
    }
    Transaction tx = session.get().beginTransaction();
    try {
View Full Code Here

  public Boolean deleteComment(Comment comment) throws SimpleMessageException {
    if (comment == null) {
      throw new SimpleMessageException("Comment not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }
    Transaction tx = session.get().beginTransaction();
    try {
View Full Code Here

  public PermissibleObject getPermissibleObject(Long id) throws SimpleMessageException {
    if (id == null) {
      throw new SimpleMessageException("Id not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    try {
      PermissibleObject permissibleObject = (PermissibleObject) session.get().load(PermissibleObject.class, id);
      if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
        throw new SimpleMessageException("User is not authorized to get this content.");
      }
View Full Code Here

    }
  }

  public RepositoryTreeNode getRepositoryTree() throws SimpleMessageException {
    try {
      User authUser = getAuthenticatedUser(session.get());
      RepositoryTreeNode root = new RepositoryTreeNode();
      RepositoryHelper.buildRepositoryTreeNode(session.get(), authUser, root, null);
      return root;
    } catch (Throwable t) {
      Logger.log(t);
View Full Code Here

  public PermissibleObject savePermissibleObject(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("Object not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null && permissibleObject instanceof IAnonymousPermissibleObject) {
      authUser = UserHelper.getUser(session.get(), "anonymous");
    }
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
View Full Code Here

  public void deletePermissibleObject(PermissibleObject permissibleObject) throws SimpleMessageException {
    if (permissibleObject == null) {
      throw new SimpleMessageException("Object not supplied.");
    }
    User authUser = getAuthenticatedUser(session.get());
    if (authUser == null) {
      throw new SimpleMessageException("User is not authenticated.");
    }
    Transaction tx = session.get().beginTransaction();

    permissibleObject = ((PermissibleObject) session.get().load(PermissibleObject.class, permissibleObject.getId()));

    try {
      if (permissibleObject instanceof Folder) {
        Folder folder = (Folder) permissibleObject;
        if (!authUser.isAdministrator() && !authUser.equals(folder.getOwner())) {
          throw new SimpleMessageException("User is not authorized to delete this object.");
        }
        FolderHelper.deleteFolder(session.get(), folder);
      } else {
        if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.WRITE)) {
View Full Code Here

TOP

Related Classes of org.damour.base.client.objects.User

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.