-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: Introduce the concept of system cluster privileges
System Cluster Privileges (global) privileges are the first type of privileges that use the system.privileges table. More functionality will be gated behind having `MODIFYCLUSTERSETTING` privilege in the future. This is not the same as the `MODIFYCLUSTERSETTING` role option. Release note (sql change): Introduce SYSTEM CLUSTER PRIVILEGES. These are "global" privileges that live above the database level. Example: `GRANT SYSTEM MODIFYCLUSTERSETTING TO foo` Currently `MODIFYCLUSTERSETTING` is the only system cluster privilege, it allows users to query the `crdb_internal.cluster_settings` table.
- Loading branch information
1 parent
b17caa8
commit 5df8cbd
Showing
50 changed files
with
1,085 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package catalog | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/sql/catalog/catpb" | ||
"github.com/cockroachdb/cockroach/pkg/sql/sem/eval" | ||
) | ||
|
||
// PrivilegeObject represents an object that can have privileges. The privileges | ||
// can either live on the descriptor or in the system.privileges table. | ||
type PrivilegeObject interface { | ||
// GetPrivilegeDescriptor returns the privilege descriptor for the | ||
// object. Note that for non-descriptor backed objects, we query the | ||
// system.privileges table to synthesize a PrivilegeDescriptor. | ||
GetPrivilegeDescriptor(ctx context.Context, planner eval.Planner) (*catpb.PrivilegeDescriptor, error) | ||
// GetObjectType returns the object type of the PrivilegeObject. | ||
// For descriptor backed objects this is the "DescriptorType" for | ||
// non-descriptor backed objects, this is a string constant. | ||
GetObjectType() string | ||
// GetName returns the name of the object. For example, the name of a | ||
// table, schema or database. | ||
GetName() string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.