Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ckanext-odsh
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Transparenzportal
ckanext-odsh
Commits
8829c47b
Commit
8829c47b
authored
4 years ago
by
Benjamin Becker
Browse files
Options
Downloads
Patches
Plain Diff
blocks user_activity_list for non sysadmins
parent
1c4d9979
Branches
ckan-2.9
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/logic/auth.py
+5
-0
5 additions, 0 deletions
ckanext/odsh/logic/auth.py
ckanext/odsh/tests_tpsh/test_auth.py
+6
-0
6 additions, 0 deletions
ckanext/odsh/tests_tpsh/test_auth.py
with
11 additions
and
0 deletions
ckanext/odsh/logic/auth.py
+
5
−
0
View file @
8829c47b
...
@@ -24,6 +24,10 @@ def allow_sysadmin_only(original_auth_function):
...
@@ -24,6 +24,10 @@ def allow_sysadmin_only(original_auth_function):
def
user_list
(
context
,
data_dict
):
def
user_list
(
context
,
data_dict
):
pass
pass
@allow_sysadmin_only
(
get
.
user_activity_list
)
def
user_activity_list
(
context
,
data_dict
):
pass
@allow_sysadmin_only
(
update
.
user_update
)
@allow_sysadmin_only
(
update
.
user_update
)
def
user_update
(
context
,
data_dict
):
def
user_update
(
context
,
data_dict
):
pass
pass
...
@@ -39,6 +43,7 @@ def user_invite(context, data_dict):
...
@@ -39,6 +43,7 @@ def user_invite(context, data_dict):
def
get_auth_functions
():
def
get_auth_functions
():
return
{
return
{
"
user_list
"
:
user_list
,
"
user_list
"
:
user_list
,
"
user_activity_list
"
:
user_activity_list
,
"
user_update
"
:
user_update
,
"
user_update
"
:
user_update
,
"
user_create
"
:
user_create
,
"
user_create
"
:
user_create
,
"
user_invite
"
:
user_invite
,
"
user_invite
"
:
user_invite
,
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/tests_tpsh/test_auth.py
+
6
−
0
View file @
8829c47b
...
@@ -23,6 +23,11 @@ class TestAuthorization:
...
@@ -23,6 +23,11 @@ class TestAuthorization:
assert
response
.
status_code
==
403
assert
response
.
status_code
==
403
assert
"
Zugriff nicht erlaubt
"
in
response
assert
"
Zugriff nicht erlaubt
"
in
response
url
=
url_for
(
"
user.activity
"
,
id
=
username
)
response
=
app
.
get
(
url
)
assert
response
.
status_code
==
500
def
test_user_actions_not_accessible_by_regular_user
(
self
):
def
test_user_actions_not_accessible_by_regular_user
(
self
):
def
assert_not_authorized
(
action
,
context
,
data_dict
):
def
assert_not_authorized
(
action
,
context
,
data_dict
):
with
pytest
.
raises
(
NotAuthorized
):
with
pytest
.
raises
(
NotAuthorized
):
...
@@ -36,6 +41,7 @@ class TestAuthorization:
...
@@ -36,6 +41,7 @@ class TestAuthorization:
assert_not_authorized
(
"
user_delete
"
,
{
"
user
"
:
username
},
{
"
id
"
:
username
})
assert_not_authorized
(
"
user_delete
"
,
{
"
user
"
:
username
},
{
"
id
"
:
username
})
assert_not_authorized
(
"
user_create
"
,
{
"
user
"
:
username
},
{
"
name
"
:
"
foo
"
})
assert_not_authorized
(
"
user_create
"
,
{
"
user
"
:
username
},
{
"
name
"
:
"
foo
"
})
assert_not_authorized
(
"
user_invite
"
,
{
"
user
"
:
username
},
{})
assert_not_authorized
(
"
user_invite
"
,
{
"
user
"
:
username
},
{})
assert_not_authorized
(
"
user_activity_list
"
,
{
"
user
"
:
username
},
{
"
id
"
:
username
})
def
test_user_list_accessible_for_sysadmin
(
self
):
def
test_user_list_accessible_for_sysadmin
(
self
):
adminuser
=
factories
.
Sysadmin
()
adminuser
=
factories
.
Sysadmin
()
...
...
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