Add kick extension and user management services#18
Conversation
PenguinBoi12
left a comment
There was a problem hiding this comment.
In general it's good, there's going to be refactor needed eventually when adding support for Space but for now the services are fine.
There's one big issue though... There's no permission check on the command. This means everyone can run kick anyone through that command. I think in general we want to restrict this extension to admin/moderator only through a check if possible. It's a good time to implement reusable permission check for Ada (perhaps it could even be added as part of the default checks in matrix.py directly eventually).
I'm not sure why you used getattr everywhere, you want to avoid using that as much as possible unless it's absolutely necessary, which is rare.
It would be great to have tests.
…esult model based on new matrix.py release
…st coverage for kick_from_rooms and kick_from_context
PenguinBoi12
left a comment
There was a problem hiding this comment.
The only thing I'd change is the is_moderator to make it use can_user_kick but for now it should work fine and we can update it in another PR
Otherwise the rest looks good to me. 🦭
| power_levels = ctx.room.matrix_room.power_levels | ||
| sender_level = power_levels.get_user_level(ctx.sender) | ||
|
|
||
| return sender_level >= power_levels.defaults.kick |

Added the kick extension for managing user removal from rooms and spaces, along with service modules for user management (which can be used for other moderation extension such as ban, mute, etc)