lila/app/controllers/Mod.scala

44 lines
1.1 KiB
Scala
Raw Normal View History

package controllers
import lila.app._
import views._
import lila.security.Permission
2013-05-16 16:00:28 -06:00
import lila.user.UserRepo
import play.api.mvc._
import play.api.mvc.Results._
object Mod extends LilaController {
private def modApi = Env.mod.api
private def modLogApi = Env.mod.logApi
2013-05-10 03:56:34 -06:00
def engine(username: String) = Secure(_.MarkEngine) { _
2014-01-16 01:46:01 -07:00
me modApi.adjust(me.id, username) inject redirect(username)
2013-05-10 03:56:34 -06:00
}
def troll(username: String) = Secure(_.MarkTroll) { _
2013-05-16 16:00:28 -06:00
me
2014-01-16 01:46:01 -07:00
modApi.troll(me.id, username) inject redirect(username)
2013-05-10 03:56:34 -06:00
}
def ban(username: String) = Secure(_.IpBan) { implicit ctx
2014-01-16 01:46:01 -07:00
me modApi.ban(me.id, username) inject redirect(username)
2013-05-10 03:56:34 -06:00
}
def ipban(ip: String) = Secure(_.IpBan) { implicit ctx
me modApi.ipban(me.id, ip)
}
2013-09-11 04:38:16 -06:00
def reopenAccount(username: String) = Secure(_.ReopenAccount) { implicit ctx
2014-01-16 01:46:01 -07:00
me modApi.reopenAccount(me.id, username) inject redirect(username)
2013-09-11 04:38:16 -06:00
}
2013-05-10 03:56:34 -06:00
def log = Auth { implicit ctx
me modLogApi.recent map { html.mod.log(_) }
}
2014-01-16 01:46:01 -07:00
def redirect(username: String) = Redirect(routes.User.show(username).url + "?mod")
}