Skip to content
代码片段 群组 项目
提交 6a6d57a0 编辑于 作者: Max Woolf's avatar Max Woolf
浏览文件

Merge branch 'feature/group-level-protected-branches-rest-api-attr-inherited' into 'master'

Add the `inherited` field to Protected Branches

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110602



Merged-by: default avatarMax Woolf <mwoolf@gitlab.com>
Approved-by: default avatarVasilii Iakliushin <viakliushin@gitlab.com>
Approved-by: default avatarMax Woolf <mwoolf@gitlab.com>
Approved-by: default avatarKevin Morrison <kmorrison@gitlab.com>
Co-authored-by: default avatarAmy Qualls <aqualls@gitlab.com>
Co-authored-by: default avatarSong Huang <songhuang@gitlab.cn>
No related branches found
No related tags found
1 合并请求!1355Draft: Reset password by phone with geetest captcha
...@@ -83,7 +83,8 @@ Example response: ...@@ -83,7 +83,8 @@ Example response:
``` ```
Users on GitLab Premium or higher also see Users on GitLab Premium or higher also see
the `user_id` and `group_id` parameters: the `user_id`, `group_id` and `inherited` parameters. If the `inherited` parameter
exists, means the setting was inherited from the project's group.
Example response: Example response:
...@@ -111,7 +112,8 @@ Example response: ...@@ -111,7 +112,8 @@ Example response:
} }
], ],
"allow_force_push":false, "allow_force_push":false,
"code_owner_approval_required": false "code_owner_approval_required": false,
"inherited": true
}, },
... ...
] ]
......
...@@ -44,5 +44,10 @@ def supports_unprotection_restrictions? ...@@ -44,5 +44,10 @@ def supports_unprotection_restrictions?
project.licensed_feature_available?(:unprotection_restrictions) project.licensed_feature_available?(:unprotection_restrictions)
end end
def inherited?
!namespace_id.nil?
end
alias_method :inherited, :inherited?
end end
end end
...@@ -9,6 +9,7 @@ module ProtectedBranch ...@@ -9,6 +9,7 @@ module ProtectedBranch
prepended do prepended do
expose :unprotect_access_levels, using: ::API::Entities::ProtectedRefAccess, documentation: { is_array: true } expose :unprotect_access_levels, using: ::API::Entities::ProtectedRefAccess, documentation: { is_array: true }
expose :code_owner_approval_required, documentation: { type: 'boolean' } expose :code_owner_approval_required, documentation: { type: 'boolean' }
expose :inherited, documentation: { type: 'boolean' }
end end
end end
end end
......
...@@ -258,4 +258,22 @@ ...@@ -258,4 +258,22 @@
end end
end end
end end
describe '#inherited?' do
context 'when the `namespace_id` is nil' do
before do
subject.assign_attributes(namespace_id: nil)
end
it { is_expected.not_to be_inherited }
end
context 'when the `namespace_id` is present' do
before do
subject.assign_attributes(namespace_id: 123)
end
it { is_expected.to be_inherited }
end
end
end end
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['unprotect_access_levels']).to eq([]) expect(json_response['unprotect_access_levels']).to eq([])
expect(json_response).to include('inherited')
end end
context 'with per user/group access levels' do context 'with per user/group access levels' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册