Commit 6ff2c48c authored by Sven Lukrafka's avatar Sven Lukrafka

Bigfix

parent e6db3d7c
TASK_BASE_DN = 'ou=tasks,ou=lui2backend,dc=pdp,dc=didmos,dc=de'
CRUST_TASK_URL_1 = 'http://localhost:8000/pdp/info' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_1 = 'http://localhost:8000/pdp/roles/aRole' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_2 = 'http://localhost:8000/pdp/info' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_2 = '' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_3 = '' # Deactivating URL by emtpy string ''
......
......@@ -9,7 +9,7 @@ class granted:
if not getattr(settings, 'CRUST_TASK_URL_1') == '':
json_body = provide_request_body(user_ldap_entry)
#headers = {'X-TENANT-ID': 'lui2backend', 'Authorization': 'Basic ' + base64.b64encode('crust:Unity-Grease-Cow-Sensitive-Despair-5'.encode()).decode()}
response = requests.post(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
response = requests.delete(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
if response.status_code is not 200:
return response.status_code
if not getattr(settings, 'CRUST_TASK_URL_2') == '':
......@@ -34,10 +34,9 @@ class denied:
def provide_request_body(ldap_entry):
json_body = dict()
LDAPEntryHelper = get_class('LDAPEntryHelper', 'ldap_app.processors.ldap_helper.ldap_helper')()
required_attributes = ['didmosLoginName', 'mail', 'uid']
for attribute in required_attributes:
if LDAPEntryHelper.has_key(ldap_entry, attribute):
json_body[attribute] = LDAPEntryHelper.get_value([(x, ldap_entry[x]) for x in ldap_entry], attribute)
if attribute in ldap_entry:
json_body[attribute] = ldap_entry[attribute]
return json.dumps(json_body)
......@@ -9,7 +9,7 @@ class granted:
if not getattr(settings, 'CRUST_TASK_URL_1') == '':
json_body = provide_request_body(user_ldap_entry)
#headers = {'X-TENANT-ID': 'lui2backend', 'Authorization': 'Basic ' + base64.b64encode('crust:Unity-Grease-Cow-Sensitive-Despair-5'.encode()).decode()}
response = requests.post(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
response = requests.delete(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
if response.status_code is not 200:
return response.status_code
if not getattr(settings, 'CRUST_TASK_URL_2') == '':
......@@ -34,10 +34,9 @@ class denied:
def provide_request_body(ldap_entry):
json_body = dict()
LDAPEntryHelper = get_class('LDAPEntryHelper', 'ldap_app.processors.ldap_helper.ldap_helper')()
required_attributes = ['didmosLoginName', 'mail', 'uid']
for attribute in required_attributes:
if LDAPEntryHelper.has_key(ldap_entry, attribute):
json_body[attribute] = LDAPEntryHelper.get_value([(x, ldap_entry[x]) for x in ldap_entry], attribute)
if attribute in ldap_entry:
json_body[attribute] = ldap_entry[attribute]
return json.dumps(json_body)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment