Skip to content

Commit

Permalink
Add to policy the save_meta_update method
Browse files Browse the repository at this point in the history
  • Loading branch information
vpereira committed Sep 19, 2018
1 parent e6d6218 commit 13973f6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/api/app/policies/package_policy.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class PackagePolicy < ApplicationPolicy
def branch?
# same as Package.check_source_access!
if @record.disabled_for?('sourceaccess', nil, nil) || record.project.disabled_for?('sourceaccess', nil, nil)
if source_access? || project_source_access?
return false unless @user.can_source_access?(@record)
end
true
Expand All @@ -14,4 +14,16 @@ def update?
def destroy?
@user.can_modify?(@record)
end

def save_meta_update?
update? && !source_access?
end

def project_source_access?
@record.project.disabled_for?('sourceaccess', nil, nil)
end

def source_access?
@record.disabled_for?('sourceaccess', nil, nil)
end
end

0 comments on commit 13973f6

Please sign in to comment.