Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
83154f21
Commit
83154f21
authored
May 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve environment policy class
parent
88ace4a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
app/policies/environment_policy.rb
app/policies/environment_policy.rb
+7
-5
No files found.
app/policies/environment_policy.rb
View file @
83154f21
...
@@ -4,12 +4,14 @@ class EnvironmentPolicy < BasePolicy
...
@@ -4,12 +4,14 @@ class EnvironmentPolicy < BasePolicy
def
rules
def
rules
delegate!
environment
.
project
delegate!
environment
.
project
if
environment
.
stop_action?
if
can?
(
:create_deployment
)
&&
environment
.
stop_action?
delegate!
environment
.
stop_action
can!
:stop_environment
if
can_play_stop_action?
end
end
if
can?
(
:create_deployment
)
&&
can?
(
:play_build
)
can!
:stop_environment
end
end
private
def
can_play_stop_action?
Ability
.
allowed?
(
user
,
:play_build
,
environment
.
stop_action
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment