[sysadmin-bin] Block users with website on SURBL instead of banning
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Block users with website on SURBL instead of banning
- Date: Tue, 18 Aug 2020 06:46:41 +0000 (UTC)
commit 0c3c9e4c41504ca8230d48086f62f6945a89c519
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Tue Aug 18 07:59:42 2020 +0200
Block users with website on SURBL instead of banning
gitlab/inactive-gitlab-users.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/gitlab/inactive-gitlab-users.py b/gitlab/inactive-gitlab-users.py
index a88d31a..cd723ee 100755
--- a/gitlab/inactive-gitlab-users.py
+++ b/gitlab/inactive-gitlab-users.py
@@ -166,6 +166,15 @@ def delete_user(gl, user_id):
pass
+def block_user(gl, user_id):
+ try:
+ user = gl.users.get(user_id)
+ user.block()
+ print(user_id)
+ except gitlab.exceptions.GitlabBlockError:
+ pass
+
+
def trust_all_groups(gl):
groups = gl.groups.list(all=True, visibility="public")
parent_groups = [grp for grp in groups if not grp.attributes["parent_id"]]
@@ -252,6 +261,10 @@ if __name__ == "__main__":
users = json.load(f)
for user in users:
+ if user["reason"] == "spam":
+ block_user(gl, user["id"])
+ continue
+
delete_user(gl, user["id"])
elif args.command == "trust-groups":
trust_all_groups(gl)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]