Implement authorization with the team repository
Closed this issue · 2 comments
pietroalbini commented
We want to centralize authorization in the rust-lang/team repository, so this bot should use it to detect which users are authorized to interact with it. This should be implemented before deploying the bot.
Changes in rust-lang/team:
- Replace the existing
discord = "username"field withdiscord-id = 1234567890123. - Add
discord_idstoPermissionin the static API, to allow querying which Discord IDs implement a permission. - Implement a
crates_io_ops_bot.APP_NAMEpermission. We'll want it to work similarly to the bors permission, where the list of applications allowed is encoded in thepermissions!macro, to allow strict checking during validation.
Changes in the bot:
Every time we need to check whether a user is allowed or not, the following URL needs to be queried:
https://team-api.infra.rust-lang.org/v1/permissions/crates_io_ops_bot.APP_NAME.json
This way, changes in the team repo are instantly relected in the bot without needing any restart.
nellshamrell commented
- Replace the existing discord = "username" field with discord-id = 1234567890123.
- Add discord_ids to Permission in the static API, to allow querying which Discord IDs implement a permission.
- Implement a crates_io_ops_bot.APP_NAME permission. We'll want it to work similarly to the bors permission, where the list of applications allowed is encoded in the permissions! macro, to allow strict checking during validation.
- Query team api url when checking whether a user is allowed to do something or not
nellshamrell commented
Changes to the teams repo have been implemented in rust-lang/team#340