fabric8-services / fabric8-auth

Identity and Access Management for fabric8 services
https://auth.openshift.io/api/status
Apache License 2.0
14 stars 26 forks source link

Added deactivation_scheduled to identity #829

Closed sbryzak closed 5 years ago

sbryzak commented 5 years ago

Fixes #828

This PR adds a deactivation_scheduled timestamp column to the identity table. This timestamp is updated by the notification worker when a user is notified for deactivation. When a user logs in and the TouchLastActive() function is called on that user, the deactivation_scheduled timestamp is cleared.

When the deactivation worker iterates through the identities returned by UserService.ListIdentitiesToDeactivate() it calls the BumpDeactivationSchedule() function to update the deactivation_scheduled column for each identity, increasing it by a configured amount to prevent rapid churning of failed deactivation attempts. The ListIdentitiesToDeactivate() function adds a condition (and sort) criteria for deactivation_scheduled, meaning that it will only return identities for which the scheduled deactivation time has been reached.

alien-ike commented 5 years ago

Ike Plugins (test-keeper)

Thank you @sbryzak for this contribution!

It seems that this PR already contains some added or changed tests. Good job!

Your plugin configuration is stored in the file.

sbryzak commented 5 years ago

Still need to add some tests for this.

codecov[bot] commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@6425258). Click here to learn what that means. The diff coverage is 36.36%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #829   +/-   ##
=========================================
  Coverage          ?   78.24%           
=========================================
  Files             ?       98           
  Lines             ?     9205           
  Branches          ?        0           
=========================================
  Hits              ?     7202           
  Misses            ?     1470           
  Partials          ?      533
Impacted Files Coverage Δ
...ication/account/worker/user_deactivation_worker.go 46.34% <0%> (ø)
migration/migration.go 67.05% <100%> (ø)
configuration/configuration.go 82.42% <33.33%> (ø)
authentication/account/service/user.go 75% <33.33%> (ø)
authentication/account/repository/identity.go 76.49% <53.84%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6425258...d917002. Read the comment docs.

sbryzak commented 5 years ago

Tests added for BumpDeactivationSchedule(), plus ListIdentitiesToActivate() filtering and sorting.