Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
25503a35
C
Cvat
项目概览
疯人忠
/
Cvat
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cvat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
25503a35
编写于
11月 16, 2022
作者:
K
Kirill Sizov
提交者:
GitHub
11月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix export job (#5282)
上级
c86746c7
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
7326 addition
and
4647 deletion
+7326
-4647
CHANGELOG.md
CHANGELOG.md
+1
-0
cvat/apps/iam/permissions.py
cvat/apps/iam/permissions.py
+1
-0
cvat/apps/iam/rules/jobs.csv
cvat/apps/iam/rules/jobs.csv
+8
-0
cvat/apps/iam/rules/jobs.rego
cvat/apps/iam/rules/jobs.rego
+5
-4
cvat/apps/iam/rules/jobs_test.gen.rego
cvat/apps/iam/rules/jobs_test.gen.rego
+7287
-4640
tests/python/rest_api/test_jobs.py
tests/python/rest_api/test_jobs.py
+24
-3
未找到文件。
CHANGELOG.md
浏览文件 @
25503a35
...
...
@@ -76,6 +76,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
-
Oriented bounding boxes broken with COCO format ss(
<https://github.com/opencv/cvat/pull/5219>
)
-
Fixed upload resumption in production environments
(
<https://github.com/opencv/cvat/issues/4839>
)
-
Fixed job exporting (
<https://github.com/opencv/cvat/pull/5282>
)
-
Visibility and ignored information fail to be loaded (MOT dataset format) (
<https://github.com/opencv/cvat/pull/5270>
)
### Security
...
...
cvat/apps/iam/permissions.py
浏览文件 @
25503a35
...
...
@@ -892,6 +892,7 @@ class JobPermission(OpenPolicyAgentPermission):
(
'update'
,
'PUT'
):
'update'
,
# TODO: do we need the method?
(
'destroy'
,
'DELETE'
):
'delete'
,
(
'annotations'
,
'GET'
):
'view:annotations'
,
(
'dataset_export'
,
'GET'
):
'export:dataset'
,
(
'annotations'
,
'PATCH'
):
'update:annotations'
,
(
'annotations'
,
'DELETE'
):
'delete:annotations'
,
(
'annotations'
,
'PUT'
):
'update:annotations'
,
...
...
cvat/apps/iam/rules/jobs.csv
浏览文件 @
25503a35
...
...
@@ -21,6 +21,14 @@ view:annotations,Job,Sandbox,None,,GET,/jobs/{id}/annotations,Admin,N/A
view:annotations,Job,Sandbox,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/annotations,None,N/A
view:annotations,Job,Organization,None,,GET,/jobs/{id}/annotations,User,Maintainer
view:annotations,Job,Organization,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/annotations,None,Worker
export:annotations,Job,Sandbox,None,,GET,/jobs/{id}/annotations?format={format},Admin,N/A
export:annotations,Job,Sandbox,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/annotations?format={format},None,N/A
export:annotations,Job,Organization,None,,GET,/jobs/{id}/annotations?format={format},User,Maintainer
export:annotations,Job,Organization,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/annotations?format={format},None,Worker
export:dataset,Job,Sandbox,None,,GET,/jobs/{id}/dataset,Admin,N/A
export:dataset,Job,Sandbox,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/dataset,None,N/A
export:dataset,Job,Organization,None,,GET,/jobs/{id}/dataset,User,Maintainer
export:dataset,Job,Organization,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,GET,/jobs/{id}/dataset,None,Worker
update:annotations,Job,Sandbox,None,,PATCH,/jobs/{id}/annotations,Admin,N/A
update:annotations,Job,Sandbox,"Project:owner, Project:assignee, Task:owner, Task:assignee, Assignee",,PATCH,/jobs/{id}/annotations,Worker,N/A
update:annotations,Job,Organization,None,,PATCH,/jobs/{id}/annotations,User,Maintainer
...
...
cvat/apps/iam/rules/jobs.rego
浏览文件 @
25503a35
...
...
@@ -4,7 +4,8 @@ import data.organizations
# input: {
# "scope": <"view"|"list"|"update:state"|"update:stage"|"update:assignee""delete"|
# "view:annotations"|"update:annotations"|"delete:annotations"|"view:data"> or null,
# "view:annotations"|"update:annotations"|"delete:annotations"|"view:data"|
# "export:annotations" | "export:dataset" |> or null,
# "auth": {
# "user": {
# "id": <num>,
...
...
@@ -139,20 +140,20 @@ filter = [] { # Django Q object to filter list of entries
}
allow
{
{
utils
.
VIEW
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
{
utils
.
VIEW
,
utils
.
EXPORT_DATASET
,
utils
.
EXPORT_ANNOTATIONS
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
utils
.
is_sandbox
is_job_staff
}
allow
{
{
utils
.
VIEW
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
{
utils
.
VIEW
,
utils
.
EXPORT_DATASET
,
utils
.
EXPORT_ANNOTATIONS
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
input
.
auth
.
organization
.
id
==
input
.
resource
.
organization
.
id
utils
.
has_perm
(
utils
.
USER
)
organizations
.
has_perm
(
organizations
.
MAINTAINER
)
}
allow
{
{
utils
.
VIEW
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
{
utils
.
VIEW
,
utils
.
EXPORT_DATASET
,
utils
.
EXPORT_ANNOTATIONS
,
utils
.
VIEW_ANNOTATIONS
,
utils
.
VIEW_DATA
,
utils
.
VIEW_METADATA
,
utils
.
VIEW_COMMITS
}[
input
.
scope
]
input
.
auth
.
organization
.
id
==
input
.
resource
.
organization
.
id
organizations
.
has_perm
(
organizations
.
WORKER
)
is_job_staff
...
...
cvat/apps/iam/rules/jobs_test.gen.rego
浏览文件 @
25503a35
此差异已折叠。
点击以展开。
tests/python/rest_api/test_jobs.py
浏览文件 @
25503a35
...
...
@@ -539,9 +539,30 @@ class TestJobDataset:
response
=
self
.
_export_dataset
(
admin_user
,
job
[
"id"
],
format
=
"CVAT for images 1.1"
)
assert
response
.
data
def
test_can_export_annotations
(
self
,
admin_user
:
str
,
jobs_with_shapes
:
List
):
job
=
jobs_with_shapes
[
0
]
response
=
self
.
_export_annotations
(
admin_user
,
job
[
"id"
],
format
=
"CVAT for images 1.1"
)
def
test_non_admin_can_export_dataset
(
self
,
users
,
tasks
,
jobs_with_shapes
):
job_id
,
username
=
next
(
(
(
job
[
"id"
],
tasks
[
job
[
"task_id"
]][
"owner"
][
"username"
])
for
job
in
jobs_with_shapes
if
"admin"
not
in
users
[
tasks
[
job
[
"task_id"
]][
"owner"
][
"id"
]][
"groups"
]
and
tasks
[
job
[
"task_id"
]][
"target_storage"
]
is
None
and
tasks
[
job
[
"task_id"
]][
"organization"
]
is
None
)
)
response
=
self
.
_export_dataset
(
username
,
job_id
,
format
=
"CVAT for images 1.1"
)
assert
response
.
data
def
test_non_admin_can_export_annotations
(
self
,
users
,
tasks
,
jobs_with_shapes
):
job_id
,
username
=
next
(
(
(
job
[
"id"
],
tasks
[
job
[
"task_id"
]][
"owner"
][
"username"
])
for
job
in
jobs_with_shapes
if
"admin"
not
in
users
[
tasks
[
job
[
"task_id"
]][
"owner"
][
"id"
]][
"groups"
]
and
tasks
[
job
[
"task_id"
]][
"target_storage"
]
is
None
and
tasks
[
job
[
"task_id"
]][
"organization"
]
is
None
)
)
response
=
self
.
_export_annotations
(
username
,
job_id
,
format
=
"CVAT for images 1.1"
)
assert
response
.
data
@
pytest
.
mark
.
parametrize
(
"username, jid"
,
[(
"admin1"
,
14
)])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录