diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 19:34:48 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 19:34:48 +0300 |
commit | 14a02a6a95353948d00f8f973b35b80ac06f4599 (patch) | |
tree | d9dbdee6528f1dfeb7a827e95c35e707436e7d49 /app/models/ability.rb | |
parent | 006b65098806fde2a467d9a79347d2978c992e89 (diff) |
Improve design after review
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r-- | app/models/ability.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index 93905abbee8..32e45674682 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -18,6 +18,8 @@ class Ability when Namespace then namespace_abilities(user, subject) when GroupMember then group_member_abilities(user, subject) when ProjectMember then project_member_abilities(user, subject) + when Deployment then deployment_abilities(user, subject) + when Environment then environment_abilities(user, subject) when User then user_abilities else [] end.concat(global_abilities(user)) @@ -249,9 +251,7 @@ class Ability :create_container_image, :update_container_image, :create_environment, - :update_environment, - :create_deployment, - :update_deployment, + :create_deployment ] end @@ -269,6 +269,8 @@ class Ability @project_master_rules ||= project_dev_rules + [ :push_code_to_protected_branches, :update_project_snippet, + :update_environment, + :update_deployment, :admin_milestone, :admin_project_snippet, :admin_project_member, @@ -525,6 +527,14 @@ class Ability project_abilities(user, subject.project) end + def deployment_abilities(user, subject) + project_abilities(user, subject.project) + end + + def environment_abilities(user, subject) + project_abilities(user, subject.project) + end + private def restricted_public_level? |