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
9772fcb6
Commit
9772fcb6
authored
7 years ago
by
Harsha Kethineni
Browse files
Options
Downloads
Patches
Plain Diff
corrected error messages
parent
de6b6ad6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/auth/userauth.py
+2
-2
2 additions, 2 deletions
api/auth/userauth.py
api/jobs/handlers.py
+8
-8
8 additions, 8 deletions
api/jobs/handlers.py
with
10 additions
and
10 deletions
api/auth/userauth.py
+
2
−
2
View file @
9772fcb6
...
...
@@ -9,7 +9,7 @@ def default(handler, user=None):
pass
elif
method
==
'
PUT
'
and
handler
.
uid
==
_id
:
if
'
root
'
in
payload
and
payload
[
'
root
'
]
!=
user
[
'
root
'
]:
handler
.
abort
(
400
,
'
user cannot alter own
superuser
privilege
'
)
handler
.
abort
(
400
,
'
user cannot alter own
admin
privilege
'
)
elif
'
disabled
'
in
payload
and
payload
[
'
disabled
'
]
!=
user
.
get
(
'
disabled
'
):
handler
.
abort
(
400
,
'
user cannot alter own disabled status
'
)
else
:
...
...
@@ -17,7 +17,7 @@ def default(handler, user=None):
elif
method
==
'
PUT
'
and
handler
.
user_is_admin
:
pass
elif
method
==
'
POST
'
and
not
handler
.
superuser_request
and
not
handler
.
user_is_admin
:
handler
.
abort
(
403
,
'
only
superuser
are allowed to create users
'
)
handler
.
abort
(
403
,
'
only
admins
are allowed to create users
'
)
elif
method
==
'
POST
'
and
(
handler
.
superuser_request
or
handler
.
user_is_admin
):
pass
elif
method
==
'
GET
'
:
...
...
This diff is collapsed.
Click to expand it.
api/jobs/handlers.py
+
8
−
8
View file @
9772fcb6
...
...
@@ -103,7 +103,7 @@ class GearHandler(base.RequestHandler):
def
post
(
self
,
_id
):
"""
Upsert an entire gear document.
"""
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
doc
=
self
.
request
.
json
...
...
@@ -126,7 +126,7 @@ class GearHandler(base.RequestHandler):
def
delete
(
self
,
_id
):
"""
Delete a gear. Generally not recommended.
"""
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
return
remove_gear
(
_id
)
...
...
@@ -227,7 +227,7 @@ class JobsHandler(base.RequestHandler):
def
get
(
self
):
"""
List all jobs.
"""
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
return
list
(
config
.
db
.
jobs
.
find
())
def
add
(
self
):
...
...
@@ -286,14 +286,14 @@ class JobsHandler(base.RequestHandler):
def
stats
(
self
):
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
return
Queue
.
get_statistics
()
def
next
(
self
):
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
tags
=
self
.
request
.
GET
.
getall
(
'
tags
'
)
...
...
@@ -309,7 +309,7 @@ class JobsHandler(base.RequestHandler):
def
reap_stale
(
self
):
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
count
=
Queue
.
scan_for_orphans
()
return
{
'
orphaned
'
:
count
}
...
...
@@ -321,7 +321,7 @@ class JobHandler(base.RequestHandler):
def
get
(
self
,
_id
):
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
return
Job
.
get
(
_id
)
...
...
@@ -406,7 +406,7 @@ class JobHandler(base.RequestHandler):
def
add_logs
(
self
,
_id
):
"""
Add to a job
'
s logs
"""
if
not
self
.
superuser_request
and
not
self
.
user_is_admin
:
self
.
abort
(
403
,
'
Request requires
superuser
'
)
self
.
abort
(
403
,
'
Request requires
admin
'
)
doc
=
self
.
request
.
json
...
...
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