Implement converter for houdini.data.permission.Permission

This commit is contained in:
Ben 2020-05-17 03:25:39 +01:00
parent 38e4a1e0fa
commit fbe8ba5eb2

View File

@ -348,6 +348,17 @@ class PenguinPuffleConverter(IConverter):
return None return None
class PermissionConverter(IConverter):
description = """Converts a permission identifier to a houdini.data.Permission instance"""
async def convert(self, ctx):
try:
return ctx.p.server.permissions[ctx.argument]
except KeyError:
return None
class SeparatorConverter(IConverter): class SeparatorConverter(IConverter):
__slots__ = ['separator', 'mapper'] __slots__ = ['separator', 'mapper']
@ -442,7 +453,9 @@ ConverterTypes = {
Stamp: StampConverter, Stamp: StampConverter,
Puffle: PuffleConverter, Puffle: PuffleConverter,
PenguinPuffle: PenguinPuffleConverter PenguinPuffle: PenguinPuffleConverter,
Permission: PermissionConverter
} }