Restore doorboy slack endpoint
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
@@ -22,6 +22,7 @@ db = MongoClient(const.MONGO_URI).get_default_database()
|
||||
class User:
|
||||
username: str = None
|
||||
display_name: str = None
|
||||
slack_id: str = None
|
||||
groups: List[str] = field(default_factory=list)
|
||||
|
||||
def __getitem__(self, item):
|
||||
@@ -35,10 +36,11 @@ def get_users():
|
||||
for item in ret["items"]:
|
||||
username = item['metadata']['name']
|
||||
display_name = item.get("spec", {}).get("customProfile", {}).get("name", None)
|
||||
slack_id = item.get("status", {}).get("slackId", None)
|
||||
groups = []
|
||||
for group in item.get("status", {}).get("groups", []):
|
||||
groups.append(f"{group['prefix']}:{group['name']}")
|
||||
yield User(username, display_name, groups)
|
||||
yield User(username, display_name, slack_id, groups)
|
||||
|
||||
users = list(get_users())
|
||||
users_lookup = {u.username : u for u in users}
|
||||
|
Reference in New Issue
Block a user