Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
3223f7b0
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,发现更多精彩内容 >>
未验证
提交
3223f7b0
编写于
12月 04, 2018
作者:
J
James Lopez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update code based on feedback
上级
04622671
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
6 deletion
+22
-6
changelogs/unreleased/54826-use-read_repository-scope-on-read-only-files-endpoints.yml
...se-read_repository-scope-on-read-only-files-endpoints.yml
+1
-1
doc/api/repository_files.md
doc/api/repository_files.md
+3
-5
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+18
-0
未找到文件。
changelogs/unreleased/54826-use-read_repository-scope-on-read-only-files-endpoints.yml
浏览文件 @
3223f7b0
---
title
:
Use read_repository scope on read-only files API
merge_request
:
merge_request
:
23534
author
:
type
:
fixed
doc/api/repository_files.md
浏览文件 @
3223f7b0
...
...
@@ -4,18 +4,16 @@
**Create, read, update and delete repository files using this API**
The different scopes available using
[
personal access tokens
]
[
personal-access-tokens
]
are depicted
The different scopes available using
[
personal access tokens
]
(
../user/profile/personal_access_tokens.md
)
are depicted
in the following table.
| Scope | Description |
| ----- | ----------- |
|
`read_repository`
| Allows read-access to the repository files |
|
`api`
| Allows read-write access to the repository files |
|
`read_repository`
| Allows read-access to the repository files
.
|
|
`api`
| Allows read-write access to the repository files
.
|
> `read_repository` scope was [introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23534) in GitLab 11.5.3.
[
personal-access-tokens
]:
../user/profile/personal_access_tokens.md
## Get file from repository
Allows you to receive information about file in repository like name, size,
...
...
spec/requests/api/files_spec.rb
浏览文件 @
3223f7b0
...
...
@@ -391,6 +391,24 @@ describe API::Files do
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
context
'with PATs'
do
it
'returns 403 with `read_repository` scope'
do
token
=
create
(
:personal_access_token
,
scopes:
[
'read_repository'
],
user:
user
)
post
api
(
route
(
file_path
),
personal_access_token:
token
),
params
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
it
'returns 201 with `api` scope'
do
token
=
create
(
:personal_access_token
,
scopes:
[
'api'
],
user:
user
)
post
api
(
route
(
file_path
),
personal_access_token:
token
),
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
end
end
context
"when specifying an author"
do
it
"creates a new file with the specified author"
do
params
.
merge!
(
author_email:
author_email
,
author_name:
author_name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录