Skip to content
Browse files

I have now re-enabled Basic Authentication for updating plugins via t…

…he REST interface. In addition, fixed a NullPointerException that occurred when using the 'Create Plugin' page.
  • Loading branch information...
1 parent 88c41e7 commit c7fcf1ba0f7b47b4c46b9b384762d42903b82782 @pledbrook pledbrook committed Apr 15, 2011
View
2 grails-app/conf/Config.groovy
@@ -83,7 +83,6 @@ searchable {
}
}
-/*
security.shiro.filter.config = """\
[main]
myAuth = org.grails.auth.RestBasicAuthFilter
@@ -92,7 +91,6 @@ myAuth.applicationName = grails.org
[urls]
/plugin/** = myAuth[POST;PUT;DELETE]
"""
-*/
springcache {
disabled = true
View
2 grails-app/conf/org/grails/auth/JSecurityAuthFilters.groovy
@@ -112,7 +112,7 @@ class JSecurityAuthFilters {
}
}
- pluginActivities(controller:"(tag|plugin|rateable)", action:"(postComment|autoCompleteNames|rate)") {
+ pluginActivities(controller:"(tag|plugin|rateable)", action:"(update|postComment|autoCompleteNames|rate)") {
before = {
accessControl {
role("Editor") || role("Administrator")
View
2 grails-app/controllers/org/grails/plugin/PluginController.groovy
@@ -26,6 +26,8 @@ class PluginController extends BaseWikiController {
static int PORTAL_MAX_RESULTS = 5
static int PORTAL_MIN_RATINGS = 1
+ static allowedMethods = [update: "PUT"]
+
def taggableService
def wikiPageService
def pluginService
View
2 grails-app/services/org/grails/plugin/PluginService.groovy
@@ -117,7 +117,7 @@ class PluginService {
createTabTitle(plugin.name, wiki),
body,
user)
- tabContent.save()
+ tabContent.save(failOnError: true)
plugin."$wiki" = tabContent
// If there is no provided doc url, we'll assume that this page is the doc.
View
5 grails-app/services/org/grails/wiki/WikiPageService.groovy
@@ -58,8 +58,9 @@ class WikiPageService {
}
// Mirroring does not automatically reindex the associated plugin
- // because there is no proper back reference.
- page.plugin.reindex()
+ // because there is no proper back reference. Also, the plugin may
+ // not have been saved yet, hence why we do a null-safe call.
+ page.plugin?.reindex()
return page
}
View
2 src/java/org/grails/auth/RestBasicAuthFilter.java
@@ -68,7 +68,7 @@
* if you had the configuration:
* <pre>
* [urls]
- * /basic/** = authcBasic[POST,PUT,DELETE]
+ * /basic/** = authcBasic[POST;PUT;DELETE]
* <pre>
* then a GET request would not required authentication but a POST would.
* @param request The current HTTP servlet request.

0 comments on commit c7fcf1b

Please sign in to comment.
Something went wrong with that request. Please try again.