Commit 1d11b6a0 authored by Florian Fittkau's avatar Florian Fittkau

init commit

parents
This diff is collapsed.
target
target-eclipse
web-app/tmp/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>scrumboard</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.grails.ide.eclipse.core.nature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<locationURI>GRAILS_ROOT/2.1.0/projects/scrumboard/plugins</locationURI>
</link>
</linkedResources>
</projectDescription>
#Created by grails
eclipse.preferences.version=1
groovy.dont.generate.class.files=true
eclipse.preferences.version=1
encoding//.link_to_grails_plugins/cache-headers-1.1.5/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/cache-headers-1.1.5/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/cached-resources-1.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/cached-resources-1.0/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/constraints-0.8.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/constraints-0.8.0/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/hibernate-2.1.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/hibernate-2.1.0/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/jquery-1.7.2/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/jquery-1.7.2/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/jquery-ui-1.8.15/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/jquery-ui-1.8.15/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/jquery-validation-1.9/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/jquery-validation-1.9/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/jquery-validation-ui-1.4/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/jquery-validation-ui-1.4/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/mail-1.0/grails-app/i18n/messages_fr.properties=UTF-8
encoding//.link_to_grails_plugins/resources-1.1.6/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/resources-1.1.6/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/shiro-1.1.4/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/shiro-1.1.4/grails-app/i18n/messages.properties=UTF-8
encoding//.link_to_grails_plugins/zipped-resources-1.0/grails-app/i18n=UTF-8
encoding//.link_to_grails_plugins/zipped-resources-1.0/grails-app/i18n/messages.properties=UTF-8
encoding//grails-app/i18n=UTF-8
encoding//grails-app/i18n/messages.properties=UTF-8
encoding//grails-app/i18n/messages_cs_CZ.properties=UTF-8
encoding//grails-app/i18n/messages_da.properties=UTF-8
encoding//grails-app/i18n/messages_de.properties=UTF-8
encoding//grails-app/i18n/messages_es.properties=UTF-8
encoding//grails-app/i18n/messages_fr.properties=UTF-8
encoding//grails-app/i18n/messages_it.properties=UTF-8
encoding//grails-app/i18n/messages_ja.properties=UTF-8
encoding//grails-app/i18n/messages_nl.properties=UTF-8
encoding//grails-app/i18n/messages_pl.properties=UTF-8
encoding//grails-app/i18n/messages_pt_BR.properties=UTF-8
encoding//grails-app/i18n/messages_pt_PT.properties=UTF-8
encoding//grails-app/i18n/messages_ru.properties=UTF-8
encoding//grails-app/i18n/messages_sv.properties=UTF-8
encoding//grails-app/i18n/messages_th.properties=UTF-8
encoding//grails-app/i18n/messages_zh_CN.properties=UTF-8
encoding//grails-app/i18n/shiro.properties=UTF-8
eclipse.preferences.version=1
groovy.compiler.level=18
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="grails.app" version="1.0"/>
</faceted-project>
eclipse.preferences.version=1
org.grails.ide.eclipse.core.org.grails.ide.eclipse.core.install.name=Grails 2.1.0
org.grails.ide.eclipse.core.use.default.install=false
This diff is collapsed.
#Grails Metadata file
#Sat Oct 06 20:54:42 CEST 2012
app.grails.version=2.1.0
app.name=scrumboard
app.version=0.1
plugins.browser-detection=0.4.1
plugins.cache-headers=1.1.5
plugins.cached-resources=1.0
plugins.constraints=0.8.0
plugins.jquery-ui=1.8.15
plugins.lesscss-resources=1.3.0.3
plugins.mail=1.0
plugins.shiro=1.1.4
plugins.webdriver=0.4.1
plugins.wslite=0.7.1.0
plugins.zipped-resources=1.0
modules = {
mainstyle {
resource url:'/less/main.less'
resource url:'/css/dummy.css'
}
core {
dependsOn 'jquery, jquery-ui'
resource url:'/less/main.less'
resource url:'/less/elements.less'
resource url:'/css/dummy.css'
}
mobile {
//dependsOn 'jquery'
resource url:'/less/mobile.less'
resource url:'/css/dummy.css'
}
}
\ No newline at end of file
import org.apache.shiro.crypto.hash.Sha256Hash
import scrumboard.ProductBacklog
import scrumboard.Project
import scrumboard.Sprint
import scrumboard.UserStory
import scrumboard.UserStoryStatus;
import scrumboard.shiro.User
import scrumboard.shiro.Role
class BootStrap {
def init = { servletContext ->
createUsersAndRoles()
createExampleProject()
}
private createUsersAndRoles() {
def developerRole = new Role(name: "Entwickler")
developerRole.addToPermissions("*:*")
def ffi = new User(username: "ffi", passwordHash: new Sha256Hash("ffi").toHex())
ffi.addToRoles(developerRole)
ffi.save(failOnError: true)
def guestRole = new Role(name: "Gast")
guestRole.addToPermissions("*:*")
def guest = new User(username: "Gast", passwordHash: new Sha256Hash("gast").toHex())
guest.addToRoles(guestRole)
guest.save(failOnError: true)
}
private createExampleProject() {
def fmcockpit = new Project(name: "FMcockpit")
def productBacklog = new ProductBacklog()
def userStoryInBacklog = new UserStory(title: "Energiekataster Layer",
description: "Energiekataster Layer im GIS um &uuml;ber jeder VE die Energieausweise direkt zu sehen.")
def ffi = User.findByUsername("ffi")
userStoryInBacklog.shortId = "V-1"
userStoryInBacklog.author = ffi
userStoryInBacklog.editor = ffi
userStoryInBacklog.points = 3
productBacklog.addToUserstories(userStoryInBacklog)
def sprintOne = new Sprint(number: 1)
def userStoryInSprint = new UserStory(title: "Volltextsuche im GIS",
description: "Wenn man nach einer VE oder einer Adresse sucht, sollte diese in den Ergebnissen ber&uuml;cksichtigt werden.")
userStoryInSprint.shortId = "V-2"
userStoryInSprint.author = ffi
userStoryInSprint.editor = ffi
userStoryInSprint.points = 2
userStoryInSprint.status = UserStoryStatus.OPEN
sprintOne.addToUserstories(userStoryInSprint)
sprintOne.due_date = new Date()
fmcockpit.addToSprints(sprintOne)
fmcockpit.setProductBacklog(productBacklog)
fmcockpit.save(failOnError: true)
}
def destroy = {
}
}
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.20'
}
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.2"
runtime ":resources:1.1.6"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.4"
build ":tomcat:$grailsVersion"
runtime ":database-migration:1.1"
compile ':cache:1.0.0'
}
}
// locations to search for config files that get merged into the main config;
// config files can be ConfigSlurper scripts, Java properties files, or classes
// in the classpath in ConfigSlurper format
// grails.config.locations = [ "classpath:${appName}-config.properties",
// "classpath:${appName}-config.groovy",
// "file:${userHome}/.grails/${appName}-config.properties",
// "file:${userHome}/.grails/${appName}-config.groovy"]
// if (System.properties["${appName}.config.location"]) {
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
// }
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
grails.mime.use.accept.header = false
grails.mime.types = [
all: '*/*',
atom: 'application/atom+xml',
css: 'text/css',
csv: 'text/csv',
form: 'application/x-www-form-urlencoded',
html: ['text/html','application/xhtml+xml'],
js: 'text/javascript',
json: ['application/json', 'text/json'],
multipartForm: 'multipart/form-data',
rss: 'application/rss+xml',
text: 'text/plain',
xml: ['text/xml', 'application/xml']
]
// URL Mapping Cache Max Size, defaults to 5000
//grails.urlmapping.cache.maxsize = 1000
// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
// The default codec used to encode data with ${}
grails.views.default.codec = "none" // none, html, base64
grails.views.gsp.encoding = "UTF-8"
grails.converters.encoding = "UTF-8"
// enable Sitemesh preprocessing of GSP pages
grails.views.gsp.sitemesh.preprocess = true
// scaffolding templates configuration
grails.scaffolding.templates.domainSuffix = 'Instance'
// Set to false to use the new Grails 1.2 JSONBuilder in the render method
grails.json.legacy.builder = false
// enabled native2ascii conversion of i18n properties files
grails.enable.native2ascii = true
// packages to include in Spring bean scanning
grails.spring.bean.packages = []
// whether to disable processing of multi part requests
grails.web.disable.multipart=false
// request parameters to mask when logging exceptions
grails.exceptionresolver.params.exclude = ['password']
// configure auto-caching of queries by default (if false you can cache individual queries with 'cache: true')
grails.hibernate.cache.queries = false
environments {
development {
grails.logging.jul.usebridge = true
}
production {
grails.logging.jul.usebridge = false
// TODO: grails.serverURL = "http://www.changeme.com"
}
}
// log4j configuration
log4j = {
// Example of changing the log pattern for the default console appender:
//
//appenders {
// console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
//}
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.web.mapping', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate'
environments {
// set per-environment log level here
development {
debug 'grails.app.jobs',
'grails.app.controllers',
'grails.app.services',
'grails.app.src'
}
test {
info 'grails.app.jobs',
'grails.app.controllers',
'grails.app.src'
}
}
}
auth.unauthorized="Sie haben nicht die ntigen Zugriffrechte, um diese Seite sehen zu drfen."
\ No newline at end of file
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"/"(controller:"home")
"500"(view:'/error')
}
}
package scrumboard.shiro
/**
* Generated by the Shiro plugin. This filters class protects all URLs
* via access control by convention.
*/
class SecurityFilters {
def filters = {
all(uri: "/**") {
before = {
// Ignore direct views (e.g. the default main index page).
if (!controllerName) return true
// Access control by convention.
accessControl()
}
}
}
}
// Place your Spring DSL code here
beans = {
}
package scrumboard
import org.apache.shiro.SecurityUtils
import org.apache.shiro.subject.Subject
import scrumboard.shiro.User
class HomeController {
def index() {
Subject currentSubject = SecurityUtils.getSubject()
String username = currentSubject.getPrincipal()
User currentUser = User.findByUsername(username)
def projects = Project.list()
def backlogUserStories = projects[0].productBacklog.iterator().next().userstories
def sprints = projects[0].sprints
def sprintUserStories = sprints.iterator().next().userstories
render(view: "index", model: [projects: projects,
sprints: sprints,
sprintUserStories: sprintUserStories,
backlogUserStories: backlogUserStories])
}
def showUserStory(int id) {
def userStory = UserStory.get(id)
render ( template:"showUserStory", model: [userStory : userStory])
}
def moveUserStory(int id, String to) {
def userStory = UserStory.get(id)
def projects = Project.list()
def backlog = projects[0].productBacklog
def sprint = projects[0].sprints.iterator().next()
println to
if (to == "sprintbacklog") {
backlog.removeFromUserstories(userStory)
sprint.addToUserstories(userStory)
userStory.status = UserStoryStatus.OPEN
}
if (to == "backlog") {
sprint.removeFromUserstories(userStory)
backlog.addToUserstories(userStory)
userStory.status = UserStoryStatus.IN_BACKLOG
}
}
}
package scrumboard.shiro
import org.apache.shiro.SecurityUtils
import org.apache.shiro.authc.AuthenticationException
import org.apache.shiro.authc.UsernamePasswordToken
import org.apache.shiro.web.util.SavedRequest
import org.apache.shiro.web.util.WebUtils
import org.apache.shiro.grails.ConfigUtils
class AuthController {
def shiroSecurityManager
def grailsApplication
def index = { redirect(action: "login", params: params) }
def login = {
return [ username: params.username ?: "Gast", password: "gast", rememberMe: (params.rememberMe != null), targetUri: params.targetUri ]
}
def signIn = {
def authToken = new UsernamePasswordToken(params.username, params.password as String)
// Support for "remember me"
if (params.rememberMe) {
authToken.rememberMe = true
}
// If a controller redirected to this page, redirect back
// to it. Otherwise redirect to the root URI.
def targetUri = params.targetUri ?: "/"
// Handle requests saved by Shiro filters.
def savedRequest = WebUtils.getSavedRequest(request)
if (savedRequest) {
targetUri = savedRequest.requestURI - request.contextPath
if (savedRequest.queryString) targetUri = targetUri + '?' + savedRequest.queryString
}
try{
// Perform the actual login. An AuthenticationException
// will be thrown if the username is unrecognised or the
// password is incorrect.
SecurityUtils.subject.login(authToken)
log.info "Redirecting to '${targetUri}'."
redirect(uri: targetUri)
}
catch (AuthenticationException ex){
// Authentication failed, so display the appropriate message
// on the login page.
log.info "Authentication failure for user '${params.username}'. caused by: " + ex.getMessage()
flash.message = message(code: "login.failed")
// Keep the username and "remember me" setting so that the
// user doesn't have to enter them again.
def m = [ username: params.username ]
if (params.rememberMe) {
m["rememberMe"] = true
}
// Remember the target URI too.
if (params.targetUri) {
m["targetUri"] = params.targetUri
}
// Now redirect back to the login page.
redirect(action: "login", params: m)
}
}
def signOut = {
// Log the user out of the application.
def principal = SecurityUtils.subject?.principal
SecurityUtils.subject?.logout()
// For now, redirect back to the home page.
if (ConfigUtils.getCasEnable() && ConfigUtils.isFromCas(principal)) {
redirect(uri:ConfigUtils.getLogoutUrl())
}else {
redirect(uri: "/")
}
ConfigUtils.removePrincipal(principal)
}
def unauthorized = { // TODO use a template instead of plain text from config
render grailsApplication.config.auth.unauthorized
}
}
package scrumboard
class ProductBacklog {
static hasMany = [ userstories: UserStory ]
static belongsTo = Project
static constraints = {
}
}
package scrumboard
class Project {
String name
ProductBacklog productBacklog
static hasMany = [ sprints: Sprint ]
static constraints = {
}
def String toString() {name};
}
package scrumboard
class Sprint {
int number
Date due_date
static hasMany = [ userstories: UserStory ]
static belongsTo = Project
static constraints = {
}
def String toString() {
"Sprint " + number
};
}
package scrumboard
import scrumboard.shiro.User
class UserStory {
String title
String description
String shortId
double points
UserStoryStatus status = UserStoryStatus.IN_BACKLOG
User author
User editor
static constraints = {
}
}
package scrumboard
public enum UserStoryStatus {
IN_BACKLOG('in backlog'),
OPEN('open'),
IN_PROGRESS('in progress'),
DONE('done')
String name
UserStoryStatus(String name) {
this.name = name
}
}
package scrumboard.shiro
class Role {
String name
static hasMany = [ users: User, permissions: String ]
static belongsTo = User