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
9c17da03
authored
Feb 17, 2021
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'group_remove_all_users' into 'master'
Group remove all users See merge request
!422
parents
479d230f
af154f27
Pipeline
#1395
passed with stage
in 0 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
1 deletions
+39
-1
circle/dashboard/static/dashboard/dashboard.js
+1
-1
circle/dashboard/static/dashboard/dashboard.less
+4
-0
circle/dashboard/templates/dashboard/group-detail.html
+3
-0
circle/dashboard/urls.py
+4
-0
circle/dashboard/views/group.py
+27
-0
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
9c17da03
...
@@ -29,7 +29,7 @@ $(function () {
...
@@ -29,7 +29,7 @@ $(function () {
return
false
;
return
false
;
});
});
$
(
'.group-create, .node-create, .tx-tpl-ownership, .group-delete, .node-delete, .disk-remove, .template-delete, .delete-from-group, .lease-delete'
).
click
(
function
(
e
)
{
$
(
'.group-create, .node-create, .tx-tpl-ownership, .group-delete, .node-delete, .disk-remove, .template-delete, .delete-from-group, .
group-remove-all-btn, .
lease-delete'
).
click
(
function
(
e
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'GET'
,
type
:
'GET'
,
url
:
$
(
this
).
prop
(
'href'
),
url
:
$
(
this
).
prop
(
'href'
),
...
...
circle/dashboard/static/dashboard/dashboard.less
View file @
9c17da03
...
@@ -806,6 +806,10 @@ textarea[name="new_members"] {
...
@@ -806,6 +806,10 @@ textarea[name="new_members"] {
margin-top: -6px;
margin-top: -6px;
}
}
.group-remove-all-btn {
margin-right: 5px;
}
.store-action-button {
.store-action-button {
margin-left: 5px;
margin-left: 5px;
}
}
...
...
circle/dashboard/templates/dashboard/group-detail.html
View file @
9c17da03
...
@@ -82,6 +82,9 @@
...
@@ -82,6 +82,9 @@
{% trans "Create user" %}
{% trans "Create user" %}
</a>
</a>
{% endif %}
{% endif %}
<a
data-group_pk=
"{{ group.pk }}"
href=
"{% url "
dashboard
.
views
.
remove-all-users
"
group_pk=
group.pk
%}"
class=
"btn btn-danger group-remove-all-btn pull-right"
>
{% trans "Remove all users" %}
</a>
</h3>
</h3>
<form
action=
""
method=
"post"
>
{% csrf_token %}
<form
action=
""
method=
"post"
>
{% csrf_token %}
<table
class=
"table table-striped table-with-form-fields table-bordered"
id=
"group-detail-user-table"
>
<table
class=
"table table-striped table-with-form-fields table-bordered"
id=
"group-detail-user-table"
>
...
...
circle/dashboard/urls.py
View file @
9c17da03
...
@@ -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 @
9c17da03
...
@@ -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