FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Directory Synchronisation Tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Information Services
DevOps
Google WorkSpace (aka G-Suite)
Directory Synchronisation Tool
Commits
11556a36
Commit
11556a36
authored
1 year ago
by
Robin Goodall
Browse files
Options
Downloads
Patches
Plain Diff
Enable deletion of all 2y cancelled accounts
parent
6b290bf2
No related branches found
No related tags found
1 merge request
!42
Enable deletion of all 2y cancelled accounts
Pipeline
#419793
passed with warnings
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+6
-0
6 additions, 0 deletions
CHANGELOG.md
gsuitesync/sync/compare.py
+25
-27
25 additions, 27 deletions
gsuitesync/sync/compare.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
32 additions
and
28 deletions
CHANGELOG.md
+
6
−
0
View file @
11556a36
...
...
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
https://keepachangelog.com/en/1.0.0/
)
,
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
## [1.0.2] - 2023-01-01
### Changed
-
Delete all accounts cancelled for 2 years ago
## [1.0.1] - 2023-08-29
### Fixed
...
...
This diff is collapsed.
Click to expand it.
gsuitesync/sync/compare.py
+
25
−
27
View file @
11556a36
...
...
@@ -104,6 +104,7 @@ class Comparator(ConfigurationStateConsumer):
uids_to_suspend
=
(
self
.
state
.
all_google_uids
-
self
.
state
.
suspended_google_uids
)
-
self
.
state
.
eligible_uids
LOG
.
info
(
"
Number of users to suspend: %s
"
,
len
(
uids_to_suspend
))
# Users that need their MyDrive scanned for shared files, are those suspended users who
# haven't logged in to Google for 6 months, have a Lookup cancelledDate over 6 months,
...
...
@@ -115,6 +116,7 @@ class Comparator(ConfigurationStateConsumer):
&
self
.
state
.
cancelled_six_months_ago_uids
&
self
.
state
.
no_mydrive_shared_settings_uids
)
-
uids_to_reactivate
LOG
.
info
(
"
Number of users that need MyDrive scanned: %s
"
,
len
(
uids_to_scan_mydrive
))
# Form a set of all uids who have never logged in and should be deleted. This is all the
# already suspended Google uids (except those to be reactivated) plus the uids to be
...
...
@@ -126,6 +128,10 @@ class Comparator(ConfigurationStateConsumer):
uids_to_delete_who_never_logged_in
=
(
self
.
state
.
suspended_google_uids
-
uids_to_reactivate
)
&
self
.
state
.
never_logged_in_google_uids
LOG
.
info
(
f
"
Number of users to delete (never logged in):
"
f
"
{
len
(
uids_to_delete_who_never_logged_in
)
}
"
)
# Form a set of all uids who have already been suspended, have a mydrive scan result
# `permissions-none` and have been suspended in lookup for more than 24 months:
...
...
@@ -136,23 +142,24 @@ class Comparator(ConfigurationStateConsumer):
&
self
.
state
.
permission_none_mydrive_shared_result_uids
&
self
.
state
.
cancelled_twenty_four_months_ago_uids
)
-
uids_to_scan_mydrive
LOG
.
info
(
f
"
Number of users to delete (my-shared-result
{
MYDRIVE_SHARED_RESULT_NONE
}
):
"
f
"
{
len
(
uids_to_delete_with_mydrive_shared_result_permission_none
)
}
"
)
# Form a set of all uids who have already been suspended, have a mydrive scan result
# `permissions-removed` and have been suspended in lookup for more than 24 months:
uids_to_delete_with_mydrive_shared_result_permission_removed
=
set
()
if
self
.
delete_users
:
LOG
.
warning
(
f
"
Excluding uids with mydrive-shared-result
{
MYDRIVE_SHARED_RESULT_REMOVED
}
.
"
)
#
# WARNING: There is a 6 months lead time ahead of this change, do
# do NOT enable the below code before September 2023.
#
# uids_to_delete_with_mydrive_shared_result_permission_removed = (
# (self.state.suspended_google_uids - uids_to_reactivate)
# & self.state.permission_removed_mydrive_shared_result_uids
# & self.state.cancelled_twenty_four_months_ago_uids
# ) - uids_to_scan_mydrive
uids_to_delete_with_mydrive_shared_result_permission_removed
=
(
(
self
.
state
.
suspended_google_uids
-
uids_to_reactivate
)
&
self
.
state
.
permission_removed_mydrive_shared_result_uids
&
self
.
state
.
cancelled_twenty_four_months_ago_uids
)
-
uids_to_scan_mydrive
LOG
.
info
(
f
"
Number of users to delete (my-shared-result
{
MYDRIVE_SHARED_RESULT_REMOVED
}
):
"
f
"
{
len
(
uids_to_delete_with_mydrive_shared_result_permission_removed
)
}
"
)
# Form a super set of uids to delete
uids_to_delete
=
(
...
...
@@ -160,18 +167,7 @@ class Comparator(ConfigurationStateConsumer):
|
uids_to_delete_with_mydrive_shared_result_permission_none
|
uids_to_delete_with_mydrive_shared_result_permission_removed
)
LOG
.
info
(
"
Number of users to suspend: %s
"
,
len
(
uids_to_suspend
))
LOG
.
info
(
f
"
Number of users to delete with my-shared-result
{
MYDRIVE_SHARED_RESULT_NONE
}
:
"
f
"
{
len
(
uids_to_delete_with_mydrive_shared_result_permission_none
)
}
"
)
LOG
.
info
(
f
"
Number of users to delete with my-shared-result
{
MYDRIVE_SHARED_RESULT_REMOVED
}
:
"
f
"
{
len
(
uids_to_delete_with_mydrive_shared_result_permission_removed
)
}
"
)
LOG
.
info
(
"
Number of users to delete: %s
"
,
len
(
uids_to_delete
))
LOG
.
info
(
"
Number of users that need MyDrive scanned: %s
"
,
len
(
uids_to_scan_mydrive
))
LOG
.
info
(
"
Total number of users to delete: %s
"
,
len
(
uids_to_delete
))
self
.
state
.
update
(
{
...
...
@@ -212,9 +208,11 @@ class Comparator(ConfigurationStateConsumer):
# suspended/deleted in google) so remove google licence
# Those licensed in Google but not in Lookup need removing but ignore those eligible
# but not managed
licences_to_remove
=
(
self
.
state
.
google_licensed_uids
-
self
.
state
.
licensed_uids
)
-
(
self
.
state
.
eligible_uids
-
self
.
state
.
managed_user_uids
# but not managed. Also don't try to remove licenses from people that are being deleted
licences_to_remove
=
(
(
self
.
state
.
google_licensed_uids
-
self
.
state
.
licensed_uids
)
-
(
self
.
state
.
eligible_uids
-
self
.
state
.
managed_user_uids
)
-
self
.
state
.
uids_to_delete
)
LOG
.
info
(
"
Number of licence assignments to remove: %s
"
,
len
(
licences_to_remove
))
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
11556a36
...
...
@@ -16,7 +16,7 @@ def load_requirements():
setup
(
name
=
"
gsuitesync
"
,
version
=
"
1.0.
1
"
,
version
=
"
1.0.
2
"
,
packages
=
find_packages
(),
install_requires
=
load_requirements
(),
entry_points
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment