Module: Gitlab::ProtocolAccess

Defined in:
lib/gitlab/protocol_access.rb

Class Method Summary collapse

Class Method Details

.allowed?(protocol, project: nil) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/protocol_access.rb', line 6

def allowed?(protocol, project: nil)
  # Web is always allowed
  return true if protocol == "web"

  # System settings
  return false unless instance_allowed?(protocol)

  # Group-level settings
  return false unless namespace_allowed?(protocol, namespace: project&.root_namespace)

  # Default to allowing all protocols
  true
end