Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 4c02682

Browse files
committed
move to v. 1.3.0 code cleanup, bugfixes in storage and attachment plug-ins. new restful web-service
1 parent 4c02635 commit 4c02682

File tree

22 files changed

+147
-222
lines changed

22 files changed

+147
-222
lines changed

application.properties

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,4 @@
33
app.grails.version=2.2.5
44
app.name=OpenLabFramework
55
app.servlet.version=2.4
6-
app.version=1.2.3
7-
plugins.ajax-uploader=1.1
8-
plugins.bubbling=2.1.4
9-
plugins.cloud-foundry=1.2.3
10-
plugins.export=1.5
11-
plugins.grails-ui=1.2.3
12-
plugins.joda-time=1.4
13-
plugins.quartz=0.4.2
14-
plugins.yui=2.8.2.1
6+
app.version=1.3.0

grails-app/conf/BootStrap.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ class BootStrap {
182182
def initSecurity() {
183183
/* create requestmaps to enable url security */
184184
if (Requestmap.list().size() == 0) {
185+
185186
def requestMap = new Requestmap(url: "/error/**", configAttribute: "IS_AUTHENTICATED_ANONYMOUSLY")
186187
requestMap.save()
187188

@@ -224,6 +225,15 @@ class BootStrap {
224225
requestMap = new Requestmap(url: "/settings/**", configAttribute: "ROLE_ADMIN")
225226
requestMap.save()
226227
}
228+
229+
if(!Requestmap.findByUrl("/restful/**")){
230+
def requestMap = new Requestmap(url: "/restful/**", configAttribute: "IS_AUTHENTICATED_ANONYMOUSLY")
231+
requestMap.save()
232+
}
233+
if(!Requestmap.findByUrl("/appAccessToken/**")) {
234+
def requestMap = new Requestmap(url: "/appAccessToken/**", configAttribute: "ROLE_ADMIN")
235+
requestMap.save()
236+
}
227237
}
228238

229239
def initDummyData() {

grails-app/conf/BuildConfig.groovy

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ grails.project.dependency.resolution = {
5555
grailsCentral()
5656
mavenCentral()
5757
mavenRepo "http://maven.springframework.org/milestone/"
58+
mavenRepo "http://repo.grails.org/grails/repo/"
5859

5960
// uncomment the below to enable remote dependency resolution
6061
// from public Maven repositories
@@ -70,6 +71,7 @@ grails.project.dependency.resolution = {
7071
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
7172
runtime "hsqldb:hsqldb:1.8.0.10"
7273
runtime 'mysql:mysql-connector-java:5.1.16'
74+
runtime "net.sourceforge.jtds:jtds:1.3.1" //MS-SQL
7375
compile "org.cloudfoundry:cloudfoundry-runtime:0.8.4"
7476
build 'org.bouncycastle:bcpg-jdk15on:1.50'
7577
build 'org.bouncycastle:bcprov-jdk15on:1.50'
@@ -103,7 +105,10 @@ grails.project.dependency.resolution = {
103105
compile (":richui:0.8"){
104106
excludes 'yui'
105107
}
108+
compile ":ajax-uploader:1.1"
109+
compile ":bubbling:2.1.4"
110+
compile ":export:1.5"
111+
compile ":joda-time:1.4"
112+
compile ":quartz:0.4.2"
106113
}
107-
108114
}
109-

grails-app/conf/Config.groovy

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,6 @@ grails.resources.modules = {
228228
resource id: '/css/uploader.css', url: '/css/custom_uploader.css'
229229
}
230230
}
231-
tinymce{
232-
dependsOn 'jquery'
233-
resource url: 'js/tinymce/tinymce.min.js'
234-
resource url: 'js/tinymce/themes/modern/theme.js'
235-
resource url: 'js/tinymce/plugins/table/plugin.min.js'
236-
resource url: 'js/tinymce/plugins/textcolor/plugin.min.js'
237-
resource url: 'js/tinymce/plugins/code/plugin.min.js'
238-
resource url: 'js/tinymce/skins/lightgray/content.min.css'
239-
resource url: 'js/tinymce/skins/lightgray/skin.min.css'
240-
241-
}
242231
}
243232

244233
//db migration
@@ -258,3 +247,7 @@ grails.gorm.default.mapping = {
258247
//define default javascript library
259248
grails.views.javascript.library="prototype"
260249

250+
//make sure that the restful controller is only called via secure http since the access token can easily be sniffed out otherwise
251+
grails.plugins.springsecurity.secureChannel.definition = [
252+
'/restful/**' : 'REQUIRES_SECURE_CHANNEL'
253+
]

grails-app/controllers/org/openlab/navigation/ProjectTreeController.groovy

Lines changed: 1 addition & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import org.openlab.genetracker.Recombinant
3636
import org.openlab.genetracker.CellLineData
3737

3838
/**
39-
* Controller to deliver XML data to the YUI tree that is showing
39+
* Controller to deliver XML data to the JS tree that is showing
4040
* the project structure.
4141
* @author markus.list
4242
*
@@ -45,9 +45,6 @@ public class ProjectTreeController {
4545

4646
def index = { renderTree }
4747

48-
//def springSecurityService
49-
//def settingsService
50-
5148
def renderTree(){
5249
[:]
5350
}
@@ -117,114 +114,5 @@ public class ProjectTreeController {
117114
render cellLineDataAsJSON as JSON
118115
}
119116
}
120-
/**
121-
* Create the XML data for the YUI treeview
122-
*/
123-
/*def renderTree = {
124-
125-
/*
126-
* create tree data XML from projects
127-
*
128-
def writer = new StringWriter()
129-
def xml = new MarkupBuilder(writer)
130-
131-
def principal = springSecurityService.getPrincipal()
132-
def userName = principal.getUsername()
133-
134-
xml.root(name: settingsService.getLabel(key: "projects") ?: "Projects", checked: false, expanded: false)
135-
{
136-
Laboratory.list().each { lab ->
137-
138-
xml.laboratories(name: lab.toString(), checked: false, expanded: false)
139-
{
140-
def myProjects = Project.findAllByLaboratoryAndCreator(lab, User.findByUsername(userName)).toList().sort {it.toString()};
141-
def otherProjects = (Project.findAllByLaboratory(lab) - myProjects).toList().sort {it.toString()}
142-
143-
findProjects(xml, settingsService.getLabel(key: "myprojects") ?: "My Projects", myProjects)
144-
findProjects(xml, settingsService.getLabel(key: "otherprojects") ?: "Other Projects", otherProjects)
145-
}
146-
}
147-
148-
}
149-
150-
/*
151-
* set params
152-
*
153-
params.max = Math.min(params.max ? params.int('max') : 10, 100)
154-
155-
/**
156-
* obtain dataobject types
157-
*
158-
def types = DataObject.list().collect {it.type}.unique()
159-
160-
render(template: "/layouts/renderTree", model: ["data": writer.toString(), objectTypes: types])
161-
}
162-
163-
/**
164-
* Processes a list of projects and builds up the XML structure. Checked refers to the availability of a
165-
* checkbox version of the YUI treeview. Not used here.
166-
* @param builder
167-
* @param projName
168-
* @param projList
169-
* @return
170-
171-
def findProjects(builder, projName, projList) {
172-
builder.projects(name: projName, id: projName, checked: false, expanded: false, selected: false)
173-
{
174-
projList.each {p ->
175-
if (projList.contains(p)) {
176-
project(name: p.name, id: p.id, checked: false, expanded: false, selected: false)
177-
{
178-
DataObject.list().findAll {it.projects.contains(p)}.each {obj ->
179-
object(name: obj.toString(), id: obj.id, checked: false, expanded: false, selected: isSelected(obj))
180-
}
181-
}
182-
}
183-
}
184-
}
185-
}
186-
187-
/**
188-
* Determines whether the current node should be expanded or not.
189-
* To determine which project is focused, the nextBackId property
190-
* of the BrowserHistoryFilter (grails-app/conf) is used.
191-
* @param p
192-
* @return
193-
*
194-
def isExpanded(def project) {
195-
if (session.nextBackId && DataObject.findById(session.nextBackId)?.projects?.contains(project)) return true
196-
197-
else return false
198-
}
199-
200-
/**
201-
* Determines whether a node (representing a dataobject or a project) should be selected.
202-
* To determine which node is focused at that moment, the nextBackId property
203-
* of the BrowserHistoryFilter (grails-app/conf) is used.
204-
* @param obj
205-
* @return
206-
*
207-
def isSelected(def obj) {
208-
if (!session.nextBackId) return false
209-
210-
else if (obj.class.getName() == "org.openlab.main.Project") {
211-
return (session.nextBackId.toString() == obj.id.toString())
212-
}
213-
else return (DataObject.findById(session.nextBackId) == obj)
214-
}
215-
216-
/**
217-
* Checks whether "MyProjects" or "OtherProjects" has been selected and
218-
* triggers the corresponding action in project controller.
219-
*
220-
def listSubsetOfProjects = {
221-
def id = params.id
222-
params.remove("id")
223-
224-
if (id == (settingsService.getLabel(key: "myprojects") ?: "My Projects"))
225-
redirect(controller: "project", action: "listMyProjects", params: params)
226117

227-
else if (id == (settingsService.getLabel(key: "otherprojects") ?: "Other Projects"))
228-
redirect(controller: "project", action: "listOtherProjects", params: params)
229-
} **/
230118
}

grails-app/conf/spring/resources.groovy renamed to grails-app/controllers/security/AppAccessTokenController.groovy

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,13 @@
2727
*
2828
* ############################################################################
2929
*/
30-
beans = {
30+
package security
3131

32-
/*dataSource(org.apache.commons.dbcp.BasicDataSource) {
33-
driverClassName = "com.mysql.jdbc.Driver"
34-
//url = "jdbc:mysql://b2b607b271d99e:[email protected]:3306/ad_08fc40faf37cc76"
35-
//username = "b2b607b271d99e"
36-
//password = "adde1932"
37-
properties{
38-
initialSize = 3
39-
maxActive = 3
40-
maxIdle = 1
41-
}
42-
} */
32+
import grails.plugins.springsecurity.Secured
33+
import org.openlab.security.AppAccessToken
4334

44-
}
35+
class AppAccessTokenController {
36+
37+
def scaffold = AppAccessToken
38+
39+
}

grails-app/module/org/openlab/module/menu/adminMenuModule.groovy

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
/*
2-
* Copyright (C) 2013
3-
* Center for Excellence in Nanomedicine (NanoCAN)
4-
* Molecular Oncology
5-
* University of Southern Denmark
6-
* ###############################################
7-
* Written by: Markus List
8-
* Contact: mlist'at'health'.'sdu'.'dk
9-
* Web: http://www.nanocan.org
10-
* ###########################################################################
11-
*
12-
* This file is part of OpenLabFramework.
13-
*
14-
* OpenLabFramework is free software: you can redistribute it and/or modify
15-
* it under the terms of the GNU General Public License as published by
16-
* the Free Software Foundation, either version 3 of the License, or
17-
* (at your option) any later version.
18-
*
19-
* This program is distributed in the hope that it will be useful,
20-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22-
* GNU General Public License for more details.
23-
*
24-
* You should have received a copy of the GNU General Public License
25-
* along with this program. It can be found at the root of the project page.
26-
* If not, see <http://www.gnu.org/licenses/>.
27-
*
28-
* ############################################################################
29-
*/
30-
package org.openlab.module.menu
1+
/*
2+
* Copyright (C) 2013
3+
* Center for Excellence in Nanomedicine (NanoCAN)
4+
* Molecular Oncology
5+
* University of Southern Denmark
6+
* ###############################################
7+
* Written by: Markus List
8+
* Contact: mlist'at'health'.'sdu'.'dk
9+
* Web: http://www.nanocan.org
10+
* ###########################################################################
11+
*
12+
* This file is part of OpenLabFramework.
13+
*
14+
* OpenLabFramework is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* This program is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
* GNU General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU General Public License
25+
* along with this program. It can be found at the root of the project page.
26+
* If not, see <http://www.gnu.org/licenses/>.
27+
*
28+
* ############################################################################
29+
*/
30+
package org.openlab.module.menu
3131

3232
import org.openlab.module.*;
3333
import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
@@ -57,10 +57,11 @@ class adminMenuModule implements MenuModule{
5757
{
5858
submenu(label: 'Administration')
5959
{
60-
menuitem(controller: 'settings', action: action, label: 'Change Settings')
60+
menuitem(controller: 'settings', action: action, label: 'Change Settings')
6161
menuitem(controller: 'laboratory', action: 'list', label: 'Manage Laboratories')
6262
menuitem(controller: 'user', action: action, label: 'Manage Users')
6363
menuitem(controller: 'dataSource', action: 'show', label: 'Show Database Configuration')
64+
menuitem(controller: 'appAccessToken', action: 'list', label: 'Manage App Access Tokens')
6465
}
6566
}
6667

grails-app/views/login/auth.gsp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@
5252
</p>
5353
</form>
5454
</div>
55-
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/search?q=openlabframework" data-widget-id="463641420083904512">Tweets</a>
56-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
57-
58-
59-
6055

6156
</div>
6257
<script type='text/javascript'>

lib/c3p0-0.9.1.2.jar

-596 KB
Binary file not shown.

lib/jtds-1.2.5.jar

-295 KB
Binary file not shown.

0 commit comments

Comments
 (0)