add contributor access page, based on public data
It would be nice to have a dashboard about which contributors have which access, and have accounts on which services. I've been hacking scripts to do this locally, if there was a page setup in monitor, I could start adding them. I'm thinking it should be its own tab in monitor.
For example, below is a script to get GitLab member info. It requires a GitLab token since the GitLab API requires a token to access any of it. I propose using a token from @fdroid-anyone, which has no specific access besides the wiki. There could be a new gitlab account created also, like fdroid-monitor.
import gitlab
import json
import os
import requests
import yaml
from collections import OrderedDict
from colorama import Fore, Style
private_token = os.getenv('PERSONAL_ACCESS_TOKEN')
if not private_token:
print(
Fore.RED
+ 'ERROR: GitLab Token not found in PERSONAL_ACCESS_TOKEN!'
+ Style.RESET_ALL
)
exit(1)
gl = gitlab.Gitlab('https://gitlab.com', api_version=4, private_token=private_token)
group = gl.groups.get('fdroid', lazy=True)
cancel = 0
users = dict()
project_names = set()
projects_with_members = set()
member_usernames = set()
print('\nProcessing gitlab.com project users:', end=' ')
for project in group.projects.list(all=True):
print('.', end='', flush=True)
if project.path == 'wiki' or not project.path_with_namespace.startswith('fdroid'):
continue # everyone gets access to the wiki
path = project.path
project_names.add(path)
project = gl.projects.get(project.get_id(), lazy=True)
for member in project.members.list(all=True):
print('.', end='', flush=True)
member_usernames.add(member.username)
if member.username not in users:
users[member.username] = dict(member.attributes)
else:
for k, v in member.attributes.items():
users[member.username][k] = v
if 'projects' not in users[member.username]:
users[member.username]['projects'] = dict()
users[member.username]['projects'][path] = member.attributes.get(
'access_level', ''
)
projects_with_members.add(path)