Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
beat
beat.web
Commits
f7bf9474
Commit
f7bf9474
authored
7 years ago
by
Jaden Diefenbaugh
Browse files
Options
Downloads
Patches
Plain Diff
finish pinning down permissions, add redirect
parent
cffcf182
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!223
Reports overhaul
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/reports/views.py
+25
-15
25 additions, 15 deletions
beat/web/reports/views.py
with
25 additions
and
15 deletions
beat/web/reports/views.py
+
25
−
15
View file @
f7bf9474
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
# #
# #
###############################################################################
###############################################################################
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
,
redirect
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
from
django.template
import
RequestContext
,
Context
from
django.template
import
RequestContext
,
Context
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -85,20 +85,30 @@ def for_author(request, author_name, report_name):
...
@@ -85,20 +85,30 @@ def for_author(request, author_name, report_name):
name
=
report_name
)
name
=
report_name
)
isAuthor
=
request
.
user
.
username
==
obj
.
author
.
username
isAuthor
=
request
.
user
.
username
==
obj
.
author
.
username
isEditable
=
obj
.
status
==
'
E
'
if
not
isAuthor
:
isPublished
=
obj
.
status
==
'
P
'
# return 404
isLocked
=
obj
.
status
==
'
L
'
raise
Http404
(
'
No %s matches the given query.
'
%
Report
.
_meta
.
object_name
)
# if its the author and its locked, redirect to numbered url
return
render_to_response
(
'
reports/report.html
'
,
# same if its published
{
if
isPublished
or
(
isAuthor
and
isLocked
):
'
author
'
:
author_name
,
return
redirect
(
obj
)
'
report_name
'
:
report_name
,
'
owner
'
:
(
request
.
user
==
obj
.
author
),
'
report
'
:
obj
,
# only valid when the author is accessing it and its editable
'
USE_HTTPS_GRAVATAR
'
:
settings
.
USE_HTTPS_GRAVATAR
,
if
isEditable
and
isAuthor
:
},
return
render_to_response
(
'
reports/report.html
'
,
context_instance
=
RequestContext
(
request
))
{
'
author
'
:
author_name
,
'
report_name
'
:
report_name
,
'
owner
'
:
(
request
.
user
==
obj
.
author
),
'
report
'
:
obj
,
'
USE_HTTPS_GRAVATAR
'
:
settings
.
USE_HTTPS_GRAVATAR
,
},
context_instance
=
RequestContext
(
request
))
# return 404
raise
Http404
(
'
No %s matches the given query.
'
%
Report
.
_meta
.
object_name
)
#------------------------------------------------
#------------------------------------------------
...
...
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