mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-09-26 17:51:13 +08:00
fix: Deny create namespace permission in community edition
This commit is contained in:
@@ -105,6 +105,10 @@ func getClient(ctx context.Context, kubeConfig *v1.Config, db *v1.DB, sysConfig
|
||||
}
|
||||
|
||||
func IsAuthorized(c *v1.Client, namespace, verb, group, resource, name string) (allowed bool, err error) {
|
||||
if resource == "namespaces" && verb == "create" {
|
||||
return false, status.Error(codes.PermissionDenied, "creating namespaces is not supported in the community edition")
|
||||
}
|
||||
|
||||
review, err := c.AuthorizationV1().SelfSubjectAccessReviews().Create(&authorizationv1.SelfSubjectAccessReview{
|
||||
Spec: authorizationv1.SelfSubjectAccessReviewSpec{
|
||||
ResourceAttributes: &authorizationv1.ResourceAttributes{
|
||||
|
Reference in New Issue
Block a user