You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Non-admin users hit a broken channel-privilege check if they try to use .urlban, which throws an uncaught exception.
Reproduction steps
Be a non-admin user, i.e. not listed in Sopel's core.admins or core.owner settings
Do .urlban *
Sopel spits out an unexpected AttributeError
Expected behavior
Use of the .urlban command by non-admins should be correctly allowed or denied based on their channel privilege level and the bot's url.exclude_required_access setting.
Relevant logs
[2025-01-24 02:51:44,490] sopel.bot ERROR - Unexpected AttributeError (module 'sopel.privileges' has no attribute 'OP') from msv. Message was: .urlban *
Traceback (most recent call last):
File "/home/sopel/.local/lib/python3.12/site-packages/sopel/bot.py", line 698, in call_rule
rule.execute(sopel, trigger)
File "/home/sopel/.local/lib/python3.12/site-packages/sopel/plugins/rules.py", line 1273, in execute
exit_code = self._handler(bot, trigger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sopel/.local/lib/python3.12/site-packages/sopel/builtins/url.py", line 183, in url_ban
if not _user_can_change_excludes(bot, trigger):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sopel/.local/lib/python3.12/site-packages/sopel/builtins/url.py", line 162, in _user_can_change_excludes
if user_access >= getattr(privileges, required_access):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'sopel.privileges' has no attribute 'OP'
Notes
Someone reported this bug on our IRC last night. @SnoopJ correctly deduced that it was related to the switch to privileges.AccessLevel. We can safely say #2540 was responsible for this breakage; as is often the case, it was my fault. I forgot about #2352 when making that change.
sopel.privileges.names is a new shortcut to sopel.privileges.AccessLevel._member_names_, which is quite a mouthful. (I wanted to create sopel.privileges.AccessLevel.names as a @property, but that doesn't work and I don't want to monkeypatch our subclass of enum.IntFlag too much.)
Sopel version
8.0.1, master
Installation method
pip install
Python version
3.12.7
Operating system
No response
IRCd
No response
Relevant plugins
url
The text was updated successfully, but these errors were encountered:
dgw
added
the
Bug
Things to squish; generally used for issues
label
Jan 24, 2025
The solution there is adding a sopel.privileges.names attribute as a shortcut to sopel.privileges.AccessLevel._member_names_, though using the AccessLevel attr directly would obviously work without the shortcut.
I'm holding off on opening a PR because of unresolved CI issues, though. See #2647.
Description
Non-admin users hit a broken channel-privilege check if they try to use
.urlban
, which throws an uncaught exception.Reproduction steps
core.admins
orcore.owner
settings.urlban *
AttributeError
Expected behavior
Use of the
.urlban
command by non-admins should be correctly allowed or denied based on their channel privilege level and the bot'surl.exclude_required_access
setting.Relevant logs
Notes
Someone reported this bug on our IRC last night. @SnoopJ correctly deduced that it was related to the switch to
privileges.AccessLevel
. We can safely say #2540 was responsible for this breakage; as is often the case, it was my fault. I forgot about #2352 when making that change.sopel.privileges.names
is a new shortcut tosopel.privileges.AccessLevel._member_names_
, which is quite a mouthful. (I wanted to createsopel.privileges.AccessLevel.names
as a@property
, but that doesn't work and I don't want to monkeypatch our subclass ofenum.IntFlag
too much.)Sopel version
8.0.1, master
Installation method
pip install
Python version
3.12.7
Operating system
No response
IRCd
No response
Relevant plugins
url
The text was updated successfully, but these errors were encountered: