Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b69641e0
authored
11 years ago
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: checking user when deleting group
parent
4d7140f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
circle/dashboard/tests/test_views.py
+2
-1
circle/dashboard/views.py
+2
-1
No files found.
circle/dashboard/tests/test_views.py
View file @
b69641e0
...
@@ -551,6 +551,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -551,6 +551,7 @@ class GroupDetailTest(LoginMixin, TestCase):
self
.
u1
.
delete
()
self
.
u1
.
delete
()
self
.
u2
.
delete
()
self
.
u2
.
delete
()
self
.
us
.
delete
()
self
.
us
.
delete
()
self
.
u3
.
delete
()
self
.
g1
.
delete
()
self
.
g1
.
delete
()
def
test_404_superuser_group_page
(
self
):
def
test_404_superuser_group_page
(
self
):
...
@@ -624,7 +625,7 @@ class GroupDetailTest(LoginMixin, TestCase):
...
@@ -624,7 +625,7 @@ class GroupDetailTest(LoginMixin, TestCase):
c
=
Client
()
c
=
Client
()
self
.
login
(
c
,
'user3'
)
self
.
login
(
c
,
'user3'
)
response
=
c
.
post
(
'/dashboard/group/delete/1/'
)
response
=
c
.
post
(
'/dashboard/group/delete/1/'
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
Group
.
objects
.
count
(),
num_of_groups
)
self
.
assertEqual
(
Group
.
objects
.
count
(),
num_of_groups
)
def
test_acl_group_delete
(
self
):
def
test_acl_group_delete
(
self
):
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/views.py
View file @
b69641e0
...
@@ -1102,7 +1102,8 @@ class GroupDelete(CheckedDetailView, DeleteView):
...
@@ -1102,7 +1102,8 @@ class GroupDelete(CheckedDetailView, DeleteView):
# github.com/django/django/blob/master/django/views/generic/edit.py#L245
# github.com/django/django/blob/master/django/views/generic/edit.py#L245
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
object
=
self
.
get_object
()
object
=
self
.
get_object
()
if
not
object
.
profile
.
has_level
(
request
.
user
,
'operator'
):
raise
PermissionDenied
()
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Group successfully deleted!"
)
success_message
=
_
(
"Group successfully deleted!"
)
...
...
This diff is collapsed.
Click to expand it.
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