Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
6ddee040
Commit
6ddee040
authored
8 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
More warnings resolved
parent
1e9b7610
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/auth/containerauth.py
+1
-1
1 addition, 1 deletion
api/auth/containerauth.py
api/dao/containerutil.py
+4
-5
4 additions, 5 deletions
api/dao/containerutil.py
api/handlers/containerhandler.py
+8
-8
8 additions, 8 deletions
api/handlers/containerhandler.py
with
13 additions
and
14 deletions
api/auth/containerauth.py
+
1
−
1
View file @
6ddee040
...
...
@@ -87,7 +87,7 @@ def collection_permissions(handler, container=None):
def
public_request
(
handler
,
container
=
None
,
parent_
container
=
None
):
def
public_request
(
handler
,
container
=
None
):
"""
For public requests we allow only GET operations on containers marked as public.
"""
...
...
This diff is collapsed.
Click to expand it.
api/dao/containerutil.py
+
4
−
5
View file @
6ddee040
...
...
@@ -38,6 +38,9 @@ def add_id_to_subject(subject, pid):
class
ContainerReference
(
object
):
# pylint: disable=redefined-builtin
# TODO: refactor to resolve pylint warning
def
__init__
(
self
,
type
,
id
):
if
type
not
in
CONT_TYPES
:
raise
Exception
(
'
Container type must be one of {}
'
.
format
(
CONT_TYPES
))
...
...
@@ -87,11 +90,7 @@ class ContainerReference(object):
class
FileReference
(
ContainerReference
):
def
__init__
(
self
,
type
,
id
,
name
):
if
type
not
in
CONT_TYPES
:
raise
Exception
(
'
Container type must be one of {}
'
.
format
(
CONT_TYPES
))
self
.
type
=
type
self
.
id
=
id
super
(
FileReference
,
self
).
__init__
(
type
,
id
)
self
.
name
=
name
@classmethod
...
...
This diff is collapsed.
Click to expand it.
api/handlers/containerhandler.py
+
8
−
8
View file @
6ddee040
import
bson
import
copy
import
json
import
datetime
import
dateutil
...
...
@@ -83,6 +81,8 @@ class ContainerHandler(base.RequestHandler):
def
__init__
(
self
,
request
=
None
,
response
=
None
):
super
(
ContainerHandler
,
self
).
__init__
(
request
,
response
)
self
.
storage
=
None
self
.
config
=
None
def
get
(
self
,
cont_name
,
**
kwargs
):
_id
=
kwargs
.
pop
(
'
cid
'
)
...
...
@@ -234,7 +234,7 @@ class ContainerHandler(base.RequestHandler):
c
=
self
.
_get_container
(
cid
)
permchecker
=
self
.
_get_permchecker
(
c
)
result
=
permchecker
(
noop
)(
'
GET
'
,
cid
)
permchecker
(
noop
)(
'
GET
'
,
cid
)
children
=
hierarchy
.
get_children
(
'
session
'
,
cid
)
id_array
=
[
str
(
c
[
'
_id
'
])
for
c
in
children
]
...
...
@@ -247,7 +247,7 @@ class ContainerHandler(base.RequestHandler):
response
=
{}
for
j
in
jobs
:
job
=
Job
.
load
(
j
)
for
k
,
v
in
job
.
inputs
.
iteritems
():
for
_
,
v
in
job
.
inputs
.
iteritems
():
if
v
.
type
==
'
acquisition
'
and
v
.
id
in
id_array
:
if
response
.
get
(
v
.
id
)
is
not
None
:
response
[
v
.
id
].
append
(
job
)
...
...
@@ -273,7 +273,7 @@ class ContainerHandler(base.RequestHandler):
else
:
# admin_only flag will limit the results to the set on which the user is an admin
admin_only
=
self
.
is_true
(
'
admin
'
)
permchecker
=
containerauth
.
list_permission_checker
(
self
,
admin_only
)
permchecker
=
containerauth
.
list_permission_checker
(
self
)
# if par_cont_name (parent container name) and par_id are not null we return only results
# within that container
if
par_cont_name
:
...
...
@@ -365,7 +365,7 @@ class ContainerHandler(base.RequestHandler):
debuginfo
.
add_debuginfo
(
self
,
cont_name
,
results
)
return
results
def
post
(
self
,
cont_name
,
**
kwargs
):
def
post
(
self
,
cont_name
):
self
.
config
=
self
.
container_handler_configurations
[
cont_name
]
self
.
storage
=
self
.
config
[
'
storage
'
]
mongo_validator
,
payload_validator
=
self
.
_get_validators
()
...
...
@@ -469,7 +469,7 @@ class ContainerHandler(base.RequestHandler):
self
.
config
=
self
.
container_handler_configurations
[
cont_name
]
self
.
storage
=
self
.
config
[
'
storage
'
]
container
=
self
.
_get_container
(
_id
)
target_parent_container
,
parent_id_property
=
self
.
_get_parent_container
(
container
)
target_parent_container
,
_
=
self
.
_get_parent_container
(
container
)
permchecker
=
self
.
_get_permchecker
(
container
,
target_parent_container
)
try
:
# This line exec the actual delete checking permissions using the decorator permchecker
...
...
@@ -525,7 +525,7 @@ class ContainerHandler(base.RequestHandler):
if
self
.
superuser_request
:
return
always_ok
elif
self
.
public_request
:
return
containerauth
.
public_request
(
self
,
container
,
parent_
container
)
return
containerauth
.
public_request
(
self
,
container
)
else
:
permchecker
=
self
.
config
[
'
permchecker
'
]
return
permchecker
(
self
,
container
,
parent_container
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment