Class: Ci::JobToken::Scope
- Inherits:
-
Object
- Object
- Ci::JobToken::Scope
- Defined in:
- app/models/ci/job_token/scope.rb
Instance Attribute Summary collapse
-
#current_project ⇒ Object
readonly
Returns the value of attribute current_project.
Instance Method Summary collapse
- #accessible?(accessed_project) ⇒ Boolean
- #add!(added_project, user:, direction:) ⇒ Object
- #inbound_projects ⇒ Object
-
#initialize(current_project) ⇒ Scope
constructor
A new instance of Scope.
- #outbound_projects ⇒ Object
Constructor Details
#initialize(current_project) ⇒ Scope
Returns a new instance of Scope.
23 24 25 |
# File 'app/models/ci/job_token/scope.rb', line 23 def initialize(current_project) @current_project = current_project end |
Instance Attribute Details
#current_project ⇒ Object (readonly)
Returns the value of attribute current_project.
21 22 23 |
# File 'app/models/ci/job_token/scope.rb', line 21 def current_project @current_project end |
Instance Method Details
#accessible?(accessed_project) ⇒ Boolean
27 28 29 30 31 32 |
# File 'app/models/ci/job_token/scope.rb', line 27 def accessible?(accessed_project) self_referential?(accessed_project) || ( outbound_accessible?(accessed_project) && inbound_accessible?(accessed_project) ) end |
#add!(added_project, user:, direction:) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'app/models/ci/job_token/scope.rb', line 42 def add!(added_project, user:, direction:) case direction when :inbound inbound_allowlist.add!(added_project, user: user) when :outbound outbound_allowlist.add!(added_project, user: user) end end |
#inbound_projects ⇒ Object
38 39 40 |
# File 'app/models/ci/job_token/scope.rb', line 38 def inbound_projects inbound_allowlist.projects end |
#outbound_projects ⇒ Object
34 35 36 |
# File 'app/models/ci/job_token/scope.rb', line 34 def outbound_projects outbound_allowlist.projects end |