All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openurp.starter.edu.action.IndexAction.scala Maven / Gradle / Ivy

There is a newer version: 0.3.46
Show newest version
/*
 * Copyright (C) 2014, The OpenURP Software.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see .
 */

package org.openurp.starter.edu.action

import org.beangle.ems.app.web.NavContext
import org.beangle.security.Securities
import org.beangle.security.realm.cas.{Cas, CasConfig}
import org.beangle.security.session.cache.CacheSessionRepo
import org.beangle.web.action.support.{ActionSupport, ServletSupport}
import org.beangle.web.action.annotation.action
import org.beangle.web.action.context.ActionContext
import org.beangle.web.action.view.View
import org.beangle.webmvc.support.action.EntityAction
import org.openurp.base.model.Project

/**
 * @author xinzhou
 */
@action("")
class IndexAction extends ActionSupport with EntityAction[Project] with ServletSupport {

  var casConfig: CasConfig = _
  var sessionRepo: CacheSessionRepo = _

  def index(): View = {
    put("nav", NavContext.get(request))
    forward()
  }

  def logout(): View = {
    Securities.session foreach { s =>
      sessionRepo.evict(s.id)
    }
    redirect(to(Cas.cleanup(casConfig, ActionContext.current.request, ActionContext.current.response)), null)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy