Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
aca67b08
Unverified
Commit
aca67b08
authored
5 years ago
by
Nándor István Krácser
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1627 from jfrabaute/master
google: Retrieve all the groups for a user
parents
ea435627
b85d7849
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connector/google/google.go
+17
-8
17 additions, 8 deletions
connector/google/google.go
with
17 additions
and
8 deletions
connector/google/google.go
+
17
−
8
View file @
aca67b08
...
...
@@ -240,15 +240,24 @@ func (c *googleConnector) createIdentity(ctx context.Context, identity connector
// getGroups creates a connection to the admin directory service and lists
// all groups the user is a member of
func
(
c
*
googleConnector
)
getGroups
(
email
string
)
([]
string
,
error
)
{
groupsList
,
err
:=
c
.
adminSrv
.
Groups
.
List
()
.
UserKey
(
email
)
.
Do
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"could not list groups: %v"
,
err
)
}
var
userGroups
[]
string
for
_
,
group
:=
range
groupsList
.
Groups
{
// TODO (joelspeed): Make desried group key configurable
userGroups
=
append
(
userGroups
,
group
.
Email
)
var
err
error
groupsList
:=
&
admin
.
Groups
{}
for
{
groupsList
,
err
=
c
.
adminSrv
.
Groups
.
List
()
.
UserKey
(
email
)
.
PageToken
(
groupsList
.
NextPageToken
)
.
Do
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"could not list groups: %v"
,
err
)
}
for
_
,
group
:=
range
groupsList
.
Groups
{
// TODO (joelspeed): Make desried group key configurable
userGroups
=
append
(
userGroups
,
group
.
Email
)
}
if
groupsList
.
NextPageToken
==
""
{
break
}
}
return
userGroups
,
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment