Example #1
0
 @Check("login")
 public static void index() {
   User curUser = User.find("byName", Secure.Security.connected()).first();
   if (curUser.type == UserType.ADMINISTRATOR) {
     redirect("/admin/crud");
   } else if (curUser.type == UserType.STUDENT) {
     Student.index();
   } else {
     Teacher.index();
   }
 }
Example #2
0
 public void beforeRoleCheck() {
   // Note that if you provide your own implementation of Secure's Security class you would refer
   // to that instead
   if (!Secure.Security.isConnected()) {
     try {
       if (!session.contains("username")) {
         flash.put("url", "GET".equals(request.method) ? request.url : "/");
         Secure.login();
       }
     } catch (Throwable t) {
       // handle this in an app-specific way
     }
   }
 }
Example #3
0
 public RoleHolder getRoleHolder() {
   String userName = Secure.Security.connected();
   return User.getByUserName(userName);
 }