summaryrefslogtreecommitdiffstats
path: root/rust/src/auth.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-09 18:30:48 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-09 18:30:48 -0800
commit7632129c594b9edbae8ee9ba5da6ae35d1af2429 (patch)
treedb1c56b35aa4c81ec1c925d527b80caa30f9c06f /rust/src/auth.rs
parent8317f6cb38622e36dad6bd4ad34e3cf6dac3bdad (diff)
downloadfatcat-7632129c594b9edbae8ee9ba5da6ae35d1af2429.tar.gz
fatcat-7632129c594b9edbae8ee9ba5da6ae35d1af2429.zip
refactor: FatCatId -> FatcatId
Diffstat (limited to 'rust/src/auth.rs')
-rw-r--r--rust/src/auth.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/rust/src/auth.rs b/rust/src/auth.rs
index 07dfb4f6..d86e5ba8 100644
--- a/rust/src/auth.rs
+++ b/rust/src/auth.rs
@@ -32,7 +32,7 @@ pub enum FatcatRole {
#[derive(Clone)]
pub struct AuthContext {
- pub editor_id: FatCatId,
+ pub editor_id: FatcatId,
editor_row: EditorRow,
}
@@ -66,7 +66,7 @@ impl AuthContext {
}
}
- pub fn require_editgroup(&self, conn: &DbConn, editgroup_id: FatCatId) -> Result<()> {
+ pub fn require_editgroup(&self, conn: &DbConn, editgroup_id: FatcatId) -> Result<()> {
if self.has_role(FatcatRole::Admin) {
return Ok(());
}
@@ -214,7 +214,7 @@ impl AuthConfectionary {
pub fn create_token(
&self,
- editor_id: FatCatId,
+ editor_id: FatcatId,
duration: Option<chrono::Duration>,
) -> Result<String> {
let mut mac = Macaroon::create(&self.location, &self.key, &self.identifier)
@@ -264,10 +264,10 @@ impl AuthConfectionary {
}
};
let mut verifier = Verifier::new();
- let mut editor_id: Option<FatCatId> = None;
+ let mut editor_id: Option<FatcatId> = None;
for caveat in mac.first_party_caveats() {
if caveat.predicate().starts_with("editor_id = ") {
- editor_id = Some(FatCatId::from_str(caveat.predicate().get(12..).unwrap())?);
+ editor_id = Some(FatcatId::from_str(caveat.predicate().get(12..).unwrap())?);
break;
}
}
@@ -391,7 +391,7 @@ impl AuthConfectionary {
};
let editor_row = self.parse_macaroon_token(conn, &token, endpoint)?;
Ok(Some(AuthContext {
- editor_id: FatCatId::from_uuid(&editor_row.id),
+ editor_id: FatcatId::from_uuid(&editor_row.id),
editor_row,
}))
}
@@ -436,7 +436,7 @@ pub fn create_key() -> String {
BASE64.encode(&key)
}
-pub fn revoke_tokens(conn: &DbConn, editor_id: FatCatId) -> Result<()> {
+pub fn revoke_tokens(conn: &DbConn, editor_id: FatcatId) -> Result<()> {
diesel::update(editor::table.filter(editor::id.eq(&editor_id.to_uuid())))
.set(editor::auth_epoch.eq(Utc::now()))
.execute(conn)?;
@@ -459,7 +459,7 @@ pub fn print_editors(conn: &DbConn) -> Result<()> {
for e in all_editors {
println!(
"{}\t{}/{}/{}\t{}\t{}\t{:?}",
- FatCatId::from_uuid(&e.id).to_string(),
+ FatcatId::from_uuid(&e.id).to_string(),
e.is_superuser,
e.is_admin,
e.is_bot,