Skip to content

Commit ecb611e

Browse files
committed
Add helpers to ldap sync
1 parent 56a0f02 commit ecb611e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

arthur/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LDAPGroupMapping(TypedDict):
1313
# This is a mapping of LDAP groups to Discord role IDs and GitHub team IDs. It is used to determine
1414
# which users should be eligible for LDAP enrollment.
1515
LDAP_ROLE_MAPPING: dict[str, LDAPGroupMapping] = {
16-
# "helpers": {"discord_role_id": 267630620367257601, "github_team_slug": "helpers"}, # noqa: ERA001
16+
"helpers": {"discord_role_id": 267630620367257601, "github_team_slug": "helpers"},
1717
"devops": {"discord_role_id": 409416496733880320, "github_team_slug": "devops"},
1818
"administrators": {"discord_role_id": 267628507062992896, "github_team_slug": "admins"},
1919
"moderators": {"discord_role_id": 267629731250176001, "github_team_slug": "moderators"},
@@ -24,4 +24,4 @@ class LDAPGroupMapping(TypedDict):
2424

2525
# Users are only checked for enrollment if they have this role. This doesn't grant them any
2626
# permissions, it is for performance to avoid iterating roles for every other user in the guild.
27-
HELPER_ROLE_ID = 267630620367257601 # LDAP_ROLE_MAPPING["helpers"]["discord_role_id"]
27+
HELPER_ROLE_ID = LDAP_ROLE_MAPPING["helpers"]["discord_role_id"]

arthur/exts/github/management.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from arthur.apis.github import GitHubError, add_member_to_team, remove_org_member
88
from arthur.config import CONFIG
9+
from arthur.constants import LDAP_ROLE_MAPPING
910

1011
if TYPE_CHECKING:
1112
from arthur.bot import KingArthurTheTerrible
@@ -35,7 +36,7 @@ async def github(self, ctx: Context) -> None:
3536
async def add_team_member(self, ctx: Context, username: str) -> None:
3637
"""Add a user to the default GitHub team."""
3738
try:
38-
await add_member_to_team(username, "helpers")
39+
await add_member_to_team(username, LDAP_ROLE_MAPPING["helpers"]["github_team_slug"])
3940
await ctx.send(f":white_check_mark: Successfully invited {username} to the staff team.")
4041
except GitHubError as e:
4142
await ctx.send(f":x: Failed to add {username} to the staff team: {e}")

0 commit comments

Comments
 (0)