forked from k-space/doorboy-proxy
add warnings for slack members channel open
This commit is contained in:
@@ -82,13 +82,14 @@ def slack_authz(user_id: str, channel_id: str, door: str) -> Tuple[bool, str]:
|
|||||||
case "workshopdoor":
|
case "workshopdoor":
|
||||||
authGroup = "k-space:workshop"
|
authGroup = "k-space:workshop"
|
||||||
case _:
|
case _:
|
||||||
|
print(f"WARN: unknown slack door {door}")
|
||||||
return False, "Invalid door (git.k-space.ee/k-space/doorboy-proxy)"
|
return False, "Invalid door (git.k-space.ee/k-space/doorboy-proxy)"
|
||||||
|
|
||||||
groups, user = kube.by_slackid(user_id)
|
groups, user = kube.by_slackid(user_id)
|
||||||
if user is None:
|
if user is None:
|
||||||
if authGroup == "k-space:floor":
|
if authGroup == "k-space:floor":
|
||||||
if channel_id == SLACK_CHANNEL_ID:
|
if channel_id == SLACK_CHANNEL_ID:
|
||||||
return True, "🖕 #members user {user_id}"
|
return True, "🖕 {user_id}"
|
||||||
|
|
||||||
return False, f"No user with slack_id {user_id}. Try in #members or doorboy.k-space.ee.",
|
return False, f"No user with slack_id {user_id}. Try in #members or doorboy.k-space.ee.",
|
||||||
else:
|
else:
|
||||||
@@ -132,4 +133,9 @@ async def slack_open(request):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if userOrErrorMsg.startswith("🖕"):
|
||||||
|
slackId = userOrErrorMsg.removeprefix("🖕 ")
|
||||||
|
print(f"WARN: slack #members open with unlinked ID {slackId}")
|
||||||
|
return text(f"Opening {door}… This will stop working! Your Slack ID {slackId} is not linked with auth.k-space.ee, please notify info@k-space.ee.")
|
||||||
|
|
||||||
return text(f"Opening {door}…")
|
return text(f"Opening {door}…")
|
||||||
|
|||||||
Reference in New Issue
Block a user