diff --git a/auth.py b/auth.py index 23d5a153c026a922e5fd0f49af331f0943408079..d5e7faa4c76c070ba5b447e331686d11c24d13e0 100644 --- a/auth.py +++ b/auth.py @@ -41,7 +41,8 @@ class LdapManager: def groups(self, username): result = [] - for _, result_dict in self.connection.search_s(self.base, ldap.SCOPE_SUBTREE, "(memberUid={})".format(username), ["cn"]): + # use username.lower() since memberUid is case sensitive here + for _, result_dict in self.connection.search_s(self.base, ldap.SCOPE_SUBTREE, "(memberUid={})".format(username.lower()), ["cn"]): result.append(result_dict["cn"][0]) return result diff --git a/legacy.py b/legacy.py index 9127450903ee2b4d59eb8721d44b4a3fa1e6bbc5..2b7c5cabf2e987f6e15c8c9c99811879caa7f812 100644 --- a/legacy.py +++ b/legacy.py @@ -7,11 +7,6 @@ from shared import db import config -def log_fuzzy(text): - #with tempfile.NamedTemporaryFile(delete=False, mode="w") as tmpfile: - # tmpfile.write(text + "\n\n") - print(text) - def lookup_todo_id(old_candidates, new_who, new_description): # Check for perfect matches for candidate in old_candidates: @@ -29,11 +24,11 @@ def lookup_todo_id(old_candidates, new_who, new_description): best_match, best_match_score = process.extractOne( new_description, content_to_number.keys()) if best_match_score >= config.FUZZY_MIN_SCORE: - log_fuzzy("Used fuzzy matching on '{}', got '{}' with score {}.".format( + print("Used fuzzy matching on '{}', got '{}' with score {}.".format( new_description, best_match, best_match_score)) return content_to_number[best_match] else: - log_fuzzy("Best match for '{}' is '{}' with score {}, rejecting.".format( + print("Best match for '{}' is '{}' with score {}, rejecting.".format( new_description, best_match, best_match_score)) return None @@ -122,7 +117,7 @@ def import_old_todos(sql_text): for old_id, protocol_id, who, what, start_time, end_time, done in _split_insert_line(todo_line): protocol_id = int(protocol_id) if protocol_id not in protocol_id_to_key: - #print("Missing protocol with ID {} for Todo {}".format(protocol_id, what)) + print("Missing protocol with ID {} for Todo {}".format(protocol_id, what)) continue todo = OldTodo(old_id=old_id, who=who, description=what, protocol_key=protocol_id_to_key[protocol_id]) diff --git a/models/database.py b/models/database.py index 102a63d6bedba47e5cbfe546fc1b30eb567eb774..ef496f5a0a2cf0022027d43cbe9231dbe029b8bc 100644 --- a/models/database.py +++ b/models/database.py @@ -89,6 +89,9 @@ class ProtocolType(db.Model): or (self.private_group != "" and self.private_group in user.groups)))) def has_private_view_right(self, user): + print(user, self.private_group) + if user is not None: + print(user.groups) return (user is not None and self.private_group != "" and self.private_group in user.groups) def has_modify_right(self, user): diff --git a/tasks.py b/tasks.py index d52a17349554bb4663841bc3bcf51d1665969bb4..64000d77b0d59fd64c302e9173193259940a3da7 100644 --- a/tasks.py +++ b/tasks.py @@ -379,6 +379,7 @@ def compile_async(content, protocol_id, show_private=False, use_decision=False, document.filename = target_filename shutil.copy(os.path.join(compile_dir, protocol_target_filename), os.path.join(config.DOCUMENTS_PATH, target_filename)) db.session.commit() + shutil.copy(os.path.join(compile_dir, log_filename), "/tmp/proto-tex.log") except subprocess.SubprocessError: log = "" total_log_filename = os.path.join(compile_dir, log_filename) diff --git a/templates/protocol-mail.txt b/templates/protocol-mail.txt index c1e4a51ffc13cad582c09770666d9fb0f18bb443..12e2529a0a5e1d27c7506b7c78b7598a968a5f5b 100644 --- a/templates/protocol-mail.txt +++ b/templates/protocol-mail.txt @@ -1,7 +1,9 @@ Protocol der {{protocol.name}} vom {{protocol.date|datify}} Datum: {{protocol.date|datify_long}} +{% if protocol.start_time is not none and protocol.end_time is not none %} Zeit: von {{protocol.start_time|timify}} bis {{protocol.end_time|timify}} +{% endif %} Protokoll: {{protocol.author}} Anwesende: {{protocol.participants}} diff --git a/views/tables.py b/views/tables.py index 95992735391289b5c7f3d5726cce687f1bdb7547..682aa92c0ddebdea163ef99a5023daadaeba0026 100644 --- a/views/tables.py +++ b/views/tables.py @@ -78,9 +78,13 @@ class ProtocolsTable(Table): result.append("Fertig" if protocol.is_done() else "Geplant") elif protocol in self.search_results: result.append(Markup(self.search_results[protocol])) - if user is not None and protocol.protocoltype.has_private_view_right(user): - result.append(Table.link(url_for("show_type", type_id=protocol.protocoltype.id), protocol.protocoltype.short_name)) - result.append(Table.link(url_for("delete_protocol", protocol_id=protocol.id), "Löschen", confirm="Bist du dir sicher, dass du das Protokoll {} löschen möchtest?".format(protocol.get_identifier()))) + print(user, protocol.protocoltype.has_private_view_right(user)) + if check_login(): + if user is not None and protocol.protocoltype.has_private_view_right(user): + result.append(Table.link(url_for("show_type", type_id=protocol.protocoltype.id), protocol.protocoltype.short_name)) + result.append(Table.link(url_for("delete_protocol", protocol_id=protocol.id), "Löschen", confirm="Bist du dir sicher, dass du das Protokoll {} löschen möchtest?".format(protocol.get_identifier()))) + else: + result.extend(["", ""]) return result class ProtocolTypesTable(Table):