Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
6f3fc983
Commit
6f3fc983
authored
May 03, 2018
by
Hugo LEVY-FALK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppression de superuser
parent
d2946a94
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
users/templates/users/aff_listright.html
users/templates/users/aff_listright.html
+1
-1
users/urls.py
users/urls.py
+3
-0
users/views.py
users/views.py
+10
-0
No files found.
users/templates/users/aff_listright.html
View file @
6f3fc983
...
...
@@ -58,7 +58,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for user in superuser_right %}
<li
class=
"list-group-item col-xs-12 col-sm-6 col-md-4"
style=
"border:none;"
>
{{user}}
<a
role=
"button"
href=
""
title=
"{{ desc|default:"
Supprimer
"
}}"
>
<a
role=
"button"
href=
"
{% url 'users:del-superuser' user.pk %}
"
title=
"{{ desc|default:"
Supprimer
"
}}"
>
<i
class=
"fa fa-times"
style=
"color:red"
></i>
</a>
</li>
...
...
users/urls.py
View file @
6f3fc983
...
...
@@ -43,6 +43,9 @@ urlpatterns = [
url
(
r
'^del_group/(?P<userid>[0-9]+)/(?P<listrightid>[0-9]+)$'
,
views
.
del_group
,
name
=
'del-group'
),
url
(
r
'^del_superuser/(?P<userid>[0-9]+)$'
,
views
.
del_superuser
,
name
=
'del-superuser'
),
url
(
r
'^new_serviceuser/$'
,
views
.
new_serviceuser
,
name
=
'new-serviceuser'
),
url
(
r
'^edit_serviceuser/(?P<serviceuserid>[0-9]+)$'
,
views
.
edit_serviceuser
,
...
...
users/views.py
View file @
6f3fc983
...
...
@@ -294,6 +294,16 @@ def del_group(request, user, listrightid, **_kwargs):
return
HttpResponseRedirect
(
request
.
META
.
get
(
'HTTP_REFERER'
))
@
login_required
@
can_edit
(
User
,
'groups'
)
def
del_superuser
(
request
,
user
,
**
_kwargs
):
"""Remove the superuser right of an user."""
user
.
is_superuser
=
False
user
.
save
()
messages
.
success
(
request
,
"%s n'est plus superuser"
%
user
)
return
HttpResponseRedirect
(
request
.
META
.
get
(
'HTTP_REFERER'
))
@
login_required
@
can_create
(
ServiceUser
)
def
new_serviceuser
(
request
):
...
...
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