Package se.rupy.content

Source Code of se.rupy.content.Label$Permit

package se.rupy.content;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;

import se.rupy.http.Event;
import se.rupy.http.Query;
import se.rupy.http.Service;
import se.rupy.sprout.Node;
import se.rupy.sprout.Sprout;
import se.rupy.sprout.User;

public abstract class Label extends Sprout {
  public static class Permit extends Service {
    public int index() { return 2; }
    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>");
      throw event;
    }
  }
 
  public static class Edit extends Service {
    public int index() { return 3; }
    public String path() { return "/label"; }
    public void filter(Event event) throws Event, Exception {
      if(event.query().method() == Query.POST) {
        event.query().parse();
     
        // TODO
     
        Sprout.redirect(event);
      }
    }
  }
}
TOP

Related Classes of se.rupy.content.Label$Permit

TOP
Copyright © 2018 www.massapi.com. 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.