Skip to content

Append actor note to AD info field on user disable/enable#479

Open
claire-peters wants to merge 2 commits into
masterfrom
feature/ad-info-note-on-disable
Open

Append actor note to AD info field on user disable/enable#479
claire-peters wants to merge 2 commits into
masterfrom
feature/ad-info-note-on-disable

Conversation

@claire-peters

Copy link
Copy Markdown
Collaborator

Summary

  • Add _append_info_note() to LDAPConn in ldap/utils.py — reads the current AD info field, appends \nYYYY-MM-DD <role> <username> disabled/enabled via CF, and writes back; skips and logs a warning if the result would exceed 1024 characters
  • Update deactivate_user() and reactivate_user() on LDAPConn to accept optional actor_username/actor_role and call _append_info_note after a successful operation
  • Update remove_member_from_group() on LDAPConn to forward actor params to deactivate_user
  • Thread actor info through project_preremove_projectuser and project_reactivate_projectuser signal sends in project/views.py and their receivers in ldap/signals.py
  • Add _actor_role_label() helper in project/views.py to map full role names to short labels (PI, GM, AM, SM) for the note

Test plan

  • Remove a user from their primary group as a PI and confirm the AD info field gains a line like 2026-06-17 PI mmcfee disabled via CF
  • Reactivate that user as a GM and confirm info gains 2026-06-17 GM msyed enabled via CF
  • Pad a test user's info field to near 1024 chars and confirm disable is still applied but the note write is skipped with a warning log entry
  • Remove a non-primary-group user and confirm info is unchanged (no note appended for plain group removal)
  • Confirm existing info content is preserved (append, not replace)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant