Skip to content

Commit

Permalink
fix: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Mar 27, 2024
1 parent 2068a5a commit f1fa172
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions backends/src/client/permit.rs
Expand Up @@ -494,57 +494,6 @@ impl Client {

Ok(())
}

async fn get_user_projects(&self, user_id: &str) -> Result<Vec<UserPermissionsResult>, Error> {
let perms = get_user_permissions_user_permissions_post(
&self.pdp,
UserPermissionsQuery {
user: Box::new(User {
key: user_id.to_owned(),
..Default::default()
}),
resource_types: Some(vec!["Project".to_owned()]),
tenants: Some(vec!["default".to_owned()]),
..Default::default()
},
None,
None,
)
.await?;

Ok(perms.into_values().collect())
}

async fn is_allowed(
&self,
user_id: &str,
project_id: &str,
action: &str,
) -> Result<bool, Error> {
// NOTE: This API function was modified in upstream to use AuthorizationQuery
let res = is_allowed_allowed_post(
&self.pdp,
AuthorizationQuery {
user: Box::new(User {
key: user_id.to_owned(),
..Default::default()
}),
action: action.to_owned(),
resource: Box::new(Resource {
r#type: "Project".to_string(),
key: Some(project_id.to_owned()),
tenant: Some("default".to_owned()),
..Default::default()
}),
..Default::default()
},
None,
None,
)
.await?;

Ok(res.allow.unwrap_or_default())
}
}

/// Higher level management methods. Use with care.
Expand Down

0 comments on commit f1fa172

Please sign in to comment.