Verified Commit 05f31af4 authored by Levente Polyak's avatar Levente Polyak 🚀
Browse files

minor warning and import cleanup

parent c24dc0e0
......@@ -515,9 +515,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "gitlab"
version = "0.1405.1"
version = "0.1406.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cb1b146c35e34d2c1ac26d07c45c6f167a72d0b12f9d405d796a5c686cdb746"
checksum = "52e41d183af9bc1d023e6d08dfae46958eca70b1f98e4dd872c0fcbfdb7a35c0"
dependencies = [
"async-trait",
"base64",
......
......@@ -13,7 +13,6 @@ use crate::components::gitlab::types::*;
use crate::util;
use itertools::Itertools;
use std::env;
use std::sync::Arc;
......@@ -24,14 +23,10 @@ use tokio::sync::{Mutex, MutexGuard};
use gitlab::api::{AsyncQuery, Query};
use gitlab::{AsyncGitlab, Gitlab, GitlabBuilder};
use gitlab::api::common::{AccessLevel, VisibilityLevel};
use gitlab::api::groups::members::{AddGroupMember, GroupMembers, RemoveGroupMember};
use gitlab::api::common::AccessLevel;
use gitlab::api::groups::projects::GroupProjectsOrderBy;
use gitlab::api::groups::subgroups::GroupSubgroupsOrderBy;
use gitlab::api::groups::BranchProtection;
use gitlab::api::projects::{FeatureAccessLevel, Projects};
use gitlab::api::users::ExternalProvider;
use std::future::Future;
const DEFAULT_ARCH_LINUX_GROUP_ACCESS_LEVEL: AccessLevel = AccessLevel::Minimal;
const DEFAULT_STAFF_GROUP_ACCESS_LEVEL: AccessLevel = AccessLevel::Reporter;
......@@ -543,7 +538,7 @@ impl GitLabGlue {
async fn remove_group_member<'a>(
&self,
action: &Action,
state: &MutexGuard<'a, State>,
_state: &MutexGuard<'a, State>,
member: &GitLabMember,
group: &str,
) -> Result<bool> {
......
use gitlab::api::common::AccessLevel;
use gitlab::api::groups::BranchProtection;
use gitlab::api::projects::FeatureAccessLevel;
use serde::Deserialize;
use serde_repr::*;
use std::fmt::{self, Display, Formatter};
use strum::VariantNames;
use strum_macros::{EnumString, EnumVariantNames};
use strum_macros::EnumString;
#[derive(Debug, Deserialize)]
pub struct PlanSummary {
......
......@@ -5,7 +5,7 @@
use crate::args::Action;
use keycloak::types::{CredentialRepresentation, GroupRepresentation, UserRepresentation};
use keycloak::types::{GroupRepresentation, UserRepresentation};
use keycloak::{KeycloakAdmin, KeycloakAdminToken, KeycloakError};
use reqwest::Client;
......@@ -117,9 +117,7 @@ impl Keycloak {
group_name,
group.path.as_ref().unwrap()
);
vec![Box::pin(get_group_members(
&self.admin,
&self.realm,
vec![Box::pin(self.get_group_members(
group.clone(),
))]
.into_iter()
......@@ -129,9 +127,7 @@ impl Keycloak {
sub_group.name.as_ref().unwrap(),
sub_group.path.as_ref().unwrap()
);
Box::pin(get_group_members(
&self.admin,
&self.realm,
Box::pin(self.get_group_members(
sub_group.clone(),
))
}))
......@@ -148,9 +144,7 @@ impl Keycloak {
sub_group.name.as_ref().unwrap(),
sub_group.path.as_ref().unwrap(),
);
Box::pin(get_group_members(
&self.admin,
&self.realm,
Box::pin(self.get_group_members(
sub_group.clone(),
))
}),
......@@ -185,21 +179,20 @@ impl Keycloak {
pub async fn run(&self, _action: Action) -> Result<()> {
Ok(())
}
}
async fn get_group_members<'a>(
admin: &'a KeycloakAdmin,
realm: &'a str,
group: GroupRepresentation,
) -> Result<(GroupRepresentation, Vec<UserRepresentation>)> {
let users = admin
.realm_groups_with_id_members_get(
realm,
group.id.as_ref().unwrap().as_ref(),
None,
None,
None,
)
.await?;
Ok((group, users))
async fn get_group_members(
&self,
group: GroupRepresentation,
) -> Result<(GroupRepresentation, Vec<UserRepresentation>)> {
let users = self.admin
.realm_groups_with_id_members_get(
&self.realm,
group.id.as_ref().unwrap().as_ref(),
None,
None,
None,
)
.await?;
Ok((group, users))
}
}
use crate::components::gitlab::types::{GroupBranchProtection, ProjectFeatureAccessLevel};
use crate::components::gitlab::types::ProjectFeatureAccessLevel;
use anyhow::{Context, Result};
use difference::{Changeset, Difference};
use gitlab::api::common::AccessLevel;
use gitlab::api::groups::BranchProtection;
pub fn print_diff(text1: &str, text2: &str) -> Result<()> {
let Changeset { diffs, .. } = Changeset::new(text1, text2, "\n");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment