diff options
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 3893b1818f3..03640d7d18b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -15,6 +15,7 @@ class Project < ActiveRecord::Base include ValidAttribute include ProjectFeaturesCompatibility include SelectForProjectAuthorization + include Presentable include Routable include GroupDescendant include Gitlab::SQL::Pattern @@ -1015,6 +1016,12 @@ class Project < ActiveRecord::Base !ProtectedBranch.default_branch_protected? || team.max_member_access(user.id) > Gitlab::Access::DEVELOPER end + def user_can_push_to_branch?(user, branch_name) + return false unless repository.branch_exists?(branch_name) + + ::Gitlab::UserAccess.new(user, project: self).can_push_to_branch?(branch_name) + end + def forked? return true if fork_network && fork_network.root_project != self |