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
intranet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nounous-archives
intranet
Commits
9a8fb3c4
Commit
9a8fb3c4
authored
May 16, 2013
by
Vincent Le gallic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lc_ldap.shortcuts
parent
93164291
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
23 deletions
+14
-23
apps/impressions/printLib.py
apps/impressions/printLib.py
+4
-4
apps/voip/management/commands/genasterisk.py
apps/voip/management/commands/genasterisk.py
+0
-3
apps/voip/management/commands/genasteriskalias.py
apps/voip/management/commands/genasteriskalias.py
+0
-3
apps/voip/management/commands/genasteriskvoicemail.py
apps/voip/management/commands/genasteriskvoicemail.py
+0
-3
cas_login.py
cas_login.py
+3
-3
conn_pool.py
conn_pool.py
+3
-3
login.py
login.py
+4
-4
No files found.
apps/impressions/printLib.py
View file @
9a8fb3c4
...
...
@@ -7,8 +7,8 @@ import datetime
import
time
import
re
import
sys
sys
.
path
.
append
(
'/usr/scripts/
lc_ldap/
'
)
import
lc_ldap
sys
.
path
.
append
(
'/usr/scripts/'
)
import
lc_ldap
.shortcuts
import
lc_ldap.crans_utils
if
settings
.
LOCATION
==
"o2"
:
...
...
@@ -24,9 +24,9 @@ else:
ccups
=
None
if
settings
.
BASE_LDAP_TEST
:
cldap
=
lc_ldap
.
lc_ldap_test
()
cldap
=
lc_ldap
.
shortcuts
.
lc_ldap_test
()
else
:
cldap
=
lc_ldap
.
lc_ldap_admin
()
cldap
=
lc_ldap
.
shortcuts
.
lc_ldap_admin
()
class
Job
(
object
):
...
...
apps/voip/management/commands/genasterisk.py
View file @
9a8fb3c4
...
...
@@ -2,8 +2,6 @@
# -*- encoding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'/usr/scripts/lc_ldap/'
)
import
lc_ldap
from
django.core.management.base
import
BaseCommand
,
CommandError
from
intranet.apps.voip.models
import
Profile
...
...
@@ -13,6 +11,5 @@ class Command(BaseCommand):
help
=
'Génère une conf pour asterisk'
def
handle
(
self
,
*
args
,
**
options
):
conn
=
lc_ldap
.
lc_ldap
()
for
profile
in
Profile
.
objects
.
order_by
(
'user__username'
).
all
():
self
.
stdout
.
write
(
profile
.
asterisk_config
().
encode
(
'utf-8'
)
+
'
\n
'
)
apps/voip/management/commands/genasteriskalias.py
View file @
9a8fb3c4
...
...
@@ -2,8 +2,6 @@
# -*- encoding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'/usr/scripts/lc_ldap/'
)
import
lc_ldap
from
django.core.management.base
import
BaseCommand
,
CommandError
from
intranet.apps.voip.models
import
Profile
...
...
@@ -13,6 +11,5 @@ class Command(BaseCommand):
help
=
'Génère une conf pour la boîte vocal d
\'
asterisk'
def
handle
(
self
,
*
args
,
**
options
):
conn
=
lc_ldap
.
lc_ldap
()
for
profile
in
Profile
.
objects
.
order_by
(
'user__username'
).
all
():
self
.
stdout
.
write
(
profile
.
asterisk_alias_config
().
encode
(
'utf-8'
)
+
'
\n
'
)
apps/voip/management/commands/genasteriskvoicemail.py
View file @
9a8fb3c4
...
...
@@ -2,8 +2,6 @@
# -*- encoding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'/usr/scripts/lc_ldap/'
)
import
lc_ldap
from
django.core.management.base
import
BaseCommand
,
CommandError
from
intranet.apps.voip.models
import
Profile
...
...
@@ -13,6 +11,5 @@ class Command(BaseCommand):
help
=
'Génère une conf pour la boîte vocal d
\'
asterisk'
def
handle
(
self
,
*
args
,
**
options
):
conn
=
lc_ldap
.
lc_ldap
()
for
profile
in
Profile
.
objects
.
order_by
(
'user__username'
).
all
():
self
.
stdout
.
write
(
profile
.
asterisk_voicemail_config
().
encode
(
'utf-8'
)
+
'
\n
'
)
cas_login.py
View file @
9a8fb3c4
...
...
@@ -28,8 +28,8 @@ from django_cas.backends import CASBackend
# Pour se connecter à la base ldap
import
sys
sys
.
path
.
append
(
"/usr/scripts/
lc_ldap
"
)
import
lc_ldap
sys
.
path
.
append
(
"/usr/scripts/"
)
import
lc_ldap
.shortcuts
conn_pool
=
import_module
(
'conn_pool'
,
'intranet'
)
...
...
@@ -54,7 +54,7 @@ class CransCASBackend(CASBackend):
django_username
=
user
.
username
try
:
conn
=
lc_ldap
.
lc_ldap_admin
(
)
conn
=
lc_ldap
.
shortcuts
.
lc_ldap_admin
(
user
=
django_username
)
ldap_user
=
conn
.
search
(
'uid=%s'
%
django_username
,
\
scope
=
ldap
.
SCOPE_ONELEVEL
)[
0
]
except
IndexError
:
...
...
conn_pool.py
View file @
9a8fb3c4
...
...
@@ -21,8 +21,8 @@
#
import
time
import
sys
sys
.
path
.
append
(
"/usr/scripts/
lc_ldap/
"
)
import
lc_ldap
sys
.
path
.
append
(
"/usr/scripts/"
)
import
lc_ldap
.shortcuts
CONNS
=
{}
OBJECTS
=
{}
...
...
@@ -33,7 +33,7 @@ LDAP_USER_TIMEOUT = 600
def
get_conn
(
user
):
if
not
user
.
username
in
CONNS
.
keys
():
CONNS
[
user
.
username
]
=
lc_ldap
.
lc_ldap_admin
(
)
CONNS
[
user
.
username
]
=
lc_ldap
.
shortcuts
.
lc_ldap_admin
(
user
=
user
.
username
)
return
CONNS
[
user
.
username
]
def
get_user
(
user
,
mode
=
'ro'
,
refresh
=
False
):
...
...
login.py
View file @
9a8fb3c4
...
...
@@ -28,8 +28,8 @@ from django.utils.importlib import import_module
# Pour se connecter à la base ldap
import
sys
sys
.
path
.
append
(
"/usr/scripts/
lc_ldap
"
)
import
lc_ldap
sys
.
path
.
append
(
"/usr/scripts/"
)
import
lc_ldap
.shortcuts
conn_pool
=
import_module
(
'conn_pool'
,
'intranet'
)
...
...
@@ -44,9 +44,9 @@ class LDAPUserBackend(ModelBackend):
if
not
username
or
not
password
:
return
None
lc_class
=
lc_ldap
.
lc_ldap_test
if
settings
.
BASE_LDAP_TEST
else
lc_ldap
.
lc_ldap
shortcut
=
lc_ldap
.
shortcuts
.
lc_ldap_test
if
settings
.
BASE_LDAP_TEST
else
lc_ldap
.
shortcuts
.
lc_ldap
try
:
conn
=
lc_class
(
user
=
username
,
cred
=
password
)
conn
=
shortcut
(
user
=
username
,
cred
=
password
)
myself
=
conn
.
search
(
dn
=
conn
.
dn
,
scope
=
ldap
.
SCOPE_BASE
)
ldap_user
=
myself
[
0
]
except
IndexError
:
...
...
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