Skip to content

Commit

Permalink
fix: recursive permissionsdal impl (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
oddgrd authored May 24, 2024
1 parent 87245c9 commit 7d1c9db
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions backends/src/client/permit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,55 +138,55 @@ where
T: PermissionsDal + Send + Sync,
{
async fn get_user(&self, user_id: &str) -> Result<UserRead> {
self.get_user(user_id).await
self.as_ref().get_user(user_id).await
}

async fn delete_user(&self, user_id: &str) -> Result<()> {
self.delete_user(user_id).await
self.as_ref().delete_user(user_id).await
}

async fn new_user(&self, user_id: &str) -> Result<UserRead> {
self.new_user(user_id).await
self.as_ref().new_user(user_id).await
}

async fn make_pro(&self, user_id: &str) -> Result<()> {
self.make_pro(user_id).await
self.as_ref().make_pro(user_id).await
}

async fn make_basic(&self, user_id: &str) -> Result<()> {
self.make_basic(user_id).await
self.as_ref().make_basic(user_id).await
}

async fn create_project(&self, user_id: &str, project_id: &str) -> Result<()> {
self.create_project(user_id, project_id).await
self.as_ref().create_project(user_id, project_id).await
}

async fn delete_project(&self, project_id: &str) -> Result<()> {
self.delete_project(project_id).await
self.as_ref().delete_project(project_id).await
}

async fn get_personal_projects(&self, user_id: &str) -> Result<Vec<String>> {
self.get_personal_projects(user_id).await
self.as_ref().get_personal_projects(user_id).await
}

async fn create_team(&self, user_id: &str, team: &Team) -> Result<()> {
self.create_team(user_id, team).await
self.as_ref().create_team(user_id, team).await
}

async fn delete_team(&self, user_id: &str, team_id: &str) -> Result<()> {
self.delete_team(user_id, team_id).await
self.as_ref().delete_team(user_id, team_id).await
}

async fn get_team(&self, user_id: &str, team_id: &str) -> Result<team::Response> {
self.get_team(user_id, team_id).await
self.as_ref().get_team(user_id, team_id).await
}

async fn get_teams(&self, user_id: &str) -> Result<Vec<team::Response>> {
self.get_teams(user_id).await
self.as_ref().get_teams(user_id).await
}

async fn get_team_projects(&self, user_id: &str, team_id: &str) -> Result<Vec<String>> {
self.get_team_projects(user_id, team_id).await
self.as_ref().get_team_projects(user_id, team_id).await
}

async fn transfer_project_to_user(
Expand All @@ -195,7 +195,8 @@ where
project_id: &str,
new_user_id: &str,
) -> Result<()> {
self.transfer_project_to_user(user_id, project_id, new_user_id)
self.as_ref()
.transfer_project_to_user(user_id, project_id, new_user_id)
.await
}

Expand All @@ -205,7 +206,8 @@ where
project_id: &str,
team_id: &str,
) -> Result<()> {
self.transfer_project_to_team(user_id, project_id, team_id)
self.as_ref()
.transfer_project_to_team(user_id, project_id, team_id)
.await
}

Expand All @@ -215,12 +217,15 @@ where
project_id: &str,
team_id: &str,
) -> Result<()> {
self.transfer_project_from_team(user_id, project_id, team_id)
self.as_ref()
.transfer_project_from_team(user_id, project_id, team_id)
.await
}

async fn add_team_member(&self, admin_user: &str, team_id: &str, user_id: &str) -> Result<()> {
self.add_team_member(admin_user, team_id, user_id).await
self.as_ref()
.add_team_member(admin_user, team_id, user_id)
.await
}

async fn remove_team_member(
Expand All @@ -229,23 +234,25 @@ where
team_id: &str,
user_id: &str,
) -> Result<()> {
self.remove_team_member(admin_user, team_id, user_id).await
self.as_ref()
.remove_team_member(admin_user, team_id, user_id)
.await
}

async fn get_team_members(
&self,
user_id: &str,
team_id: &str,
) -> Result<Vec<team::MemberResponse>> {
self.get_team_members(user_id, team_id).await
self.as_ref().get_team_members(user_id, team_id).await
}

async fn allowed(&self, user_id: &str, project_id: &str, action: &str) -> Result<bool> {
self.allowed(user_id, project_id, action).await
self.as_ref().allowed(user_id, project_id, action).await
}

async fn get_project_owner(&self, user_id: &str, project_id: &str) -> Result<Owner> {
self.get_project_owner(user_id, project_id).await
self.as_ref().get_project_owner(user_id, project_id).await
}
}

Expand Down

0 comments on commit 7d1c9db

Please sign in to comment.