Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
gluebuddy
Commits
05f31af4
Verified
Commit
05f31af4
authored
Jan 12, 2022
by
Levente Polyak
🚀
Browse files
minor warning and import cleanup
parent
c24dc0e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
05f31af4
...
...
@@ -515,9 +515,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "gitlab"
version = "0.140
5.1
"
version = "0.140
6.0
"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "
3cb1b146c35e34d2c1ac26d07c45c6f167a72d
0b1
2
f9
d405d796a5c686cdb746
"
checksum = "
52e41d183af9bc1d023e6d08dfae46958eca7
0b1f9
8e4dd872c0fcbfdb7a35c0
"
dependencies = [
"async-trait",
"base64",
...
...
src/components/gitlab/gitlab.rs
View file @
05f31af4
...
...
@@ -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
>
{
...
...
src/components/gitlab/types.rs
View file @
05f31af4
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
{
...
...
src/components/keycloak/keycloak.rs
View file @
05f31af4
...
...
@@ -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
))
}
}
src/util.rs
View file @
05f31af4
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
"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment