mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-26 07:39:58 +00:00
This PR introduces a `/grants` endpoint which allows setting specific `privileges` to certain `role` for a certain `schema`. Related to #9344 Together these endpoints will be used to configure JWT extension and set correct usage to its schema to specific roles that will need them. --------- Co-authored-by: Conrad Ludgate <conradludgate@gmail.com>
36 lines
913 B
Rust
36 lines
913 B
Rust
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
|
#[serde(rename_all = "UPPERCASE")]
|
|
pub enum Privilege {
|
|
Select,
|
|
Insert,
|
|
Update,
|
|
Delete,
|
|
Truncate,
|
|
References,
|
|
Trigger,
|
|
Usage,
|
|
Create,
|
|
Connect,
|
|
Temporary,
|
|
Execute,
|
|
}
|
|
|
|
impl Privilege {
|
|
pub fn as_str(&self) -> &'static str {
|
|
match self {
|
|
Privilege::Select => "SELECT",
|
|
Privilege::Insert => "INSERT",
|
|
Privilege::Update => "UPDATE",
|
|
Privilege::Delete => "DELETE",
|
|
Privilege::Truncate => "TRUNCATE",
|
|
Privilege::References => "REFERENCES",
|
|
Privilege::Trigger => "TRIGGER",
|
|
Privilege::Usage => "USAGE",
|
|
Privilege::Create => "CREATE",
|
|
Privilege::Connect => "CONNECT",
|
|
Privilege::Temporary => "TEMPORARY",
|
|
Privilege::Execute => "EXECUTE",
|
|
}
|
|
}
|
|
}
|