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
f6a152f0
Commit
f6a152f0
authored
Jul 22, 2018
by
klafyvel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_126' into 'master'
Fix #126 Closes #126 See merge request federez/re2o!188
parents
5dc21ea0
6d8aeb61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
users/models.py
users/models.py
+11
-6
users/views.py
users/views.py
+1
-6
No files found.
users/models.py
View file @
f6a152f0
...
...
@@ -487,16 +487,19 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
interface
.
save
()
def
archive
(
self
):
""" Archive l'user : appelle unassign_ips() puis passe state à
ARCHIVE"""
""" Filling the user; no more active"""
self
.
unassign_ips
()
self
.
state
=
User
.
STATE_ARCHIVE
def
unarchive
(
self
):
""" Désarchive l'user : réassigne ses ip et le passe en state
ACTIVE"""
"""Unfilling the user"""
self
.
assign_ips
()
self
.
state
=
User
.
STATE_ACTIVE
def
state_sync
(
self
):
"""Archive, or unarchive, if the user was not active/or archived before"""
if
self
.
__original_state
!=
self
.
STATE_ACTIVE
and
self
.
state
==
self
.
STATE_ACTIVE
:
self
.
unarchive
()
elif
self
.
__original_state
!=
self
.
STATE_ARCHIVE
and
self
.
state
==
self
.
STATE_ARCHIVE
:
self
.
archive
()
def
ldap_sync
(
self
,
base
=
True
,
access_refresh
=
True
,
mac_refresh
=
True
,
group_refresh
=
False
):
...
...
@@ -884,6 +887,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
'force'
:
self
.
can_change_force
,
'selfpasswd'
:
self
.
check_selfpasswd
,
}
self
.
__original_state
=
self
.
state
def
__str__
(
self
):
return
self
.
pseudo
...
...
@@ -1012,6 +1016,7 @@ def user_post_save(**kwargs):
user
=
kwargs
[
'instance'
]
if
is_created
:
user
.
notif_inscription
()
user
.
state_sync
()
user
.
ldap_sync
(
base
=
True
,
access_refresh
=
True
,
...
...
users/views.py
View file @
f6a152f0
...
...
@@ -221,15 +221,10 @@ def edit_info(request, user, userid):
@
login_required
@
can_edit
(
User
,
'state'
)
def
state
(
request
,
user
,
userid
):
""" Changer l'etat actif/desactivé/archivé d'un user,
need droit bureau """
""" Change the state (active/unactive/archived) of a user"""
state_form
=
StateForm
(
request
.
POST
or
None
,
instance
=
user
)
if
state_form
.
is_valid
():
if
state_form
.
changed_data
:
if
state_form
.
cleaned_data
[
'state'
]
==
User
.
STATE_ARCHIVE
:
user
.
archive
()
elif
state_form
.
cleaned_data
[
'state'
]
==
User
.
STATE_ACTIVE
:
user
.
unarchive
()
state_form
.
save
()
messages
.
success
(
request
,
"Etat changé avec succès"
)
return
redirect
(
reverse
(
...
...
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