Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden - archive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
713
Warden
Warden - archive
Commits
b535df56
Commit
b535df56
authored
Mar 8, 2023
by
Rajmund Hruška
Browse files
Options
Downloads
Patches
Plain Diff
Restrict getClients API to clients with 'manage' flag
parent
47d3e026
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
warden_server/warden_server.py
+9
-2
9 additions, 2 deletions
warden_server/warden_server.py
with
9 additions
and
2 deletions
warden_server/warden_server.py
+
9
−
2
View file @
b535df56
...
@@ -305,6 +305,12 @@ class PlainAuthenticator(ObjectBase):
...
@@ -305,6 +305,12 @@ class PlainAuthenticator(ObjectBase):
return
None
return
None
return
client
return
client
if
method
.
manage
:
if
not
client
.
manage
:
self
.
log
.
info
(
"
authorize: failed, client does not have manage enabled
"
)
return
None
return
client
if
method
.
read
:
if
method
.
read
:
if
not
client
.
read
:
if
not
client
.
read
:
self
.
log
.
info
(
"
authorize: failed, client does not have read enabled
"
)
self
.
log
.
info
(
"
authorize: failed, client does not have read enabled
"
)
...
@@ -1431,13 +1437,14 @@ class PostgreSQL(DataBase):
...
@@ -1431,13 +1437,14 @@ class PostgreSQL(DataBase):
return
[
"
DELETE FROM events WHERE id <= %s
"
],
[(
id_
,)],
0
return
[
"
DELETE FROM events WHERE id <= %s
"
],
[(
id_
,)],
0
def
expose
(
read
=
True
,
write
=
False
,
debug
=
False
):
def
expose
(
read
=
True
,
write
=
False
,
debug
=
False
,
manage
=
False
):
def
expose_deco
(
meth
):
def
expose_deco
(
meth
):
meth
.
exposed
=
True
meth
.
exposed
=
True
meth
.
read
=
read
meth
.
read
=
read
meth
.
write
=
write
meth
.
write
=
write
meth
.
debug
=
debug
meth
.
debug
=
debug
meth
.
manage
=
manage
if
not
hasattr
(
meth
,
"
arguments
"
):
if
not
hasattr
(
meth
,
"
arguments
"
):
meth
.
arguments
=
get_method_params
(
meth
)
meth
.
arguments
=
get_method_params
(
meth
)
return
meth
return
meth
...
@@ -1630,7 +1637,7 @@ class WardenHandler(ObjectBase):
...
@@ -1630,7 +1637,7 @@ class WardenHandler(ObjectBase):
info
[
"
description
"
]
=
self
.
description
info
[
"
description
"
]
=
self
.
description
return
info
return
info
@expose
(
read
=
True
)
@expose
(
manage
=
True
)
@json_wrapper
@json_wrapper
def
getClients
(
self
):
def
getClients
(
self
):
clients
=
self
.
db
.
get_clients
()
clients
=
self
.
db
.
get_clients
()
...
...
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