opinions = []
# Every plugin is consulted for their opinion
for check in pm.hook.permission_allowed(
datasette=self,
actor=actor,
action=action,
resource=resource,
):
check = await await_me_maybe(check)
if check is not None:
opinions.append(check)
result = None
# If any plugin said False it's false - the veto rule
if any(not r for r in opinions):
result = False
elif any(r for r in opinions):
# Otherwise, if any plugin said True it's true
result = True
For easier debugging of complex situations (where more than one plugin might have contributed an opinion) I'd like to be able to tell which plugin returned which values.
Is there a way I can do this with Pluggy? If not, could I request it as a feature?
I have some code that looks like this:
This is for a plugin-based permission model.
For easier debugging of complex situations (where more than one plugin might have contributed an opinion) I'd like to be able to tell which plugin returned which values.
Is there a way I can do this with Pluggy? If not, could I request it as a feature?