Class: Readiness::SupportSuperFormProcessor::TwoFAExemption
- Defined in:
- lib/support_readiness/support_super_form_processor/two_fa_exemption.rb
Overview
Defines the class TwoFAExemption within the module Zendesk.
Class Method Summary collapse
-
.collaboration_project_id ⇒ Object
Sets the global variable collaboration_project_id.
-
.message ⇒ Object
Returns the issue description.
-
.mfa_gitlab_user ⇒ Object
Sets the global variable mfa_gitlab_user.
-
.mfa_slack_user ⇒ Object
Sets the global variable mfa_slack_user.
-
.org ⇒ Object
Sets the global variable org.
-
.org_does_not_exist ⇒ Object
Create issue when organization does not exist.
-
.org_does_not_exist_message ⇒ Object
Returns the issue description.
-
.org_id ⇒ Object
Sets the global variable org_id.
-
.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object
Process a 2FA Exemption request.
-
.project ⇒ Object
Sets the global variable project.
-
.requester ⇒ Object
Sets the global variable requester.
-
.requester_email ⇒ Object
Sets the global variable requester_email.
-
.slack_link ⇒ Object
Sets the global variable slack_link.
-
.template_with_slack ⇒ Object
Returns the template to use when a slack link is present.
-
.template_without_slack ⇒ Object
Returns the template to use when no slack link is present.
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Class Method Details
.collaboration_project_id ⇒ Object
Sets the global variable collaboration_project_id
129 130 131 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 129 def self.collaboration_project_id @collaboration_project_id ||= ENV.fetch('ZENDESK_ORG_2FA_COLLAB_ID') end |
.message ⇒ Object
Returns the issue description
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 138 def self. <<~STRING ## Enable 2FA Exemption for a large organization - #{org.id} Greetings @#{requester.username} ! We have set the required tag and collaboration project ID on the organization at this time. Please note the required next steps that you will need to work on: - [ ] You'll want to get assistance from support managers via the slack channel [#support_leadership](https://gitlab.enterprise.slack.com/archives/C01F9S37AKT) for adding the organization notes needed. - For reference, the organization ID is #{org.id}, making the target note file https://gitlab.com/gitlab-com/support/zendesk-global/organizations/-/blob/master/organizations/#{org.id}.yaml?ref_type=heads - Example org-note: ``` This organization has access to the "Large Customer 2FA Workflow" (see [documentation](https://handbook.gitlab.com/handbook/support/workflows/account_verification/#large-customers)) [2FA Reset Template](link to template) ``` - [ ] You'll want to ensure you've setup the issue template required in the collaboration project - Ensure the filename is `2FA Verification.md` - Ensure the file's location is within path `.gitlab/issue_templates` - Ensure the file contents use the following template: #{slack_link.nil? ? template_without_slack : template_with_slack} /assign @#{requester.username} STRING end |
.mfa_gitlab_user ⇒ Object
Sets the global variable mfa_gitlab_user
120 121 122 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 120 def self.mfa_gitlab_user @mfa_gitlab_user ||= ENV.fetch('ZENDESK_ORG_2FA_GITLAB_USER') end |
.mfa_slack_user ⇒ Object
Sets the global variable mfa_slack_user
111 112 113 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 111 def self.mfa_slack_user @mfa_slack_user ||= ENV.fetch('ZENDESK_ORG_2FA_SLACK_USER') end |
.org ⇒ Object
Sets the global variable org
84 85 86 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 84 def self.org @org ||= Readiness::Zendesk::Organizations.find(@zendesk_client, org_id) end |
.org_does_not_exist ⇒ Object
Create issue when organization does not exist
42 43 44 45 46 47 48 49 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 42 def self.org_does_not_exist issue = Readiness::GitLab::Issues.new issue.title = "Invalid Request - Organization Not Found" issue.description = create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue) puts "Issue created: #{create.web_url}" exit 0 end |
.org_does_not_exist_message ⇒ Object
Returns the issue description
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 239 def self. <<~STRING ## Invalid Request Organization Not Found Greetings @#{requester.username} ! We received a request from you recently, however the organization ID given #{org_id} is not a valid Zendesk Global Organization ID. As such, we are not able to proceed. Please review the Zendesk Global organization you were wanting to use once more and file a new submission. If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD) /label ~"AutomatedRequests::Invalid Organization" /label ~"Invalid Zendesk Global organization given" /assign @#{requester.username} STRING end |
.org_id ⇒ Object
Sets the global variable org_id
93 94 95 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 93 def self.org_id @org_id ||= ENV.fetch('ZENDESK_ORGANIZATION_ID') end |
.process!(gitlab_client, gitlab_admin_client, zendesk_client) ⇒ Object
Process a 2FA Exemption request
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 18 def self.process!(gitlab_client, gitlab_admin_client, zendesk_client) @gitlab_client = gitlab_client @gitlab_admin_client = gitlab_admin_client @zendesk_client = zendesk_client requester org_does_not_exist if org.is_a? Hash new_org = Readiness::Zendesk::Organizations.new new_org.id = org.id new_org. = org. + ['skip_2fa_automation'] new_org.custom_fields = { "am_project_id" => collaboration_project_id } Readiness::Zendesk::Organizations.update!(@zendesk_client, new_org) issue = Readiness::GitLab::Issues.new issue.title = "Enable 2FA Exemption for a large organization - #{org.id}" issue.description = create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue) puts "Issue created: #{create.web_url}" exit 0 end |
.project ⇒ Object
Sets the global variable project
75 76 77 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 75 def self.project @project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526) end |
.requester ⇒ Object
Sets the global variable requester
57 58 59 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 57 def self.requester @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email) end |
.requester_email ⇒ Object
Sets the global variable requester_email
66 67 68 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 66 def self.requester_email @requester_email ||= ENV.fetch('REQUESTER_EMAIL') end |
.slack_link ⇒ Object
Sets the global variable slack_link
102 103 104 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 102 def self.slack_link @slack_link ||= ENV.fetch('ZENDESK_ORG_2FA_SLACK_LINK', nil) end |
.template_with_slack ⇒ Object
Returns the template to use when a slack link is present
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 205 def self.template_with_slack <<~STRING ``` A user in your organization is requesting to have [GitLab two-factor authentication](https://docs.gitlab.com/ee/user/profile/account/two_factor_authentication.html) removed from their account. Please review and complete the highlighted sections below. **Support Engineer Instructions** - Ping the customer’s organization owners in #{slack_link} using the [Notify Customer - Slack ](https://handbook.gitlab.com/handbook/support/workflows/account_verification#2-contact-through-slack) template. For this organization the owners are #{mfa_slack_user}. - Fill out the `Request Details` section below. **Request Details** - User Requesting Reset: USERS_GITLAB_USERNAME - Support Ticket: TICKET_NUMBER **Customer Instructions** - Review the request and get in contact with the user requesting the reset to verify its authenticity. - Comment on this issue indicating your approval. - Unassign yourself and any others from this issue. - Assign to the Support Engineer who opened this issue. /assign @#{mfa_gitlab_user} /label ~"2FA Reset" ~"Awaiting confirmation" ``` STRING end |
.template_without_slack ⇒ Object
Returns the template to use when no slack link is present
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/support_readiness/support_super_form_processor/two_fa_exemption.rb', line 172 def self.template_without_slack <<~STRING ``` A user in your organization is requesting to have [GitLab two-factor authentication](https://docs.gitlab.com/ee/user/profile/account/two_factor_authentication.html) removed from their account. Please review and complete the highlighted sections below. **Support Engineer Instructions** - Fill out the `Request Details` section below. **Request Details** - User Requesting Reset: USERS_GITLAB_USERNAME - Support Ticket: TICKET_NUMBER **Customer Instructions** - Review the request and get in contact with the user requesting the reset to verify its authenticity. - Comment on this issue indicating your approval. - Unassign yourself and any others from this issue. - Assign to the Support Engineer who opened this issue. /assign @#{mfa_gitlab_user} /label ~"2FA Reset" ~"Awaiting confirmation" ``` STRING end |