mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 19:30:26 +08:00
Demo模式下不允许调用Sync方法
This commit is contained in:
@@ -34,7 +34,7 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
if teaconst.IsDemoMode {
|
if teaconst.IsDemoMode {
|
||||||
if action.Request.Method == http.MethodPost {
|
if action.Request.Method == http.MethodPost {
|
||||||
var actionName = action.Spec.ClassName[strings.LastIndex(action.Spec.ClassName, ".")+1:]
|
var actionName = action.Spec.ClassName[strings.LastIndex(action.Spec.ClassName, ".")+1:]
|
||||||
var denyPrefixes = []string{"Update", "Create", "Delete", "Truncate", "Clean", "Clear", "Reset", "Add", "Remove"}
|
var denyPrefixes = []string{"Update", "Create", "Delete", "Truncate", "Clean", "Clear", "Reset", "Add", "Remove", "Sync"}
|
||||||
for _, prefix := range denyPrefixes {
|
for _, prefix := range denyPrefixes {
|
||||||
if strings.HasPrefix(actionName, prefix) {
|
if strings.HasPrefix(actionName, prefix) {
|
||||||
action.Fail(teaconst.ErrorDemoOperation)
|
action.Fail(teaconst.ErrorDemoOperation)
|
||||||
|
|||||||
Reference in New Issue
Block a user