Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9c0a8cb5
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c0a8cb5
编写于
12月 08, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Incorporate permission checks into new CI statuses
[ci skip]
上级
3acf4323
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
60 addition
and
49 deletion
+60
-49
lib/gitlab/ci/status/build/cancelable.rb
lib/gitlab/ci/status/build/cancelable.rb
+7
-5
lib/gitlab/ci/status/build/common.rb
lib/gitlab/ci/status/build/common.rb
+5
-5
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+7
-5
lib/gitlab/ci/status/build/retryable.rb
lib/gitlab/ci/status/build/retryable.rb
+7
-5
lib/gitlab/ci/status/build/stop.rb
lib/gitlab/ci/status/build/stop.rb
+7
-5
lib/gitlab/ci/status/core.rb
lib/gitlab/ci/status/core.rb
+6
-7
lib/gitlab/ci/status/extended.rb
lib/gitlab/ci/status/extended.rb
+6
-2
lib/gitlab/ci/status/factory.rb
lib/gitlab/ci/status/factory.rb
+2
-2
lib/gitlab/ci/status/pipeline/common.rb
lib/gitlab/ci/status/pipeline/common.rb
+5
-5
lib/gitlab/ci/status/pipeline/success_with_warnings.rb
lib/gitlab/ci/status/pipeline/success_with_warnings.rb
+2
-2
lib/gitlab/ci/status/stage/common.rb
lib/gitlab/ci/status/stage/common.rb
+6
-6
未找到文件。
lib/gitlab/ci/status/build/cancelable.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,10 +3,10 @@ module Gitlab
module
Status
module
Status
class
Cancelable
<
SimpleDelegator
extend
Status
::
Extended
include
Status
::
Extended
def
has_action?
(
current_user
)
can?
(
current_
user
,
:update_build
,
subject
)
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
def
action_icon
...
...
@@ -14,14 +14,16 @@ module Gitlab
end
def
action_path
cancel_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
cancel_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
def
self
.
matches?
(
build
,
user
)
build
.
cancelable?
end
end
...
...
lib/gitlab/ci/status/build/common.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,14 +3,14 @@ module Gitlab
module
Status
module
Build
module
Common
def
has_details?
(
current_user
)
can?
(
current_
user
,
:read_build
,
subject
)
def
has_details?
can?
(
user
,
:read_build
,
subject
)
end
def
details_path
namespace_project_build_path
(
@
subject
.
project
.
namespace
,
@
subject
.
project
,
@
subject
.
pipeline
)
namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
.
pipeline
)
end
end
end
...
...
lib/gitlab/ci/status/build/play.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,7 +3,7 @@ module Gitlab
module
Status
module
Status
class
Play
<
SimpleDelegator
extend
Status
::
Extended
include
Status
::
Extended
def
text
'play'
...
...
@@ -13,8 +13,8 @@ module Gitlab
'play'
end
def
has_action?
(
current_user
)
can?
(
current_
user
,
:update_build
,
subject
)
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
def
action_icon
...
...
@@ -22,14 +22,16 @@ module Gitlab
end
def
action_path
play_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
play_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
def
self
.
matches?
(
build
,
user
)
build
.
playable?
&&
!
build
.
stops_environment?
end
end
...
...
lib/gitlab/ci/status/build/retryable.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,10 +3,10 @@ module Gitlab
module
Status
module
Status
class
Retryable
<
SimpleDelegator
extend
Status
::
Extended
include
Status
::
Extended
def
has_action?
(
current_user
)
can?
(
current_
user
,
:update_build
,
subject
)
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
def
action_icon
...
...
@@ -14,14 +14,16 @@ module Gitlab
end
def
action_path
retry_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
retry_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
def
self
.
matches?
(
build
,
user
)
build
.
retryable?
end
end
...
...
lib/gitlab/ci/status/build/stop.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,7 +3,7 @@ module Gitlab
module
Status
module
Status
class
Play
<
SimpleDelegator
extend
Status
::
Extended
include
Status
::
Extended
def
text
'stop'
...
...
@@ -21,8 +21,8 @@ module Gitlab
'stop'
end
def
has_action?
(
current_user
)
can?
(
current_
user
,
:update_build
,
subject
)
def
has_action?
can?
(
user
,
:update_build
,
subject
)
end
def
action_icon
...
...
@@ -30,14 +30,16 @@ module Gitlab
end
def
action_path
play_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
play_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
def
self
.
matches?
(
build
,
user
)
build
.
playable?
&&
build
.
stops_environment?
end
end
...
...
lib/gitlab/ci/status/core.rb
浏览文件 @
9c0a8cb5
...
...
@@ -6,8 +6,11 @@ module Gitlab
class
Core
include
Gitlab
::
Routing
.
url_helpers
def
initialize
(
subject
)
attr_reader
:subject
,
:user
def
initialize
(
subject
,
user
)
@subject
=
subject
@user
=
user
end
def
icon
...
...
@@ -18,10 +21,6 @@ module Gitlab
raise
NotImplementedError
end
def
title
"
#{
@subject
.
class
.
name
.
demodulize
}
:
#{
label
}
"
end
# Deprecation warning: this method is here because we need to maintain
# backwards compatibility with legacy statuses. We often do something
# like "ci-status ci-status-#{status}" to set CSS class.
...
...
@@ -33,7 +32,7 @@ module Gitlab
self
.
class
.
name
.
demodulize
.
downcase
.
underscore
end
def
has_details?
(
_user
=
nil
)
def
has_details?
false
end
...
...
@@ -41,7 +40,7 @@ module Gitlab
raise
NotImplementedError
end
def
has_action?
(
_user
=
nil
)
def
has_action?
false
end
...
...
lib/gitlab/ci/status/extended.rb
浏览文件 @
9c0a8cb5
...
...
@@ -2,8 +2,12 @@ module Gitlab
module
Ci
module
Status
module
Extended
def
matches?
(
_subject
,
_user
)
raise
NotImplementedError
extend
ActiveSupport
::
Concern
class_methods
do
def
matches?
(
_subject
,
_user
)
raise
NotImplementedError
end
end
end
end
...
...
lib/gitlab/ci/status/factory.rb
浏览文件 @
9c0a8cb5
...
...
@@ -2,7 +2,7 @@ module Gitlab
module
Ci
module
Status
class
Factory
def
initialize
(
subject
,
user
=
nil
)
def
initialize
(
subject
,
user
)
@subject
=
subject
@user
=
user
end
...
...
@@ -32,7 +32,7 @@ module Gitlab
def
core_status
Gitlab
::
Ci
::
Status
.
const_get
(
simple_status
.
capitalize
)
.
new
(
@subject
)
.
new
(
@subject
,
@user
)
.
extend
(
self
.
class
.
common_helpers
)
end
...
...
lib/gitlab/ci/status/pipeline/common.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,14 +3,14 @@ module Gitlab
module
Status
module
Pipeline
module
Common
def
has_details?
(
current_user
)
can?
(
current_
user
,
:read_pipeline
,
subject
)
def
has_details?
can?
(
user
,
:read_pipeline
,
subject
)
end
def
details_path
namespace_project_pipeline_path
(
@
subject
.
project
.
namespace
,
@
subject
.
project
,
@
subject
)
namespace_project_pipeline_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
has_action?
...
...
lib/gitlab/ci/status/pipeline/success_with_warnings.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,7 +3,7 @@ module Gitlab
module
Status
module
Pipeline
class
SuccessWithWarnings
<
SimpleDelegator
extend
Status
::
Extended
include
Status
::
Extended
def
text
'passed'
...
...
@@ -21,7 +21,7 @@ module Gitlab
'success_with_warnings'
end
def
self
.
matches?
(
pipeline
)
def
self
.
matches?
(
pipeline
,
user
)
pipeline
.
success?
&&
pipeline
.
has_warnings?
end
end
...
...
lib/gitlab/ci/status/stage/common.rb
浏览文件 @
9c0a8cb5
...
...
@@ -3,15 +3,15 @@ module Gitlab
module
Status
module
Stage
module
Common
def
has_details?
(
current_user
)
can?
(
current_
user
,
:read_pipeline
,
subject
)
def
has_details?
can?
(
user
,
:read_pipeline
,
subject
)
end
def
details_path
namespace_project_pipeline_path
(
@
subject
.
project
.
namespace
,
@
subject
.
project
,
@
subject
.
pipeline
,
anchor:
@
subject
.
name
)
namespace_project_pipeline_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
.
pipeline
,
anchor:
subject
.
name
)
end
def
has_action?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录