diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-21 13:12:14 +0400 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-10-21 13:12:14 +0400 |
commit | 0189ee97ed34b74cf0f500d678d4435b17ab6a85 (patch) | |
tree | ed77bf88303ef286cc5123d2b75899e559e3a69d /app/roles | |
parent | 5ec1ad8b2375bdce7a820df1be3dc67b18ad2bd0 (diff) |
Security for online editor. Replace dev_access?, master_access? with can? method usage
Diffstat (limited to 'app/roles')
-rw-r--r-- | app/roles/authority.rb | 2 | ||||
-rw-r--r-- | app/roles/repository.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/roles/authority.rb b/app/roles/authority.rb index dbdd98397b9..e0796d5f120 100644 --- a/app/roles/authority.rb +++ b/app/roles/authority.rb @@ -53,6 +53,6 @@ module Authority end def master_access_for?(user) - !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty? || owner_id == user.id + !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty? end end diff --git a/app/roles/repository.rb b/app/roles/repository.rb index 88fd90d061f..882ec31033c 100644 --- a/app/roles/repository.rb +++ b/app/roles/repository.rb @@ -181,4 +181,9 @@ module Repository def http_url_to_repo http_url = [Gitlab.config.url, "/", path, ".git"].join('') end + + # Check if current branch name is marked as protected in the system + def protected_branch? branch_name + protected_branches.map(&:name).include?(branch_name) + end end |