mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
add ldap, check if active member, create user and give console perms, retry getting mac, better handling of rtp
This commit is contained in:
parent
8161d97f21
commit
cc2033f2ca
11 changed files with 136 additions and 58 deletions
24
ldapdb.py
Normal file
24
ldapdb.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from csh_ldap import CSHLDAP
|
||||
from flask import current_app as app
|
||||
|
||||
|
||||
def connect_ldap():
|
||||
try:
|
||||
ldap = CSHLDAP(app.config['LDAP_BIND_DN'],
|
||||
app.config['LDAP_BIND_PW'])
|
||||
except:
|
||||
print("Unable to connect to LDAP.")
|
||||
raise
|
||||
return ldap
|
||||
|
||||
|
||||
def is_rtp(user):
|
||||
ldap = connect_ldap()
|
||||
rtp_group = ldap.get_group('rtp')
|
||||
return rtp_group.check_member(ldap.get_member(user, uid=True))
|
||||
|
||||
|
||||
def is_active(ldap, user):
|
||||
ldap = connect_ldap()
|
||||
rtp_group = ldap.get_group('active')
|
||||
return rtp_group.check_member(ldap.get_member(user, uid=True))
|
||||
Loading…
Add table
Add a link
Reference in a new issue