27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
package handlers
|
|
|
|
const (
|
|
PermissionCreate = iota
|
|
PermissionRead
|
|
PermissionReadAll
|
|
PermissionUpdate
|
|
PermissionDelete
|
|
)
|
|
|
|
var (
|
|
DefaultPathPatterns []PathPattern = []PathPattern{
|
|
PathPattern{"/%s", "", []string{"GET"}, PermissionReadAll},
|
|
PathPattern{"/%s/{id}", "", []string{"GET"}, PermissionRead},
|
|
PathPattern{"/%s/create/", "/%s/%d?format=html&tpl_layout=base&tpl_content=%s_show", []string{"GET", "POST"}, PermissionCreate},
|
|
PathPattern{"/%s/{id}/update", "/%s/%d?format=html&tpl_layout=base&tpl_content=%s_show", []string{"GET", "POST"}, PermissionUpdate},
|
|
PathPattern{"/%s/{id}/delete", "/%s?format=html&tpl_layout=base&tpl_content=%s", []string{"DELETE"}, PermissionDelete},
|
|
}
|
|
|
|
DefaultAPIPathPatterns []PathPattern = []PathPattern{
|
|
PathPattern{"/api/%s", "", []string{"GET"}, PermissionReadAll},
|
|
PathPattern{"/api/%s/{id}", "", []string{"GET"}, PermissionRead},
|
|
PathPattern{"/api/%s/create/", "", []string{"GET", "POST"}, PermissionCreate},
|
|
PathPattern{"/api/%s/{id}/update", "", []string{"GET", "POST"}, PermissionUpdate},
|
|
PathPattern{"/api/%s/{id}/delete", "", []string{"DELETE"}, PermissionDelete},
|
|
}
|
|
)
|