Module: ProtectedBranchesHelper

Defined in:
app/helpers/protected_branches_helper.rb

Instance Method Summary collapse

Instance Method Details

#protected_branch_can_admin_entity?(protected_branch_entity) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'app/helpers/protected_branches_helper.rb', line 4

def protected_branch_can_admin_entity?(protected_branch_entity)
  if protected_branch_entity.is_a?(Group)
    can?(current_user, :admin_group, protected_branch_entity)
  else
    can?(current_user, :admin_project, protected_branch_entity)
  end
end

#protected_branch_path_by_entity(protected_branch, protected_branch_entity) ⇒ Object



12
13
14
15
16
17
18
# File 'app/helpers/protected_branches_helper.rb', line 12

def protected_branch_path_by_entity(protected_branch, protected_branch_entity)
  if protected_branch_entity.is_a?(Group)
    group_protected_branch_path(protected_branch_entity, protected_branch)
  else
    project_protected_branch_path(protected_branch_entity, protected_branch)
  end
end