Class: SupportOps::GitLab::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/support_ops_gitlab/gitlab/users.rb

Overview

TODO:
TODO:

Get a count of your assigned issues, merge requests, and reviews > docs.gitlab.com/api/users/#get-a-count-of-your-assigned-issues-merge-requests-and-reviews

TODO:

Get a count of a user’s projects, groups, issues, and merge requests > docs.gitlab.com/api/users/#get-a-count-of-a-users-projects-groups-issues-and-merge-requests

TODO:
TODO:
TODO:

Delete authentication identity from a user > docs.gitlab.com/api/users/#delete-authentication-identity-from-a-user

TODO:
TODO:
TODO:
TODO:

Have disable_2fa! update User object to reflect the change

TODO:

Have deactivate! update User object to reflect the change

TODO:

Have activate! update User object to reflect the change

TODO:

Have ban! update User object to reflect the change

TODO:

Have unban! update User object to reflect the change

TODO:

Have block! update User object to reflect the change

TODO:

Have unblock! update User object to reflect the change

TODO:

Document projects

Defines the class Users within the module SupportOps::GitLab.

Author:

  • Jason Colyer

Since:

  • 1.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attributes, #badges, client, #client=, #commits, configure, #contributors, #create_support_pin!, define_attributes, #diffs, #discussions, #emails, #encoded_path, #find, #find!, #initialize, #issues, #jobs, #latest_pipeline, #members, #merge_requests, #move!, #notes, #paid?, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #revoke!, #rotate!, #status, #store_original_attributes, #subscribe!, #support_pin, to_hash, #unsubscribe!, #webhooks

Constructor Details

This class inherits a constructor from SupportOps::GitLab::Base

Instance Attribute Details

#avatar_urlString

URL of the user’s avatar

Returns:

  • (String)

    the current value of avatar_url



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def avatar_url
  @avatar_url
end

#bioString

User’s biography

Returns:

  • (String)

    the current value of bio



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def bio
  @bio
end

#can_create_groupBoolean

User can create groups

Returns:

  • (Boolean)

    the current value of can_create_group



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def can_create_group
  @can_create_group
end

#can_create_projectBoolean

User can create projects

Returns:

  • (Boolean)

    the current value of can_create_project



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def can_create_project
  @can_create_project
end

#color_scheme_idInteger

User’s color scheme for the file viewer

Returns:

  • (Integer)

    the current value of color_scheme_id



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def color_scheme_id
  @color_scheme_id
end

#commit_emailString

User’s commit email

Returns:

  • (String)

    the current value of commit_email



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def commit_email
  @commit_email
end

#confirmed_atString

Timestamp the user’s account was confirmed at

Returns:

  • (String)

    the current value of confirmed_at



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def confirmed_at
  @confirmed_at
end

#created_atString

Timestamp the user’s account was created at

Returns:

  • (String)

    the current value of created_at



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def created_at
  @created_at
end

#created_byInterger

The ID of whomever created the user

Returns:

  • (Interger)

    the current value of created_by



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def created_by
  @created_by
end

#current_sign_in_atString

Timestamp the user’s most current login

Returns:

  • (String)

    the current value of current_sign_in_at



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def 
  @current_sign_in_at
end

#current_sign_in_ipString

IP address used for most current login

Returns:

  • (String)

    the current value of current_sign_in_ip



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def 
  @current_sign_in_ip
end

#discordString

Discord account

Returns:

  • (String)

    the current value of discord



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def discord
  @discord
end

#emailString

User’s email

Returns:

  • (String)

    the current value of email



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def email
  @email
end

#email_reset_offered_atString

Timestamp the user’s got a reset email sent

Returns:

  • (String)

    the current value of email_reset_offered_at



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def email_reset_offered_at
  @email_reset_offered_at
end

#externalBoolean

Flags the user as external

Returns:

  • (Boolean)

    the current value of external



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def external
  @external
end

#extra_shared_runners_minutes_limitInteger

Additional compute minutes for this user

Returns:

  • (Integer)

    the current value of extra_shared_runners_minutes_limit



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def extra_shared_runners_minutes_limit
  @extra_shared_runners_minutes_limit
end

#followersInteger

Count of accounts following the user

Returns:

  • (Integer)

    the current value of followers



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def followers
  @followers
end

#followingInteger

Count of accoutns the user is following

Returns:

  • (Integer)

    the current value of following



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def following
  @following
end

#force_random_passwordBoolean

Set user password to a random value

Returns:

  • (Boolean)

    the current value of force_random_password



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def force_random_password
  @force_random_password
end

#githubString

GitHub username

Returns:

  • (String)

    the current value of github



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def github
  @github
end

#group_samlInteger

Group ID the user is tied to SAML by

Returns:

  • (Integer)

    the current value of group_saml



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def group_saml
  @group_saml
end

#idInteger

User’s ID

Returns:

  • (Integer)

    the current value of id



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def id
  @id
end

#identitiesArray

User’s external identities

Returns:

  • (Array)

    the current value of identities



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def identities
  @identities
end

#is_adminBoolean

If the user is an admin or not

Returns:

  • (Boolean)

    the current value of is_admin



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def is_admin
  @is_admin
end

#is_auditorBoolean

If the user is an auditor or not

Returns:

  • (Boolean)

    the current value of is_auditor



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def is_auditor
  @is_auditor
end

#job_titleString

User’s job title

Returns:

  • (String)

    the current value of job_title



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def job_title
  @job_title
end

#last_activity_onString

Timestamp of last actity for the user

Returns:

  • (String)

    the current value of last_activity_on



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def last_activity_on
  @last_activity_on
end

#last_sign_in_atString

Timestamp fo the user’s last login

Returns:

  • (String)

    the current value of last_sign_in_at



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def 
  @last_sign_in_at
end

#last_sign_in_ipString

IP of the user’s last login

Returns:

  • (String)

    the current value of last_sign_in_ip



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def 
  @last_sign_in_ip
end

#linkedinString

LinkedIn

Returns:

  • (String)

    the current value of linkedin



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def linkedin
  @linkedin
end

#local_timeString

Human readable format of user’s local time

Returns:

  • (String)

    the current value of local_time



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def local_time
  @local_time
end

#locationString

User’s location

Returns:

  • (String)

    the current value of location



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def location
  @location
end

#lockedBoolean

If the user is locked or not

Returns:

  • (Boolean)

    the current value of locked



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def locked
  @locked
end

#nameString

Name

Returns:

  • (String)

    the current value of name



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def name
  @name
end

#namespace_idInteger

User’s namespace ID

Returns:

  • (Integer)

    the current value of namespace_id



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def namespace_id
  @namespace_id
end

#noteString

Administrator notes for this user

Returns:

  • (String)

    the current value of note



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def note
  @note
end

#organizationString

Organization name

Returns:

  • (String)

    the current value of organization



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def organization
  @organization
end

#passwordString

Password

Returns:

  • (String)

    the current value of password



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def password
  @password
end

#planString

Subscription type for the user’s account

Returns:

  • (String)

    the current value of plan



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def plan
  @plan
end

#private_profileBoolean

User’s profile is private

Returns:

  • (Boolean)

    the current value of private_profile



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def private_profile
  @private_profile
end

#projects_limitInteger

Number of projects user can create

Returns:

  • (Integer)

    the current value of projects_limit



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def projects_limit
  @projects_limit
end

#pronounsString

User’s pronouns

Returns:

  • (String)

    the current value of pronouns



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def pronouns
  @pronouns
end

#provisioned_by_group_idInteger

The group ID that provisioned the user

Returns:

  • (Integer)

    the current value of provisioned_by_group_id



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def provisioned_by_group_id
  @provisioned_by_group_id
end

#public_emailString

User’s public email address

Returns:

  • (String)

    the current value of public_email



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def public_email
  @public_email
end

#reset_passwordBoolean

Send user password reset link

Returns:

  • (Boolean)

    the current value of reset_password



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def reset_password
  @reset_password
end

#scim_identitiesArray

User’s SCIM identities

Returns:

  • (Array)

    the current value of scim_identities



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def scim_identities
  @scim_identities
end

#shared_runners_minutes_limitInteger

Maximum number of monthly compute minutes for this user.

Returns:

  • (Integer)

    the current value of shared_runners_minutes_limit



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def shared_runners_minutes_limit
  @shared_runners_minutes_limit
end

#sign_in_countInteger

Number of times user has signed in

Returns:

  • (Integer)

    the current value of sign_in_count



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def 
  @sign_in_count
end

#skypeString

Skype ID

Returns:

  • (String)

    the current value of skype



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def skype
  @skype
end

#stateString

User’s account state

Returns:

  • (String)

    the current value of state



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def state
  @state
end

#theme_idInteger

GitLab theme for the user

Returns:

  • (Integer)

    the current value of theme_id



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def theme_id
  @theme_id
end

#trialBoolean

If the user is using a trial or not

Returns:

  • (Boolean)

    the current value of trial



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def trial
  @trial
end

#twitterString

X (formerly Twitter) account

Returns:

  • (String)

    the current value of twitter



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def twitter
  @twitter
end

#two_factor_enabledBoolean

If the user has 2FA activated on the account

Returns:

  • (Boolean)

    the current value of two_factor_enabled



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def two_factor_enabled
  @two_factor_enabled
end

#usernameString

Username

Returns:

  • (String)

    the current value of username



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def username
  @username
end

#web_urlString

Link to the user’s profile

Returns:

  • (String)

    the current value of web_url



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def web_url
  @web_url
end

#website_urlString

Website URL

Returns:

  • (String)

    the current value of website_url



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def website_url
  @website_url
end

#work_informationString

Returns the current value of work_information.

Returns:

  • (String)

    the current value of work_information



92
93
94
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 92

def work_information
  @work_information
end

Class Method Details

.currentObject

Fetches the current user from the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.current
pp user.email
# => "gabe@example.com"

Returns:

  • (Object)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



762
763
764
765
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 762

def self.current
  response = client.connection.get('user')
  Users.new(Oj.load(response.body))
end

.get(object) ⇒ Object

Locates a specific user in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get(13983927615772)
pp user.email
# => "gabe@example.com"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



787
788
789
790
791
792
793
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 787

def self.get(object)
  if object.is_a? Users
    Users.new(id: id).find
  else
    Users.new(id: object).find
  end
end

.get!(object) ⇒ Object

Locates a specific user in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(13983927615772)
pp user.email
# => "gabe@example.com"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



815
816
817
818
819
820
821
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 815

def self.get!(object)
  if object.is_a? Users
    Users.new(id: id).find!
  else
    Users.new(id: object).find!
  end
end

.list(key: value) ⇒ Array

Lists users in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

users = SupportOps::GitLab::Users.list(limit: 250)
pp users.count
# => 250
pp users.last.email
# => "gabe@example.com"

Parameters:

  • active (Boolean optional)

    Filters only active users; default is false

  • admins (Boolean optional)

    Return only administrators; default is false

  • auditors (Boolean optional)

    Return only auditor users; default is false; if not included, it returns all users

  • blocked (Boolean optional)

    Filters only external users; default is false

  • created_at (DateTime optional)

    Returns users created after specified time

  • created_before (DateTime optional)

    Returns users created before specified time

  • extern_uid (String optional)

    Get a single user with a specific external authentication provider UID

  • external (Boolean optional)

    Filters only external users; default is false

  • exclude_active (Boolean optional)

    Filters only non active users; default is false

  • exclude_external (Boolean optional)

    Filters only non external users; default is false

  • exclude_humans (Boolean optional)

    Filters only bot or internal users; default is false

  • exclude_internal (Boolean optional)

    Filters only non internal users; default is false

  • humans (Boolean optional)

    Filters only regular users that are not bot or internal users; default is false

  • order_by (String optional)

    Return users ordered by id, name, username, created_at, or updated_at fields; default is id

  • provider (String optional)

    The external provider

  • saml_provider_id (Integer optional)

    Return only users created by the specified SAML provider ID; if not included, it returns all users

  • search (String optional)

    Search for users by name, username, or public email

  • skip_ldap (Boolean optional)

    Skip LDAP users

  • sort (String optional)

    Return users sorted in asc or desc order; default is desc

  • two_factor (Boolean optional)

    Filter users by Two-factor authentication; filter values are enabled or disabled; by default it returns all users

  • username (String optional)

    Get a single user with a specific username

  • without_project_bots (Boolean optional)

    Filters user without project bots; defaults to false

  • without_projects (Boolean optional)

    Filter users without projects; default is false, which means that all users are returned, with and without projects.

  • limit (Integer optional)

    The limit to the number of users returned. Default to 0 (i.e. no limit)

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 676

def self.list(**args)
  args[:active] = nil unless args[:active]
  args[:admins] = nil unless args[:admins]
  args[:auditors] = nil unless args[:auditors]
  args[:blocked] = nil unless args[:blocked]
  args[:created_at] = nil unless args[:created_at]
  args[:created_before] = nil unless args[:created_before]
  args[:exclude_active] = nil unless args[:exclude_active]
  args[:exclude_external] = nil unless args[:exclude_external]
  args[:exclude_humans] = nil unless args[:exclude_humans]
  args[:exclude_internal] = nil unless args[:exclude_internal]
  args[:external] = nil unless args[:external]
  args[:extern_uid] = nil unless args[:extern_uid]
  args[:humans] = nil unless args[:humans]
  args[:order_by] = nil unless args[:order_by]
  args[:provider] = nil unless args[:provider]
  args[:saml_provider_id] = nil unless args[:saml_provider_id]
  args[:search] = nil unless args[:search]
  args[:skip_ldap] = nil unless args[:skip_ldap]
  args[:sort] = nil unless args[:sort]
  args[:two_factor] = nil unless args[:two_factor]
  args[:username] = nil unless args[:username]
  args[:without_project_bots] = nil unless args[:without_project_bots]
  args[:without_projects] = nil unless args[:without_projects]
  args[:limit] = 0 unless args[:limit]
  params = ''
  params += "active=#{args[:active]}&" unless args[:active].nil?
  params += "admins=#{args[:admins]}&" unless args[:admins].nil?
  params += "auditors=#{args[:auditors]}&" unless args[:auditors].nil?
  params += "blocked=#{args[:blocked]}&" unless args[:blocked].nil?
  params += "created_at=#{args[:created_at]}&" unless args[:created_at].nil?
  params += "created_before=#{args[:created_before]}&" unless args[:created_before].nil?
  params += "exclude_active=#{args[:exclude_active]}&" unless args[:exclude_active].nil?
  params += "exclude_external=#{args[:exclude_external]}&" unless args[:exclude_external].nil?
  params += "exclude_humans=#{args[:exclude_humans]}&" unless args[:exclude_humans].nil?
  params += "exclude_internal=#{args[:exclude_internal]}&" unless args[:exclude_internal].nil?
  params += "external=#{args[:external]}&" unless args[:external].nil?
  params += "extern_uid=#{args[:extern_uid]}&" unless args[:extern_uid].nil?
  params += "humans=#{args[:humans]}&" unless args[:humans].nil?
  params += "order_by=#{args[:order_by]}&" unless args[:order_by].nil?
  params += "provider=#{args[:provider]}&" unless args[:provider].nil?
  params += "saml_provider_id=#{args[:saml_provider_id]}&" unless args[:saml_provider_id].nil?
  params += "search=#{args[:search]}&" unless args[:search].nil?
  params += "skip_ldap=#{args[:skip_ldap]}&" unless args[:skip_ldap].nil?
  params += "sort=#{args[:sort]}&" unless args[:sort].nil?
  params += "two_factor=#{args[:two_factor]}&" unless args[:two_factor].nil?
  params += "username=#{args[:username]}&" unless args[:username].nil?
  params += "without_project_bots=#{args[:without_project_bots]}&" unless args[:without_project_bots].nil?
  params += "without_projects=#{args[:without_projects]}&" unless args[:without_projects].nil?
  users = []
  page = 1
  loop do
    response = client.connection.get("users?#{params}&page=#{page}&per_page=100")
    body = Oj.load(response.body)
    users += body.map { |u| Users.new(u) }
    break if args[:limit].to_i.positive? && users.count >= args[:limit].to_i
    break if body.count < 100

    page += 1
  end
  return users if args[:limit].to_i.zero?
  
  users.first(args[:limit].to_i)
end

Instance Method Details

#activate!Boolean

Note:

This is inherited from Base#activate!

Reactivates a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.activate!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def activate!; end

#approve!Boolean

Note:

This is inherited from Base#approve!

Approves access to a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.approve!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def approve!; end

#ban!Boolean

Note:

This is inherited from Base#ban!

Bans a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.ban!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def ban!; end

#block!Boolean

Note:

This is inherited from Base#block!

Blocks a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.block!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def block!; end

#deactivate!Boolean

Note:

This is inherited from Base#deactivate!

Deactivates a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.deactivate!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def deactivate!; end

#delete!Boolean

Note:

This is inherited from Base#delete!

Deletes a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.delete!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def delete!; end

#disable_2fa!Boolean

Note:

This is inherited from Base#emails

Lists email addresses for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

user = SupportOps::GitLab::Users.get!(123456)
emails = user.emails
pp emails.count
# => 2
pp emails.last.email
# => "email2@example.com"

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def disable_2fa!; end

#eventsBoolean

Note:

This is inherited from Base#events

List events for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
events = user.events
pp events.count
# => 216

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



23
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 23

def events; end

#gpg_keysBoolean

Note:

This is inherited from Base#gpg_keys

Lists GPG keys for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
keys = user.gpg_keys
pp keys.count
# => 3
pp keys.last.id
# => 789

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 25

def gpg_keys; end

#hard_delete!Boolean

Note:

This is inherited from Base#hard_delete!

Hard deletes a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.hard_delete!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def hard_delete!; end

#impersonationsBoolean

Note:

This is inherited from Base#impersonations

List impersonation tokens for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
tokens = user.impersonations
pp tokens.count
# => 1
pp tokens.last.id
# => 789

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 25

def impersonations; end

#membershipsBoolean

Note:

This is inherited from Base#memberships

List projects and groups that a user is a member of

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
memberships = user.memberships
pp memberships.count
# => 3
pp memberships.last.id
# => 789

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 25

def memberships; end

#patsBoolean

Note:

This is inherited from Base#pats

List personal access tokens for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
tokens = user.pats
pp tokens.count
# => 2
pp tokens.last.id
# => 456

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 25

def pats; end

#reject!Boolean

Note:

This is inherited from Base#reject!

Rejects access to a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.reject!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def reject!; end

#save!Object

Note:

This is inherited from Base#save!

Creates/updates a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

new_user = SupportOps::GitLab::Users.new
new_user.email = 'roge@example.org'
new_user.name = 'Roger Wilco'

new_user.save!

pp new_user.id
# => 9873843
require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.name = 'Roger Wilco II'

existing_user.save!

pp existing_user.name
# => "Roger Wilco II"

Returns:

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



44
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 44

def save!; end

#ssh_keysBoolean

Note:

This is inherited from Base#ssh_keys

Lists SSH keys for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
keys = user.ssh_keys
pp keys.count
# => 3
pp keys.last.usage_type
# => "auth"

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



25
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 25

def ssh_keys; end

#tokensBoolean

Note:

This is inherited from Base#tokens

List tokens (personal access and impersonation) for a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

user = SupportOps::GitLab::Users.get!(123456)
tokens = user.tokens
pp tokens.count
# => 3
pp tokens.last.id
# => 789

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



28
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 28

def tokens; end

#unban!Boolean

Note:

This is inherited from Base#unban!

Unbans a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.unban!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def unban!; end

#unblock!Boolean

Note:

This is inherited from Base#unblock!

Unblocks a user

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_user = SupportOps::GitLab::Users.get!(9873843)
existing_user.unblock!

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/users.rb', line 20

def unblock!; end