Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c5ed0a20
authored
Feb 16, 2021
by
Máhonfai Bálint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add view to remove all users from group
parent
616472ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
circle/dashboard/urls.py
+4
-0
circle/dashboard/views/group.py
+27
-0
No files found.
circle/dashboard/urls.py
View file @
c5ed0a20
...
@@ -32,6 +32,7 @@ from .views import (
...
@@ -32,6 +32,7 @@ from .views import (
DiskRemoveView
,
get_disk_download_status
,
DiskRemoveView
,
get_disk_download_status
,
GroupRemoveUserView
,
GroupRemoveUserView
,
GroupRemoveFutureUserView
,
GroupRemoveFutureUserView
,
GroupRemoveAllUsersView
,
GroupCreate
,
GroupProfileUpdate
,
GroupCreate
,
GroupProfileUpdate
,
TemplateChoose
,
TemplateChoose
,
UserCreationView
,
UserCreationView
,
...
@@ -192,6 +193,9 @@ urlpatterns = [
...
@@ -192,6 +193,9 @@ urlpatterns = [
url
(
r'^group/(?P<group_pk>\d+)/remove/futureuser/(?P<member_org_id>.+)/$'
,
url
(
r'^group/(?P<group_pk>\d+)/remove/futureuser/(?P<member_org_id>.+)/$'
,
GroupRemoveFutureUserView
.
as_view
(),
GroupRemoveFutureUserView
.
as_view
(),
name
=
"dashboard.views.remove-future-user"
),
name
=
"dashboard.views.remove-future-user"
),
url
(
r'^group/(?P<group_pk>\d+)/remove/user/all/$'
,
GroupRemoveAllUsersView
.
as_view
(),
name
=
"dashboard.views.remove-all-users"
),
url
(
r'^group/create/$'
,
GroupCreate
.
as_view
(),
url
(
r'^group/create/$'
,
GroupCreate
.
as_view
(),
name
=
'dashboard.views.group-create'
),
name
=
'dashboard.views.group-create'
),
url
(
r'^group/(?P<group_pk>\d+)/permissions/$'
,
url
(
r'^group/(?P<group_pk>\d+)/permissions/$'
,
...
...
circle/dashboard/views/group.py
View file @
c5ed0a20
...
@@ -285,6 +285,33 @@ class GroupRemoveFutureUserView(GroupRemoveUserView):
...
@@ -285,6 +285,33 @@ class GroupRemoveFutureUserView(GroupRemoveUserView):
group
=
self
.
get_object
())
.
delete
()
group
=
self
.
get_object
())
.
delete
()
class
GroupRemoveAllUsersView
(
DeleteViewBase
):
model
=
Group
level
=
'operator'
slug_field
=
'pk'
slug_url_kwarg
=
'group_pk'
success_message
=
_
(
"All users successfully removed from group."
)
def
check_auth
(
self
):
if
not
self
.
get_object
()
.
profile
.
has_level
(
self
.
request
.
user
,
self
.
level
):
raise
PermissionDenied
()
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
GroupRemoveAllUsersView
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'member'
]
=
_
(
"all users"
)
return
context
def
get_success_url
(
self
):
return
reverse_lazy
(
"dashboard.views.group-detail"
,
kwargs
=
{
'pk'
:
self
.
get_object
()
.
pk
})
def
delete_obj
(
self
,
request
,
*
args
,
**
kwargs
):
container
=
self
.
get_object
()
container
.
user_set
.
clear
()
FutureMember
.
objects
.
filter
(
group
=
container
)
.
delete
()
class
GroupDelete
(
DeleteViewBase
):
class
GroupDelete
(
DeleteViewBase
):
model
=
Group
model
=
Group
success_message
=
_
(
"Group successfully deleted."
)
success_message
=
_
(
"Group successfully deleted."
)
...
...
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