Enabling ldap lookup
This commit is contained in:
parent
727274ae33
commit
1231b963d0
|
@ -5,9 +5,11 @@ from marshmallow import INCLUDE
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
|
||||||
from crc import db, ma
|
from crc import db, ma
|
||||||
|
from crc.api.common import ApiError
|
||||||
from crc.models.file import FileModel
|
from crc.models.file import FileModel
|
||||||
from crc.models.study import StudyModel
|
from crc.models.study import StudyModel
|
||||||
from crc.models.workflow import WorkflowModel
|
from crc.models.workflow import WorkflowModel
|
||||||
|
from crc.services.ldap_service import LdapService
|
||||||
|
|
||||||
|
|
||||||
class ApprovalStatus(enum.Enum):
|
class ApprovalStatus(enum.Enum):
|
||||||
|
@ -68,11 +70,18 @@ class Approval(object):
|
||||||
instance.title = model.study.title
|
instance.title = model.study.title
|
||||||
|
|
||||||
# TODO: Use ldap lookup
|
# TODO: Use ldap lookup
|
||||||
instance.approver = {}
|
ldap_service = LdapService()
|
||||||
instance.approver['uid'] = 'bgb22'
|
try:
|
||||||
instance.approver['display_name'] = 'Billy Bob (bgb22)'
|
user_info = ldap_service.user_info(model.approver_uid)
|
||||||
instance.approver['title'] = 'E42:He\'s a hoopy frood'
|
except ApiError:
|
||||||
instance.approver['department'] = 'E0:EN-Eng Study of Parallel Universes'
|
user_info = None
|
||||||
|
|
||||||
|
if user_info:
|
||||||
|
instance.approver = {}
|
||||||
|
instance.approver['uid'] = model.approver_uid
|
||||||
|
instance.approver['display_name'] = user_info.display_name
|
||||||
|
instance.approver['title'] = user_info.title
|
||||||
|
instance.approver['department'] = user_info.department
|
||||||
|
|
||||||
instance.associated_files = []
|
instance.associated_files = []
|
||||||
for approval_file in model.approval_files:
|
for approval_file in model.approval_files:
|
||||||
|
|
Loading…
Reference in New Issue