Hugo improvements and such
Former-commit-id: 2a2487cd12126f56dec90eea5f4e23dd3f3deec8 [formerly 80b28386cb493fc5b18cbceaf057479c140884dc] [formerly 07a1fe726815cb3368e5e13adbedc070f0fbe061 [formerly 87fc8db54f6b001d11352234c6c72f0b966aba0e]] Former-commit-id: e193354dc581c3f2594e004b735e3e3715249321 [formerly c9792d4bda13655a354ebaedd7dc14c2de354d0f] Former-commit-id: d3b82daf64a9a8a79b40ebb139eaa82ac9a5135e
This commit is contained in:
@@ -26,7 +26,6 @@ type hugo struct {
|
||||
// Indicates if we should clean public before a new publish.
|
||||
CleanPublic bool `description:"Indicates if the public folder should be cleaned before publishing the website."`
|
||||
|
||||
// TODO: AllowPublish
|
||||
// TODO: admin interface to cgange options
|
||||
}
|
||||
|
||||
@@ -67,6 +66,10 @@ func (h hugo) BeforeAPI(c *filemanager.RequestContext, w http.ResponseWriter, r
|
||||
|
||||
// If we are creating a file built from an archetype.
|
||||
if r.Header.Get("Archetype") != "" {
|
||||
if !c.User.AllowNew {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
filename := filepath.Join(string(c.User.FileSystem), r.URL.Path)
|
||||
filename = strings.TrimPrefix(filename, "/")
|
||||
archetype := r.Header.Get("archetype")
|
||||
@@ -92,6 +95,10 @@ func (h hugo) BeforeAPI(c *filemanager.RequestContext, w http.ResponseWriter, r
|
||||
|
||||
// If we are trying to regenerate the website.
|
||||
if r.Header.Get("Regenerate") == "true" {
|
||||
if !c.User.Permissions["allowPublish"] {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
filename := filepath.Join(string(c.User.FileSystem), r.URL.Path)
|
||||
filename = strings.TrimPrefix(filename, "/")
|
||||
|
||||
@@ -120,6 +127,10 @@ func (h hugo) BeforeAPI(c *filemanager.RequestContext, w http.ResponseWriter, r
|
||||
}
|
||||
|
||||
if r.Header.Get("Schedule") != "" {
|
||||
if !c.User.Permissions["allowPublish"] {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
return h.schedule(c, w, r)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user