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

Add the `inherited` field to Protected Branches

上级 4d23d9d4
No related branches found
No related tags found
1 合并请求!1355Draft: Reset password by phone with geetest captcha
......@@ -83,7 +83,8 @@ Example response:
```
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:
......@@ -111,7 +112,8 @@ Example response:
}
],
"allow_force_push":false,
"code_owner_approval_required": false
"code_owner_approval_required": false,
"inherited": true
},
...
]
......
......@@ -44,5 +44,10 @@ def supports_unprotection_restrictions?
project.licensed_feature_available?(:unprotection_restrictions)
end
def inherited?
!namespace_id.nil?
end
alias_method :inherited, :inherited?
end
end
......@@ -9,6 +9,7 @@ module ProtectedBranch
prepended do
expose :unprotect_access_levels, using: ::API::Entities::ProtectedRefAccess, documentation: { is_array: true }
expose :code_owner_approval_required, documentation: { type: 'boolean' }
expose :inherited, documentation: { type: 'boolean' }
end
end
end
......
......@@ -258,4 +258,22 @@
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
......@@ -21,6 +21,7 @@
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['unprotect_access_levels']).to eq([])
expect(json_response).to include('inherited')
end
context 'with per user/group access levels' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册