Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Allow switch plan in readonly mode when in dev or in dev

天舟74071449a1fc
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index 4bb2ddc277..56ace880d5 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -222,7 +222,7 @@ export default {
});
const showSwitchPlan = computed((): boolean => {
- return isDev() && isOwner(currentUser.value.role);
+ return isDev() || store.getters["actuator/isDemo"]();
});
const switchToOwner = () => {
diff --git a/server/acl.go b/server/acl.go
index 71a15fd19b..e2766c193b 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -25,8 +25,8 @@ func GetRoleContextKey() string {
func ACLMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.HandlerFunc, readonly bool) echo.HandlerFunc {
return func(c echo.Context) error {
- // Skips auth
- if strings.HasPrefix(c.Path(), "/api/auth") {
+ // Skips auth and plan
+ if strings.HasPrefix(c.Path(), "/api/auth") || strings.HasPrefix(c.Path(), "/api/plan") {
return next(c)
}
diff --git a/server/acl_casbin_policy_dba.csv b/server/acl_casbin_policy_dba.csv
index 369ed44755..bcd11dce5a 100644
--- a/server/acl_casbin_policy_dba.csv
+++ b/server/acl_casbin_policy_dba.csv
@@ -49,4 +49,5 @@ p, DBA, /vcs/{id}, GET
p, DBA, /vcs/{id}, PATCH
p, DBA, /vcs/{id}, DELETE
p, DBA, /vcs/{id}/repository, GET
-p, DBA, /plan, GET
\ No newline at end of file
+p, DBA, /plan, GET
+p, DBA, /plan, PATCH
\ No newline at end of file
diff --git a/server/acl_casbin_policy_developer.csv b/server/acl_casbin_policy_developer.csv
index d286fcfdc7..eed327ef2d 100644
--- a/server/acl_casbin_policy_developer.csv
+++ b/server/acl_casbin_policy_developer.csv
@@ -40,4 +40,5 @@ p, DEVELOPER, /pipeline/{pipelineId}/task/{taskId}/status, PATCH
p, DEVELOPER, /sql/ping, POST
p, DEVELOPER, /vcs, GET
p, DEVELOPER, /vcs/{id}, GET
-p, DEVELOPER, /plan, GET
\ No newline at end of file
+p, DEVELOPER, /plan, GET
+p, DEVELOPER, /plan, PATCH
\ No newline at end of file