SAML Group Sync remove old memberships
What does this MR do?
Part of #267020 (closed)
Builds on the existing GroupSamlGroupSyncWorker
and associated Groups::SyncService
to not only add members to groups, but to remove old membership if the user should no longer be a member. This part was a little more complex because there are many things to consider whether we should remove a member.
There is no Changelog since this feature is behind a default disabled feature flag. Changelog and docs will be in !46700 (merged)
Logging/Stats
- When debug logging is enabled, an entry will be logged to
application.log
each time the membership is added, updated or removed. - When sync is complete, a payload with the number of added, updated and removed entries is returned to the worker. The worker logs this as extra metadata to
sidekiq.log
.
Sidekiq extra metadata logging
{"severity":"INFO","time":"2020-11-10T15:55:57.557Z","class":"GroupSamlGroupSyncWorker","args":["1","52","[FILTERED]"],...,"extra.group_saml_group_sync_worker.stats":{"added":1,"updated":0,"removed":0}}
Application.log debug logging
{:message=>"Groups::SyncService User: jane (25), Action: added, Group: 2, Prior Access: , New Access: 30"}
{:message=>"Groups::SyncService User: jane (25), Action: updated, Group: 2, Prior Access: 20, New Access: 30"}
{:message=>"Groups::SyncService User: jane (25), Action: removed, Group: 2, Prior Access: 20, New Access: "}
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Drew Blessing