Package com.javaeye.jert.interceptor

Source Code of com.javaeye.jert.interceptor.SetupDoneInterceptor

package com.javaeye.jert.interceptor;

import com.javaeye.core.Application;
import com.javaeye.jert.service.SecurityService;
import com.javaeye.user.Group;
import com.javaeye.user.UserManager;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.interceptor.Interceptor;

/**
* @author   Quake Wang
* @since    2005-1-16
* @version $Revision: 1.2 $
*/
public class SetupDoneInterceptor implements Interceptor {

    public void destroy() {
        // TODO Auto-generated method stub
       
    }

    public void init() {
        // TODO Auto-generated method stub
       
    }
   
    public String intercept(ActionInvocation invocation) throws Exception {
        UserManager userManager = (UserManager) Application.getInstance().getContainer().getComponent(UserManager.class);
        Group adminGroup = userManager.getGroup(SecurityService.ADMIN);
        if(adminGroup != null && adminGroup.getUsers().size() > 0) {
            return "setupDone";
        }else{
            return invocation.invoke();
        }
    }
}
TOP

Related Classes of com.javaeye.jert.interceptor.SetupDoneInterceptor

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.