Commit 0347c676 authored by Sven Lukrafka's avatar Sven Lukrafka

Move patch of delete Private Data request

parent 6644c436
......@@ -3,9 +3,11 @@ import base64
import tasks.settings as settings
from general.class_provider import get_class, get_function
import json
import ldap
class granted:
def execute(self, user_ldap_entry, user_dn):
if not getattr(settings, 'CRUST_TASK_URL_1') == '':
json_body = provide_request_body(user_ldap_entry)
response =, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
......@@ -22,7 +24,6 @@ class granted:
if response.status_code is not 200:
return response.status_code
return response.status_code
class denied:
......@@ -39,6 +40,14 @@ def provide_request_body(ldap_entry):
return json.dumps(json_body)
def delete_private_data(dn):
delete_class = get_class('DeleteRequest', 'ldap_app.processors.dispatcher.Request')(dn)
private_attributes = getattr(settings, 'TASK_PRIVATE_ATTRIBUTES', ['mail'])
mod_list = build_modlist_for_patch(private_attributes)
patch_class = get_class('PatchRequest', 'ldap_app.processors.dispatcher.Request')(None, dn)
patch_class.mod_attr_list = mod_list
def build_modlist_for_patch(attributes):
mod_list = list()
for attribute in attributes:
mod_list.append((ldap.MOD_DELETE, attribute, None))
return mod_list
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