summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-05-01 01:58:31 -0500
committerGitHub <noreply@github.com>2017-05-01 01:58:31 -0500
commitbe00bc108ee57806fcf325f64dfca9db0e0e8606 (patch)
tree8f3571c6a63b4b5a73aae83064b6cb1a8c51f00a /system/item
parent8319420935c223e432bc4c386bd7d26b03f01b47 (diff)
parentae56366270a7d854a4b6a12b621ad5b6010db5e3 (diff)
Merge pull request #138 from ponzu-cms/ponzu-dev
[core] more Admin and new Addon lifecycle hooks
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go66
1 files changed, 66 insertions, 0 deletions
diff --git a/system/item/item.go b/system/item/item.go
index caa6faa..f2e8209 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -56,6 +56,15 @@ type Hookable interface {
BeforeAPIDelete(http.ResponseWriter, *http.Request) error
AfterAPIDelete(http.ResponseWriter, *http.Request) error
+ BeforeAdminCreate(http.ResponseWriter, *http.Request) error
+ AfterAdminCreate(http.ResponseWriter, *http.Request) error
+
+ BeforeAdminUpdate(http.ResponseWriter, *http.Request) error
+ AfterAdminUpdate(http.ResponseWriter, *http.Request) error
+
+ BeforeAdminDelete(http.ResponseWriter, *http.Request) error
+ AfterAdminDelete(http.ResponseWriter, *http.Request) error
+
BeforeSave(http.ResponseWriter, *http.Request) error
AfterSave(http.ResponseWriter, *http.Request) error
@@ -67,6 +76,13 @@ type Hookable interface {
BeforeReject(http.ResponseWriter, *http.Request) error
AfterReject(http.ResponseWriter, *http.Request) error
+
+ // Enable/Disable used for addons
+ BeforeEnable(http.ResponseWriter, *http.Request) error
+ AfterEnable(http.ResponseWriter, *http.Request) error
+
+ BeforeDisable(http.ResponseWriter, *http.Request) error
+ AfterDisable(http.ResponseWriter, *http.Request) error
}
// Hideable lets a user keep items hidden
@@ -173,6 +189,36 @@ func (i Item) AfterAPIDelete(res http.ResponseWriter, req *http.Request) error {
return nil
}
+// BeforeAdminCreate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAdminCreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterAdminCreate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAdminCreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// BeforeAdminUpdate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAdminUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterAdminUpdate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAdminUpdate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// BeforeAdminDelete is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAdminDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterAdminDelete is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAdminDelete(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
// BeforeSave is a no-op to ensure structs which embed Item implement Hookable
func (i Item) BeforeSave(res http.ResponseWriter, req *http.Request) error {
return nil
@@ -213,6 +259,26 @@ func (i Item) AfterReject(res http.ResponseWriter, req *http.Request) error {
return nil
}
+// BeforeEnable is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeEnable(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterEnable is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterEnable(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// BeforeDisable is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeDisable(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterDisable is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterDisable(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
// SearchMapping returns a default implementation of a Bleve IndexMappingImpl
// partially implements search.Searchable
func (i Item) SearchMapping() (*mapping.IndexMappingImpl, error) {