Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-cas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-cas
Commits
43bb5105
Commit
43bb5105
authored
Jul 21, 2008
by
Brodie Rao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified django.contrib.admin detection, also fixing support for newsforms-admin
parent
595de62f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
django_cas/middleware.py
+3
-15
No files found.
django_cas/middleware.py
View file @
43bb5105
"""CAS authentication middleware"""
import
os
from
urllib
import
urlencode
from
django.http
import
HttpResponseRedirect
,
HttpResponseForbidden
...
...
@@ -36,21 +35,10 @@ class CASMiddleware(object):
elif
view_func
==
logout
:
return
cas_logout
(
request
,
*
view_args
,
**
view_kwargs
)
admin_prefix
=
settings
.
CAS_ADMIN_PREFIX
if
admin_prefix
:
if
not
request
.
path
.
startswith
(
admin_prefix
):
if
settings
.
CAS_ADMIN_PREFIX
:
if
not
request
.
path
.
startswith
(
settings
.
CAS_ADMIN_PREFIX
):
return
None
else
:
admin_path
=
[
'django'
,
'contrib'
,
'admin'
,
'views'
]
try
:
view_file
=
view_func
.
func_code
.
co_filename
except
AttributeError
:
# If we get a protected decorator that abstracts this away
# into something like _CheckLogin
view_file
=
view_func
.
view_func
.
func_code
.
co_filename
view_path
=
os
.
path
.
split
(
view_file
)[
0
]
.
split
(
os
.
path
.
sep
)[
-
4
:]
if
view_path
!=
admin_path
:
elif
not
view_func
.
__module__
.
startswith
(
'django.contrib.admin.'
):
return
None
if
request
.
user
.
is_authenticated
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment