Skip to content

Commit

Permalink
Rename read/write permissions to fetch/store
Browse files Browse the repository at this point in the history
  • Loading branch information
3XX0 committed Feb 25, 2025
1 parent 086a2af commit 89f27da
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/sybil.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ kinit = false
# Permission to list
list = false
# Permission to fetch
read = false
fetch = false
# Permission to store
write = false
store = false
# Permission to masquerade as any user
masquerade = false
8 changes: 4 additions & 4 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ bitflags! {
pub struct Permissions : u32 {
const KINIT = 1;
const LIST = 1 << 1;
const READ = 1 << 2;
const WRITE = 1 << 3;
const FETCH = 1 << 2;
const STORE = 1 << 3;
const MASQUERADE = 1 << 4;
}
}
Expand All @@ -34,8 +34,8 @@ impl From<&conf::Permissions> for Permissions {
Self::default()
| perms.kinit.then_some(Self::KINIT).unwrap_or_default()
| perms.list.then_some(Self::LIST).unwrap_or_default()
| perms.read.then_some(Self::READ).unwrap_or_default()
| perms.write.then_some(Self::WRITE).unwrap_or_default()
| perms.fetch.then_some(Self::FETCH).unwrap_or_default()
| perms.store.then_some(Self::STORE).unwrap_or_default()
| perms.masquerade.then_some(Self::MASQUERADE).unwrap_or_default()
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const DEFAULT_TKT_MINIMUM_LIFETIME: &str = "5m";
pub struct Permissions {
pub kinit: bool,
pub list: bool,
pub read: bool,
pub write: bool,
pub fetch: bool,
pub store: bool,
pub masquerade: bool,
}

Expand Down Expand Up @@ -89,8 +89,8 @@ impl fmt::Display for Permissions {
"{}{}{}{}{}",
if self.kinit { "k" } else { "-" },
if self.list { "l" } else { "-" },
if self.read { "r" } else { "-" },
if self.write { "w" } else { "-" },
if self.fetch { "f" } else { "-" },
if self.store { "s" } else { "-" },
if self.masquerade { "m" } else { "-" }
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl Sybil for SybilServer {
}

async fn put_creds(self, _: Context) -> Result<(), SybilError> {
let id = &self.authorize(auth::Permissions::WRITE).await?;
let id = &self.authorize(auth::Permissions::STORE).await?;

tracing::info!(principal = %id.principal, "put credentials request");

Expand Down Expand Up @@ -325,9 +325,9 @@ impl Sybil for SybilServer {
return Err(SybilError::Unauthorized);
}
let perms = if uid.is_some() {
auth::Permissions::READ | auth::Permissions::MASQUERADE
auth::Permissions::FETCH | auth::Permissions::MASQUERADE
} else {
auth::Permissions::READ
auth::Permissions::FETCH
};
let id = &self.authorize(perms).await?;

Expand Down

0 comments on commit 89f27da

Please sign in to comment.