Class: Gitlab::CycleAnalytics::Permissions

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/cycle_analytics/permissions.rb

Constant Summary collapse

STAGE_PERMISSIONS =
{
  issue: :read_issue,
  code: :read_merge_request,
  test: :read_build,
  review: :read_merge_request,
  staging: :read_build,
  production: :read_issue
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user:, project:) ⇒ Permissions

Returns a new instance of Permissions.


19
20
21
22
23
# File 'lib/gitlab/cycle_analytics/permissions.rb', line 19

def initialize(user:, project:)
  @user = user
  @project = project
  @stage_permission_hash = {}
end

Class Method Details

.get(*args) ⇒ Object


15
16
17
# File 'lib/gitlab/cycle_analytics/permissions.rb', line 15

def self.get(*args)
  new(*args).get
end

Instance Method Details

#getObject


25
26
27
28
29
30
31
# File 'lib/gitlab/cycle_analytics/permissions.rb', line 25

def get
  ::CycleAnalytics::LevelBase::STAGES.each do |stage|
    @stage_permission_hash[stage] = authorized_stage?(stage)
  end

  @stage_permission_hash
end