Package controllers

Source Code of controllers.BaseController

package controllers;

import models.Event;
import models.User;
import play.mvc.Controller;
import securesocial.core.Identity;
import securesocial.core.java.SecureSocial;

/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
*/
public class BaseController extends Controller {

    protected static User getLoggedUser() {
        Identity socialUser = (Identity) ctx().args.get(SecureSocial.USER_KEY);
        User user = User.findByEmail(socialUser.email().get());
        return user;
    }


    protected static Event getEvent() {
        Event event = Event.findByUrl(request().host());
        if (event == null) {
           // event = Event.getDefaut(request().host());
        }
        return event;
    }
}
TOP

Related Classes of controllers.BaseController

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.