Package se.rupy.sprout

Examples of se.rupy.sprout.User


    public String path() { return "/label"; }
    public void filter(Event event) throws Event, Exception {
      Object key = event.session().get("key");
     
      if(key != null) {
        User user = User.get(key);
       
        if(user != null && user.permit("ADMIN")) {
          return;
        }
      }
     
      event.output().println("<pre>unauthorized</pre>");
View Full Code Here


        Object key = event.session().get("key");
        Article article = Article.find(event.big("id"));
       
        if(article != null && ajax != null && body.length() > 0) {
          Comment comment = new Comment();
          User user = User.get(key);

          if(user == null) {
            comment.add(COMMENT_IP, event.remote());
          }
          else {
View Full Code Here

  public Article() {
    super(ARTICLE);
  }

  public int permit(Object key) throws SQLException {
    User user = User.get(key);

    if(user == null) {
      return NO;
    }

    try {
      Node node = (Node) child(USER).getFirst();

      if(user.getId() == node.getId()) {
        return USER;
      }
    }
    catch(NoSuchElementException e) {}

    if(user.child(GROUP, GROUP_NAME, "ADMIN") != null) {
      return ADMIN;
    }

    return NO;
  }
View Full Code Here

    return old;
  }

  public static Article get(Object key) throws SQLException {
    Article article = (Article) cache3.get(key);
    User user = (User) User.get(key);

    if(article == null && user != null) {
      article = new Article();
      article.add(user);
      cache3.put(key, article);
View Full Code Here

        String body = event.string("body");
        Object key = event.session().get("key");

        if(title.length() > 0 && body.length() > 0 && key != null) {
          Article article = get(key);
          User user = User.get(key);

          if(article.permit(key) == NO) {
            throw new Exception(Sprout.i18n("You are not authorized!"));
          }
View Full Code Here

TOP

Related Classes of se.rupy.sprout.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.