Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp-account
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
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp-account
Merge requests
!114
fix: bad duplicate on has_permission
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix: bad duplicate on has_permission
bugfix/double_has_permission
into
master
Overview
0
Commits
2
Pipelines
3
Changes
1
Merged
Benoit Alessandroni
requested to merge
bugfix/double_has_permission
into
master
1 year ago
Overview
0
Commits
2
Pipelines
3
Changes
1
Expand
0
0
Merge request reports
Compare
master
version 2
ec4ec754
1 year ago
version 1
3c3252dd
1 year ago
master (base)
and
latest version
latest version
b7907b26
2 commits,
1 year ago
version 2
ec4ec754
1 commit,
1 year ago
version 1
3c3252dd
1 commit,
1 year ago
1 file
+
5
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
djangoldp_account/permissions.py
+
5
−
5
Options
@@ -26,10 +26,6 @@ def check_client_ip(request):
class
IPOpenPermissions
(
LDPPermissions
):
def
has_permission
(
self
,
request
,
view
):
if
check_client_ip
(
request
):
return
True
return
super
().
has_permission
(
request
,
view
)
def
get_container_permissions
(
self
,
request
,
view
,
obj
=
None
):
'''
analyses the Model
'
s set anonymous, authenticated and owner_permissions and returns these
'''
@@ -46,11 +42,15 @@ class IPOpenPermissions(LDPPermissions):
return
super
().
has_container_permission
(
request
,
view
)
def
has_permission
(
self
,
request
,
view
):
if
check_client_ip
(
request
):
return
True
"""
concerned with the permissions to access the _view_
"""
if
is_anonymous_user
(
request
.
user
):
if
not
self
.
has_container_permission
(
request
,
view
):
return
False
return
True
return
super
().
has_permission
(
request
,
view
)
def
has_object_permission
(
self
,
request
,
view
,
obj
):
if
check_client_ip
(
request
):
Loading