Module: ProtectedRefAccess

Extended by:
ActiveSupport::Concern
Includes:
Importable
Included in:
ProtectedBranchAccess, ProtectedTagAccess
Defined in:
app/models/concerns/protected_ref_access.rb

Instance Attribute Summary

Attributes included from Importable

#importing, #user_contributions

Instance Method Summary collapse

Instance Method Details

#check_access(current_user, current_project = protected_ref_project) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'app/models/concerns/protected_ref_access.rb', line 71

def check_access(current_user, current_project = protected_ref_project)
  return false if current_user.nil? || no_access?
  return current_user.admin? if admin_access?

  # role_access_allowed?
  # user_access_allowed?
  # group_access_allowed?
  # deploy_key_access_allowed?
  send(:"#{type}_access_allowed?", current_user, current_project) # rubocop:disable GitlabSecurity/PublicSend -- Intentional meta programming to direct check to correct type
end

#humanizeObject



63
64
65
66
67
68
69
# File 'app/models/concerns/protected_ref_access.rb', line 63

def humanize
  # humanize_role
  # humanize_user
  # humanize_group
  # humanize_deploy_key
  send(:"humanize_#{type}") # rubocop:disable GitlabSecurity/PublicSend -- Intentional meta programming to direct to correct type
end

#role?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'app/models/concerns/protected_ref_access.rb', line 59

def role?
  type == :role
end

#typeObject



55
56
57
# File 'app/models/concerns/protected_ref_access.rb', line 55

def type
  :role
end