Skip to content

Commit

Permalink
Update users datasource: add more properties to user map
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Caussat committed Jan 22, 2019
1 parent 4259c40 commit 5e577ef
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
66 changes: 65 additions & 1 deletion gitlab/data_source_gitlab_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,54 @@ func dataSourceGitlabUsers() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"provider": {
Type: schema.TypeString,
Computed: true,
},
"avatar_url": {
Type: schema.TypeString,
Computed: true,
},
"bio": {
Type: schema.TypeString,
Computed: true,
},
"location": {
Type: schema.TypeString,
Computed: true,
},
"skype": {
Type: schema.TypeString,
Computed: true,
},
"linkedin": {
Type: schema.TypeString,
Computed: true,
},
"twitter": {
Type: schema.TypeString,
Computed: true,
},
"website_url": {
Type: schema.TypeString,
Computed: true,
},
"theme_id": {
Type: schema.TypeInt,
Computed: true,
},
"color_scheme_id": {
Type: schema.TypeInt,
Computed: true,
},
"last_sign_in_at": {
Type: schema.TypeString,
Computed: true,
},
"current_sign_in_at": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
Expand Down Expand Up @@ -160,13 +208,29 @@ func flattenGitlabUsers(users []*gitlab.User) []interface{} {
"state": user.State,
"external": user.External,
"extern_uid": user.ExternUID,
"organization": user.Organization,
"provider": user.Provider,
"two_factor_enabled": user.TwoFactorEnabled,
"avatar_url": user.AvatarURL,
"bio": user.Bio,
"location": user.Location,
"skype": user.Skype,
"linkedin": user.Linkedin,
"twitter": user.Twitter,
"website_url": user.WebsiteURL,
"organization": user.Organization,
"theme_id": user.ThemeID,
"color_scheme_id": user.ColorSchemeID,
}

if user.CreatedAt != nil {
values["created_at"] = user.CreatedAt.String()
}
if user.LastSignInAt != nil {
values["last_sign_in_at"] = user.LastSignInAt.String()
}
if user.CurrentSignInAt != nil {
values["current_sign_in_at"] = user.CurrentSignInAt.String()
}

usersList = append(usersList, values)
}
Expand Down
12 changes: 12 additions & 0 deletions website/docs/d/users.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,20 @@ The following attributes are exported:
* `state` - Whether the user is active or blocked.
* `external` - Whether the user is external.
* `extern_uid` - The external UID of the user.
* `provider` - The UID provider of the user.
* `organization` - The organization of the user.
* `two_factor_enabled` - Whether user's two factor auth is enabled.
* `avatar_url` - The avatar URL of the user.
* `bio` - The bio of the user.
* `location` - The location of the user.
* `skype` - Skype username of the user.
* `linkedin` - Linkedin profile of the user.
* `twitter` - Twitter username of the user.
* `website_url` - User's website URL.
* `theme_id` - User's theme ID.
* `color_scheme_id` - User's color scheme ID.
* `last_sign_in_at` - Last user's sign-in date.
* `current_sign_in_at` - Current user's sign-in date.


[users_for_admins]: https://docs.gitlab.com/ce/api/users.html#for-admins

0 comments on commit 5e577ef

Please sign in to comment.