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
F
fountain
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
urz-django
fountain
Commits
d9793d72
Commit
d9793d72
authored
May 10, 2016
by
Daniel Klaffenbach
🐍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
management.commands: Use new base class for command
Fixes
#1
parent
7df385d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
fountain/management/commands/ldap_sync.py
fountain/management/commands/ldap_sync.py
+6
-4
No files found.
fountain/management/commands/ldap_sync.py
View file @
d9793d72
from
django.core.management.base
import
NoArgsCommand
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.core.management.base
import
BaseCommand
from
fountain.ldap
import
Ldap
from
django.contrib.auth
import
get_user_model
class
Command
(
NoArgs
Command
):
class
Command
(
Base
Command
):
help
=
"Updates the attributes from all current Django users from a LDAP server."
def
handle
_noargs
(
self
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
verbosity
=
options
.
get
(
'verbosity'
)
User
=
get_user_model
()
l
=
Ldap
()
values
=
list
(
l
.
LDAP_SYNC_USER_ATTRIBUTES
.
values
())
values
.
append
(
User
.
USERNAME_FIELD
)
for
user_dict
in
User
.
objects
.
all
().
values
(
*
values
).
iterator
():
...
...
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