)(ProjectForm.apply)(ProjectForm.unapply)
)
- def createProject = Action { implicit request =>
- var logInUser = UserForm("")
- request.headers.get("remote_user").map { user =>
- logInUser = UserForm(user)
- }
- Ok(views.html.createProjectForm(projectRegistForm.fill(ProjectForm("", logInUser))))
+ def createProject = AuthAction {
+ Action { implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ var logInUser = UserForm("")
+ request.headers.get("remote_user").map { user =>
+ logInUser = UserForm(user)
+ }
+ Ok(views.html.createProjectForm(projectRegistForm.fill(ProjectForm("", logInUser))))
+ }
}
+ }
def projectRegistration() = Action {implicit request =>
projectRegistForm.bindFromRequest.fold(
)
}
- def updateProject(id: Long) = Action { implicit request =>
- inTransaction {
- val project = ProjectManager().getById(id)
- val projectForm = ProjectForm(project.name, null)
- Ok(views.html.updateProjectForm(projectRegistForm.fill(projectForm), id, project))
+ def updateProject(id: Long) = AuthAction {
+ Action { implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ inTransaction {
+ val project = ProjectManager().getById(id)
+ val projectForm = ProjectForm(project.name, null)
+ Ok(views.html.updateProjectForm(projectRegistForm.fill(projectForm), id, project))
+ }
+ }
}
}
)
}
- def projectMemberDelete(projectId:Long, memberId:Long) = Action {
- inTransaction {
- ProjectManager().deleteMember(projectId, memberId)
- Home.flashing("success" -> "Project %s has been update".format("ID=" +memberId))
+ def projectMemberDelete(projectId:Long, memberId:Long) = AuthAction {
+ Action {implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ inTransaction {
+ ProjectManager().deleteMember(projectId, memberId)
+ Home.flashing("success" -> "Project %s has been update".format("ID=" +memberId))
+ }
+ }
}
}
- def list(page: Int, key: String) = Action{ implicit request =>
- inTransaction {
- val row = Integer.decode(Messages("list.row"))
- val buff = ProjectManager().list(key)
- Ok(views.html.projectlist(buff.page(page*row, row), buff.size, key, page))
+ def list(page: Int, key: String) = AuthAction {
+ Action{ implicit request =>
+ if(request == null) {
+ Ok(views.html.errors.errorNotAuthentication())
+ } else {
+ inTransaction {
+ val row = Integer.decode(Messages("list.row"))
+ val buff = ProjectManager().list(key)
+ Ok(views.html.projectlist(buff.page(page*row, row), buff.size, key, page))
+ }
+ }
}
}
-
}
\ No newline at end of file